mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-13 05:54:17 +01:00
Fix-ups
- Filterless Creative Crates now serve as universal supply to schematic-driven deployers - An attempt to force-update ejectors to not miss out on lid animations - Fixed schematic-driven deployers not copying safe nbt data
This commit is contained in:
parent
c82896998c
commit
b1bec1a1f9
@ -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<ItemStack> 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);
|
||||
|
@ -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<BlockPos, BlockInfo> blocks;
|
||||
protected Map<BlockPos, MountedStorage> 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);
|
||||
|
@ -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));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user