A pulley good day

- Fix crash when moving pulleys on a contraption
 - Bump forge and parchment versions
 - Bump flywheel version
This commit is contained in:
Jozufozu 2022-07-10 15:44:15 -04:00
parent 474a72b2a6
commit f03bf9839c
7 changed files with 29 additions and 71 deletions

View file

@ -6,7 +6,7 @@ org.gradle.daemon = false
# mod version info # mod version info
mod_version = 0.5.0 mod_version = 0.5.0
minecraft_version = 1.18.2 minecraft_version = 1.18.2
forge_version = 40.1.54 forge_version = 40.1.60
# build dependency versions # build dependency versions
forgegradle_version = 5.1.+ forgegradle_version = 5.1.+
@ -15,11 +15,11 @@ mixin_version = 0.8.5
librarian_version = 1.+ librarian_version = 1.+
shadow_version = 7.1.0 shadow_version = 7.1.0
cursegradle_version = 1.4.0 cursegradle_version = 1.4.0
parchment_version = 2022.07.03 parchment_version = 2022.07.10
# dependency versions # dependency versions
registrate_version = MC1.18.2-1.1.3 registrate_version = MC1.18.2-1.1.3
flywheel_version = 1.18-0.6.3.81 flywheel_version = 1.18-0.6.4.83
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

@ -1,19 +1,18 @@
package com.simibubi.create.content.contraptions.components.structureMovement; package com.simibubi.create.content.contraptions.components.structureMovement;
import com.jozufozu.flywheel.light.LightProvider; import com.jozufozu.flywheel.light.TickingLightListener;
import com.jozufozu.flywheel.light.MovingListener;
import com.jozufozu.flywheel.util.box.GridAlignedBB; import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.jozufozu.flywheel.util.box.ImmutableBox; import com.jozufozu.flywheel.util.box.ImmutableBox;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.AllConfigs;
public class NonStationaryLighter<C extends Contraption> extends ContraptionLighter<C> implements MovingListener { public class NonStationaryLighter<C extends Contraption> extends ContraptionLighter<C> implements TickingLightListener {
public NonStationaryLighter(C contraption) { public NonStationaryLighter(C contraption) {
super(contraption); super(contraption);
} }
@Override @Override
public boolean update(LightProvider provider) { public boolean tickLightListener() {
if (getVolume().volume() > AllConfigs.CLIENT.maxContraptionLightVolume.get()) if (getVolume().volume() > AllConfigs.CLIENT.maxContraptionLightVolume.get())
return false; return false;
@ -25,7 +24,7 @@ public class NonStationaryLighter<C extends Contraption> extends ContraptionLigh
bounds.assign(contraptionBounds); bounds.assign(contraptionBounds);
growBoundsForEdgeData(bounds); growBoundsForEdgeData(bounds);
lightVolume.move(provider, bounds); lightVolume.move(bounds);
return true; return true;
} }

View file

@ -8,10 +8,8 @@ import com.jozufozu.flywheel.core.instancing.GroupInstance;
import com.jozufozu.flywheel.core.instancing.SelectInstance; import com.jozufozu.flywheel.core.instancing.SelectInstance;
import com.jozufozu.flywheel.core.materials.oriented.OrientedData; import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
import com.jozufozu.flywheel.light.LightPacking; import com.jozufozu.flywheel.light.LightPacking;
import com.jozufozu.flywheel.light.LightProvider;
import com.jozufozu.flywheel.light.LightUpdater;
import com.jozufozu.flywheel.light.LightVolume; import com.jozufozu.flywheel.light.LightVolume;
import com.jozufozu.flywheel.light.MovingListener; import com.jozufozu.flywheel.light.TickingLightListener;
import com.jozufozu.flywheel.util.box.GridAlignedBB; import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.jozufozu.flywheel.util.box.ImmutableBox; import com.jozufozu.flywheel.util.box.ImmutableBox;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
@ -22,7 +20,7 @@ import net.minecraft.core.Direction;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.LightLayer;
public abstract class AbstractPulleyInstance extends ShaftInstance implements DynamicInstance, MovingListener { public abstract class AbstractPulleyInstance extends ShaftInstance implements DynamicInstance, TickingLightListener {
final OrientedData coil; final OrientedData coil;
final SelectInstance<OrientedData> magnet; final SelectInstance<OrientedData> magnet;
@ -55,8 +53,8 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements Dy
updateOffset(); updateOffset();
updateVolume(); updateVolume();
light = new LightVolume(volume); light = new LightVolume(world, volume);
light.initialize(LightUpdater.get(world).getProvider()); light.initialize();
} }
@Override @Override
@ -139,9 +137,9 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements Dy
protected abstract boolean isRunning(); protected abstract boolean isRunning();
@Override @Override
public boolean update(LightProvider provider) { public boolean tickLightListener() {
if (updateVolume()) { if (updateVolume()) {
light.move(provider, volume); light.move(volume);
return true; return true;
} }
return false; return false;
@ -190,8 +188,8 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements Dy
} }
@Override @Override
public void onLightUpdate(LightProvider world, LightLayer type, ImmutableBox changed) { public void onLightUpdate(LightLayer type, ImmutableBox changed) {
super.onLightUpdate(world, type, changed); super.onLightUpdate(type, changed);
light.onLightUpdate(world, type, changed); light.onLightUpdate(type, changed);
} }
} }

