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 = 0.5.0
minecraft_version = 1.18.2
forge_version = 40.1.54
forge_version = 40.1.60
# build dependency versions
forgegradle_version = 5.1.+
@ -15,11 +15,11 @@ mixin_version = 0.8.5
librarian_version = 1.+
shadow_version = 7.1.0
cursegradle_version = 1.4.0
parchment_version = 2022.07.03
parchment_version = 2022.07.10
# dependency versions
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_version = 9.5.3.143
curios_minecraft_version = 1.18.2

View file

@ -1,19 +1,18 @@
package com.simibubi.create.content.contraptions.components.structureMovement;
import com.jozufozu.flywheel.light.LightProvider;
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.ImmutableBox;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionLighter;
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) {
super(contraption);
}
@Override
public boolean update(LightProvider provider) {
public boolean tickLightListener() {
if (getVolume().volume() > AllConfigs.CLIENT.maxContraptionLightVolume.get())
return false;
@ -25,7 +24,7 @@ public class NonStationaryLighter<C extends Contraption> extends ContraptionLigh
bounds.assign(contraptionBounds);
growBoundsForEdgeData(bounds);
lightVolume.move(provider, bounds);
lightVolume.move(bounds);
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.materials.oriented.OrientedData;
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.MovingListener;
import com.jozufozu.flywheel.light.TickingLightListener;
import com.jozufozu.flywheel.util.box.GridAlignedBB;
import com.jozufozu.flywheel.util.box.ImmutableBox;
import com.mojang.math.Vector3f;
@ -22,7 +20,7 @@ import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
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 SelectInstance<OrientedData> magnet;
@ -55,8 +53,8 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements Dy
updateOffset();
updateVolume();
light = new LightVolume(volume);
light.initialize(LightUpdater.get(world).getProvider());
light = new LightVolume(world, volume);
light.initialize();
}
@Override
@ -139,9 +137,9 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements Dy
protected abstract boolean isRunning();
@Override
public boolean update(LightProvider provider) {
public boolean tickLightListener() {
if (updateVolume()) {
light.move(provider, volume);
light.move(volume);
return true;
}
return false;
@ -190,8 +188,8 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements Dy
}
@Override
public void onLightUpdate(LightProvider world, LightLayer type, ImmutableBox changed) {
super.onLightUpdate(world, type, changed);
light.onLightUpdate(world, type, changed);
public void onLightUpdate(LightLayer type, ImmutableBox changed) {
super.onLightUpdate(type, changed);
light.onLightUpdate(type, changed);
}
}

View file

@ -78,44 +78,9 @@ public class ContraptionInstanceManager extends BlockEntityInstanceManager {
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
// 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.LightListener;
import com.jozufozu.flywheel.light.LightProvider;
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.ImmutableBox;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
@ -27,9 +25,9 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
bounds = getContraptionBounds();
growBoundsForEdgeData(bounds);
lightVolume = new GPULightVolume(bounds);
lightVolume = new GPULightVolume(contraption.entity.level, bounds);
lightVolume.initialize(lightUpdater.getProvider());
lightVolume.initialize();
scheduleRebuild = true;
lightUpdater.addListener(this);
@ -38,18 +36,18 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
public abstract GridAlignedBB getContraptionBounds();
@Override
public ListenerStatus status() {
return ListenerStatus.OKAY;
public boolean isListenerInvalid() {
return lightVolume.isListenerInvalid();
}
@Override
public void onLightUpdate(LightProvider world, LightLayer type, ImmutableBox changed) {
lightVolume.onLightUpdate(world, type, changed);
public void onLightUpdate(LightLayer type, ImmutableBox changed) {
lightVolume.onLightUpdate(type, changed);
}
@Override
public void onLightPacket(LightProvider world, int chunkX, int chunkZ) {
lightVolume.onLightPacket(world, chunkX, chunkZ);
public void onLightPacket(int chunkX, int chunkZ) {
lightVolume.onLightPacket(chunkX, chunkZ);
}
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.light.LightListener;
import com.jozufozu.flywheel.light.LightProvider;
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.ImmutableBox;
import com.simibubi.create.AllBlocks;
@ -582,12 +580,12 @@ public class BeltTileEntity extends KineticTileEntity {
}
@Override
public ListenerStatus status() {
return remove ? ListenerStatus.REMOVE : ListenerStatus.OKAY;
public boolean isListenerInvalid() {
return remove;
}
@Override
public void onLightUpdate(LightProvider world, LightLayer type, ImmutableBox changed) {
public void onLightUpdate(LightLayer type, ImmutableBox changed) {
if (remove)
return;
if (level == null)

View file

@ -32,6 +32,6 @@ Technology that empowers the player.'''
[[dependencies.create]]
modId="flywheel"
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"
side="CLIENT"