diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java b/src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java
index fea46e61d..3e5ae15ca 100644
--- a/src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java
+++ b/src/main/java/com/jozufozu/flywheel/api/visual/BlockEntityVisual.java
@@ -8,6 +8,17 @@ import com.jozufozu.flywheel.api.instance.Instance;
import net.minecraft.world.level.block.entity.BlockEntity;
+/**
+ * A visual associated with a specific block entity.
+ *
+ *
BlockEntityVisuals exist for at most the lifetime of the block entity they are associated with.
+ *
+ * If the block state at your BlockEntityVisual's position changes without removing the block entity,
+ * the visual will be deleted and recreated. Therefore, it is also safe to assume than the block state
+ * is constant for the lifetime of the visual.
+ *
+ * @param The block entity type.
+ */
public interface BlockEntityVisual extends Visual {
/**
* Collect all instances that should render with a crumbling overlay
diff --git a/src/main/java/com/jozufozu/flywheel/api/visual/Visual.java b/src/main/java/com/jozufozu/flywheel/api/visual/Visual.java
index 481b0352f..4627a80f5 100644
--- a/src/main/java/com/jozufozu/flywheel/api/visual/Visual.java
+++ b/src/main/java/com/jozufozu/flywheel/api/visual/Visual.java
@@ -24,18 +24,6 @@ public interface Visual {
*/
void update(float partialTick);
- /**
- * When a visual is reset, the visual is deleted and re-created.
- *
- * Just before {@link #update)} would be called, {@code shouldReset} is checked.
- * If this function returns {@code true}, then this visual will be {@link #delete deleted},
- * and another visual will be constructed to replace it. This allows for more sane resource
- * acquisition compared to trying to update everything within the lifetime of a visual.
- *
- * @return {@code true} if this visual should be discarded and refreshed.
- */
- boolean shouldReset();
-
/**
* Free any acquired resources.
*/
diff --git a/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelRendererMixin.java b/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelRendererMixin.java
index e5cd96ba2..8b00b1b76 100644
--- a/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelRendererMixin.java
+++ b/src/main/java/com/jozufozu/flywheel/impl/mixin/visualmanage/LevelRendererMixin.java
@@ -34,6 +34,13 @@ abstract class LevelRendererMixin {
return;
}
- manager.getBlockEntities().queueUpdate(blockEntity);
+ var blockEntities = manager.getBlockEntities();
+ if (oldState != newState) {
+ blockEntities.queueRemove(blockEntity);
+ blockEntities.queueAdd(blockEntity);
+ } else {
+ // I don't think this is possible to reach in vanilla
+ blockEntities.queueUpdate(blockEntity);
+ }
}
}
diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Storage.java b/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Storage.java
index f90a189e8..a3da7fd51 100644
--- a/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Storage.java
+++ b/src/main/java/com/jozufozu/flywheel/impl/visualization/storage/Storage.java
@@ -84,15 +84,7 @@ public abstract class Storage {
return;
}
- // resetting visuals is by default used to handle block state changes.
- if (visual.shouldReset()) {
- // delete and re-create the visual.
- // resetting a visual supersedes updating it.
- remove(obj);
- create(obj, partialTick);
- } else {
- visual.update(partialTick);
- }
+ visual.update(partialTick);
}
public void recreateAll(float partialTick) {
diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java b/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java
index 68df9cca8..fcde2a34d 100644
--- a/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java
+++ b/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractBlockEntityVisual.java
@@ -65,11 +65,6 @@ public abstract class AbstractBlockEntityVisual extends A
this.notifier = notifier;
}
- @Override
- public boolean shouldReset() {
- return blockEntity.getBlockState() != blockState;
- }
-
/**
* In order to accommodate for floating point precision errors at high coordinates,
* {@link VisualManager}s are allowed to arbitrarily adjust the origin, and
diff --git a/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java b/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java
index 717db26ab..3bf4e3d38 100644
--- a/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java
+++ b/src/main/java/com/jozufozu/flywheel/lib/visual/AbstractVisual.java
@@ -39,12 +39,7 @@ public abstract class AbstractVisual implements Visual {
public void update(float partialTick) {
}
- @Override
- public boolean shouldReset() {
- return false;
- }
-
- protected abstract void _delete();
+ protected abstract void _delete();
@Override
public final void delete() {
diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java b/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java
index d4c8784b6..c6ad5479c 100644
--- a/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java
+++ b/src/main/java/com/jozufozu/flywheel/vanilla/effect/ExampleEffect.java
@@ -140,12 +140,7 @@ public class ExampleEffect implements Effect {
public void update(float partialTick) {
}
- @Override
- public boolean shouldReset() {
- return false;
- }
-
- @Override
+ @Override
public void delete() {
effects.forEach(BoidVisual::_delete);
}