View file

@ -78,44 +78,9 @@ 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 @Override
public void detachLightListeners() { public void detachLightListeners() {
// noop // noop, no light updater for contraption levels
} }
} }

View file

@ -2,9 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.re
import com.jozufozu.flywheel.light.GPULightVolume; import com.jozufozu.flywheel.light.GPULightVolume;
import com.jozufozu.flywheel.light.LightListener; import com.jozufozu.flywheel.light.LightListener;
import com.jozufozu.flywheel.light.LightProvider;
import com.jozufozu.flywheel.light.LightUpdater; import com.jozufozu.flywheel.light.LightUpdater;
import com.jozufozu.flywheel.light.ListenerStatus;
import com.jozufozu.flywheel.util.box.GridAlignedBB; import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.jozufozu.flywheel.util.box.ImmutableBox; import com.jozufozu.flywheel.util.box.ImmutableBox;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
@ -27,9 +25,9 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
bounds = getContraptionBounds(); bounds = getContraptionBounds();
growBoundsForEdgeData(bounds); growBoundsForEdgeData(bounds);
lightVolume = new GPULightVolume(bounds); lightVolume = new GPULightVolume(contraption.entity.level, bounds);
lightVolume.initialize(lightUpdater.getProvider()); lightVolume.initialize();
scheduleRebuild = true; scheduleRebuild = true;
lightUpdater.addListener(this); lightUpdater.addListener(this);
@ -38,18 +36,18 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
public abstract GridAlignedBB getContraptionBounds(); public abstract GridAlignedBB getContraptionBounds();
@Override @Override
public ListenerStatus status() { public boolean isListenerInvalid() {
return ListenerStatus.OKAY; return lightVolume.isListenerInvalid();
} }
@Override @Override
public void onLightUpdate(LightProvider world, LightLayer type, ImmutableBox changed) { public void onLightUpdate(LightLayer type, ImmutableBox changed) {
lightVolume.onLightUpdate(world, type, changed); lightVolume.onLightUpdate(type, changed);
} }
@Override @Override
public void onLightPacket(LightProvider world, int chunkX, int chunkZ) { public void onLightPacket(int chunkX, int chunkZ) {
lightVolume.onLightPacket(world, chunkX, chunkZ); lightVolume.onLightPacket(chunkX, chunkZ);
} }
protected static void growBoundsForEdgeData(GridAlignedBB bounds) { protected static void growBoundsForEdgeData(GridAlignedBB bounds) {

View file

@ -14,9 +14,7 @@ import java.util.function.Function;
import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher; import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher;
import com.jozufozu.flywheel.light.LightListener; import com.jozufozu.flywheel.light.LightListener;
import com.jozufozu.flywheel.light.LightProvider;
import com.jozufozu.flywheel.light.LightUpdater; import com.jozufozu.flywheel.light.LightUpdater;
import com.jozufozu.flywheel.light.ListenerStatus;
import com.jozufozu.flywheel.util.box.GridAlignedBB; import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.jozufozu.flywheel.util.box.ImmutableBox; import com.jozufozu.flywheel.util.box.ImmutableBox;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
@ -582,12 +580,12 @@ public class BeltTileEntity extends KineticTileEntity {
} }
@Override @Override
public ListenerStatus status() { public boolean isListenerInvalid() {
return remove ? ListenerStatus.REMOVE : ListenerStatus.OKAY; return remove;
} }
@Override @Override
public void onLightUpdate(LightProvider world, LightLayer type, ImmutableBox changed) { public void onLightUpdate(LightLayer type, ImmutableBox changed) {
if (remove) if (remove)
return; return;
if (level == null) if (level == null)

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.3,1.18-0.6.4)" versionRange="[1.18-0.6.4,1.18-0.6.5)"
ordering="AFTER" ordering="AFTER"
side="CLIENT" side="CLIENT"