Make roller account for custom tracks

This commit is contained in:
IThundxr 2024-03-16 13:56:18 -04:00 committed by GitHub
parent 04d1a53846
commit 2a5935db61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,7 @@ import javax.annotation.Nullable;
import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTags;
import com.simibubi.create.content.contraptions.actors.roller.RollerBlockEntity.RollingMode; import com.simibubi.create.content.contraptions.actors.roller.RollerBlockEntity.RollingMode;
import com.simibubi.create.content.contraptions.behaviour.MovementContext; import com.simibubi.create.content.contraptions.behaviour.MovementContext;
import com.simibubi.create.content.contraptions.pulley.PulleyContraption; import com.simibubi.create.content.contraptions.pulley.PulleyContraption;
@ -108,7 +109,7 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour {
return false; return false;
return super.canBreak(world, breakingPos, state) && !state.getCollisionShape(world, breakingPos) return super.canBreak(world, breakingPos, state) && !state.getCollisionShape(world, breakingPos)
.isEmpty() && !AllBlocks.TRACK.has(state); .isEmpty() && !AllTags.AllBlockTags.TRACKS.matches(state);
} }
@Override @Override
@ -141,7 +142,7 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour {
max = hardness; max = hardness;
argMax = toBreak; argMax = toBreak;
} }
if (argMax == null) { if (argMax == null) {
triggerPaver(context, pos); triggerPaver(context, pos);
return; return;
@ -194,13 +195,13 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour {
int startingY = 1; int startingY = 1;
if (!getStateToPaveWith(context).isAir()) { if (!getStateToPaveWith(context).isAir()) {
FilterItemStack filter = context.getFilterFromBE(); FilterItemStack filter = context.getFilterFromBE();
if (!ItemHelper if (!ItemHelper
.extract(context.contraption.getSharedInventory(), .extract(context.contraption.getSharedInventory(),
stack -> filter.test(context.world, stack), 1, true) stack -> filter.test(context.world, stack), 1, true)
.isEmpty()) .isEmpty())
startingY = 0; startingY = 0;
} }
// Train // Train
PaveTask profileForTracks = createHeightProfileForTracks(context); PaveTask profileForTracks = createHeightProfileForTracks(context);
if (profileForTracks != null) { if (profileForTracks != null) {
@ -305,7 +306,7 @@ public class RollerMovementBehaviour extends BlockBreakingMovementBehaviour {
BlockState stateToPaveWith = getStateToPaveWith(context); BlockState stateToPaveWith = getStateToPaveWith(context);
BlockState stateToPaveWithAsSlab = getStateToPaveWithAsSlab(context); BlockState stateToPaveWithAsSlab = getStateToPaveWithAsSlab(context);
RollingMode mode = getMode(context); RollingMode mode = getMode(context);
if (mode != RollingMode.TUNNEL_PAVE && stateToPaveWith.isAir()) if (mode != RollingMode.TUNNEL_PAVE && stateToPaveWith.isAir())
return; return;