Mopping up

- Fixes contraption world leak twofold.
 - Bump flywheel - 0.6.3.81
This commit is contained in:
Jozufozu 2022-06-22 13:44:34 -07:00
parent cdadd12b41
commit dc20f7091c
3 changed files with 46 additions and 4 deletions

View File

@ -19,7 +19,7 @@ parchment_version = 2022.03.13
# dependency versions # dependency versions
registrate_version = MC1.18.2-1.0.25 registrate_version = MC1.18.2-1.0.25
flywheel_version = 1.18-0.6.2.66 flywheel_version = 1.18-0.6.3.81
jei_minecraft_version = 1.18.2 jei_minecraft_version = 1.18.2
jei_version = 9.5.3.143 jei_version = 9.5.3.143
curios_minecraft_version = 1.18.2 curios_minecraft_version = 1.18.2

View File

@ -8,6 +8,8 @@ import org.apache.commons.lang3.tuple.Pair;
import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.api.instance.DynamicInstance;
import com.jozufozu.flywheel.api.instance.TickableInstance;
import com.jozufozu.flywheel.backend.instancing.AbstractInstance;
import com.jozufozu.flywheel.backend.instancing.TaskEngine; import com.jozufozu.flywheel.backend.instancing.TaskEngine;
import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstanceManager; import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstanceManager;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
@ -37,7 +39,7 @@ public class ContraptionInstanceManager extends BlockEntityInstanceManager {
public void tick() { public void tick() {
actors.forEach(ActorInstance::tick); actors.forEach(ActorInstance::tick);
} }
@Override @Override
protected boolean canCreateInstance(BlockEntity blockEntity) { protected boolean canCreateInstance(BlockEntity blockEntity) {
return !contraption.isHiddenInPortal(blockEntity.getBlockPos()); return !contraption.isHiddenInPortal(blockEntity.getBlockPos());
@ -59,7 +61,7 @@ public class ContraptionInstanceManager extends BlockEntityInstanceManager {
public ActorInstance createActor(Pair<StructureBlockInfo, MovementContext> actor) { public ActorInstance createActor(Pair<StructureBlockInfo, MovementContext> actor) {
StructureBlockInfo blockInfo = actor.getLeft(); StructureBlockInfo blockInfo = actor.getLeft();
MovementContext context = actor.getRight(); MovementContext context = actor.getRight();
if (contraption.isHiddenInPortal(context.localPos)) if (contraption.isHiddenInPortal(context.localPos))
return null; return null;
@ -75,5 +77,45 @@ public class ContraptionInstanceManager extends BlockEntityInstanceManager {
return null; return null;
} }
// -----------------------------------------------------------------
// The following methods should be identical to the base methods,
// but without reference to LightUpdater.
// -----------------------------------------------------------------
@Override
protected AbstractInstance createInternal(BlockEntity obj) {
AbstractInstance renderer = createRaw(obj);
if (renderer != null) {
renderer.init();
renderer.updateLight();
instances.put(obj, renderer);
if (renderer instanceof TickableInstance r) {
tickableInstances.put(obj, r);
r.tick();
}
if (renderer instanceof DynamicInstance r) {
dynamicInstances.put(obj, r);
r.beginFrame();
}
}
return renderer;
}
protected void removeInternal(BlockEntity obj, AbstractInstance instance) {
instance.remove();
instances.remove(obj);
dynamicInstances.remove(obj);
tickableInstances.remove(obj);
}
@Override
public void detachLightListeners() {
// noop
}
} }

View File

@ -32,6 +32,6 @@ Technology that empowers the player.'''
[[dependencies.create]] [[dependencies.create]]
modId="flywheel" modId="flywheel"
mandatory=true mandatory=true
versionRange="[1.18-0.6.2,1.18-0.6.3)" versionRange="[1.18-0.6.3,1.18-0.6.4)"
ordering="AFTER" ordering="AFTER"
side="CLIENT" side="CLIENT"