diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java index d1825eef9..20e9a0d0f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java @@ -74,7 +74,7 @@ public class DeployerMovementBehaviour extends MovementBehaviour { World world = context.world; ItemStack filter = getFilter(context); - if (AllItems.SCHEMATIC.isIn(filter)) + if (AllItems.SCHEMATIC.isIn(filter)) activateAsSchematicPrinter(context, pos, player, world, filter); Vec3d facingVec = new Vec3d(context.state.get(DeployerBlock.FACING) @@ -87,8 +87,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour { DeployerHandler.activate(player, vec, pos, facingVec, mode); } - protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player, World world, - ItemStack filter) { + protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player, + World world, ItemStack filter) { if (!filter.hasTag()) return; if (!world.getBlockState(pos) @@ -112,24 +112,25 @@ public class DeployerMovementBehaviour extends MovementBehaviour { List requiredItems = requirement.getRequiredItems(); ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0); - IItemHandler iItemHandler = context.contraption.inventory; - - for (ItemStack required : requiredItems) { - int amountFound = ItemHelper - .extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, - required.getCount(), true) - .getCount(); - if (amountFound < required.getCount()) - return; + + if (!context.contraption.hasUniversalCreativeCrate) { + IItemHandler iItemHandler = context.contraption.inventory; + for (ItemStack required : requiredItems) { + int amountFound = ItemHelper + .extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, + required.getCount(), true) + .getCount(); + if (amountFound < required.getCount()) + return; + } + for (ItemStack required : requiredItems) + ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, + required.getCount(), false); } - for (ItemStack required : requiredItems) - ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO, - required.getCount(), false); - CompoundNBT data = null; if (AllBlockTags.SAFE_NBT.matches(blockState)) { - TileEntity tile = world.getTileEntity(pos); + TileEntity tile = schematicWorld.getTileEntity(pos); if (tile != null) { data = tile.write(new CompoundNBT()); data = NBTProcessors.process(tile, data, true); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index 659c2f591..67f945497 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -51,12 +51,14 @@ import com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity; import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock; +import com.simibubi.create.content.logistics.block.inventories.CreativeCrateTileEntity; import com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.fluid.CombinedTankWrapper; import com.simibubi.create.foundation.render.backend.instancing.IFlywheelWorld; import com.simibubi.create.foundation.render.backend.light.EmptyLighter; import com.simibubi.create.foundation.render.backend.light.GridAlignedBB; +import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.utility.BlockFace; import com.simibubi.create.foundation.utility.Coordinate; import com.simibubi.create.foundation.utility.Iterate; @@ -123,6 +125,7 @@ public abstract class Contraption { public AxisAlignedBB bounds; public BlockPos anchor; public boolean stalled; + public boolean hasUniversalCreativeCrate; protected Map blocks; protected Map storage; @@ -623,6 +626,11 @@ public abstract class Contraption { fluidStorage.put(localPos, new MountedFluidStorage(te)); if (AllMovementBehaviours.contains(captured.state.getBlock())) actors.add(MutablePair.of(blockInfo, null)); + if (te instanceof CreativeCrateTileEntity + && ((CreativeCrateTileEntity) te).getBehaviour(FilteringBehaviour.TYPE) + .getFilter() + .isEmpty()) + hasUniversalCreativeCrate = true; } @Nullable @@ -735,6 +743,7 @@ public abstract class Contraption { bounds = NBTHelper.readAABB(nbt.getList("BoundsFront", 5)); stalled = nbt.getBoolean("Stalled"); + hasUniversalCreativeCrate = nbt.getBoolean("BottomlessSupply"); anchor = NBTUtil.readBlockPos(nbt.getCompound("Anchor")); } @@ -810,6 +819,7 @@ public abstract class Contraption { nbt.put("FluidStorage", fluidStorageNBT); nbt.put("Anchor", NBTUtil.writeBlockPos(anchor)); nbt.putBoolean("Stalled", stalled); + nbt.putBoolean("BottomlessSupply", hasUniversalCreativeCrate); if (bounds != null) { ListNBT bb = NBTHelper.writeAABB(bounds); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java index a5d0bf6e1..5ce6c5490 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java @@ -496,7 +496,7 @@ public class EjectorTileEntity extends KineticTileEntity { powered = compound.getBoolean("Powered"); state = NBTHelper.readEnum(compound, "State", State.class); - lidProgress.readNBT(compound.getCompound("Lid"), clientPacket); + lidProgress.readNBT(compound.getCompound("Lid"), false); launchedItems = NBTHelper.readCompoundList(compound.getList("LaunchedItems", NBT.TAG_COMPOUND), nbt -> IntAttached.read(nbt, ItemStack::read));