mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +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
3 changed files with 29 additions and 18 deletions
|
@ -87,8 +87,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
DeployerHandler.activate(player, vec, pos, facingVec, mode);
|
DeployerHandler.activate(player, vec, pos, facingVec, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player, World world,
|
protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player,
|
||||||
ItemStack filter) {
|
World world, ItemStack filter) {
|
||||||
if (!filter.hasTag())
|
if (!filter.hasTag())
|
||||||
return;
|
return;
|
||||||
if (!world.getBlockState(pos)
|
if (!world.getBlockState(pos)
|
||||||
|
@ -112,8 +112,9 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
|
|
||||||
List<ItemStack> requiredItems = requirement.getRequiredItems();
|
List<ItemStack> requiredItems = requirement.getRequiredItems();
|
||||||
ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0);
|
ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0);
|
||||||
IItemHandler iItemHandler = context.contraption.inventory;
|
|
||||||
|
|
||||||
|
if (!context.contraption.hasUniversalCreativeCrate) {
|
||||||
|
IItemHandler iItemHandler = context.contraption.inventory;
|
||||||
for (ItemStack required : requiredItems) {
|
for (ItemStack required : requiredItems) {
|
||||||
int amountFound = ItemHelper
|
int amountFound = ItemHelper
|
||||||
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
||||||
|
@ -122,14 +123,14 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
||||||
if (amountFound < required.getCount())
|
if (amountFound < required.getCount())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ItemStack required : requiredItems)
|
for (ItemStack required : requiredItems)
|
||||||
ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
||||||
required.getCount(), false);
|
required.getCount(), false);
|
||||||
|
}
|
||||||
|
|
||||||
CompoundNBT data = null;
|
CompoundNBT data = null;
|
||||||
if (AllBlockTags.SAFE_NBT.matches(blockState)) {
|
if (AllBlockTags.SAFE_NBT.matches(blockState)) {
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = schematicWorld.getTileEntity(pos);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
data = tile.write(new CompoundNBT());
|
data = tile.write(new CompoundNBT());
|
||||||
data = NBTProcessors.process(tile, data, true);
|
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.advanced.GantryShaftBlock;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
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.AdjustableCrateBlock;
|
||||||
|
import com.simibubi.create.content.logistics.block.inventories.CreativeCrateTileEntity;
|
||||||
import com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock;
|
import com.simibubi.create.content.logistics.block.redstone.RedstoneContactBlock;
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
|
||||||
import com.simibubi.create.foundation.render.backend.instancing.IFlywheelWorld;
|
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.EmptyLighter;
|
||||||
import com.simibubi.create.foundation.render.backend.light.GridAlignedBB;
|
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.BlockFace;
|
||||||
import com.simibubi.create.foundation.utility.Coordinate;
|
import com.simibubi.create.foundation.utility.Coordinate;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
@ -123,6 +125,7 @@ public abstract class Contraption {
|
||||||
public AxisAlignedBB bounds;
|
public AxisAlignedBB bounds;
|
||||||
public BlockPos anchor;
|
public BlockPos anchor;
|
||||||
public boolean stalled;
|
public boolean stalled;
|
||||||
|
public boolean hasUniversalCreativeCrate;
|
||||||
|
|
||||||
protected Map<BlockPos, BlockInfo> blocks;
|
protected Map<BlockPos, BlockInfo> blocks;
|
||||||
protected Map<BlockPos, MountedStorage> storage;
|
protected Map<BlockPos, MountedStorage> storage;
|
||||||
|
@ -623,6 +626,11 @@ public abstract class Contraption {
|
||||||
fluidStorage.put(localPos, new MountedFluidStorage(te));
|
fluidStorage.put(localPos, new MountedFluidStorage(te));
|
||||||
if (AllMovementBehaviours.contains(captured.state.getBlock()))
|
if (AllMovementBehaviours.contains(captured.state.getBlock()))
|
||||||
actors.add(MutablePair.of(blockInfo, null));
|
actors.add(MutablePair.of(blockInfo, null));
|
||||||
|
if (te instanceof CreativeCrateTileEntity
|
||||||
|
&& ((CreativeCrateTileEntity) te).getBehaviour(FilteringBehaviour.TYPE)
|
||||||
|
.getFilter()
|
||||||
|
.isEmpty())
|
||||||
|
hasUniversalCreativeCrate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -735,6 +743,7 @@ public abstract class Contraption {
|
||||||
bounds = NBTHelper.readAABB(nbt.getList("BoundsFront", 5));
|
bounds = NBTHelper.readAABB(nbt.getList("BoundsFront", 5));
|
||||||
|
|
||||||
stalled = nbt.getBoolean("Stalled");
|
stalled = nbt.getBoolean("Stalled");
|
||||||
|
hasUniversalCreativeCrate = nbt.getBoolean("BottomlessSupply");
|
||||||
anchor = NBTUtil.readBlockPos(nbt.getCompound("Anchor"));
|
anchor = NBTUtil.readBlockPos(nbt.getCompound("Anchor"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,6 +819,7 @@ public abstract class Contraption {
|
||||||
nbt.put("FluidStorage", fluidStorageNBT);
|
nbt.put("FluidStorage", fluidStorageNBT);
|
||||||
nbt.put("Anchor", NBTUtil.writeBlockPos(anchor));
|
nbt.put("Anchor", NBTUtil.writeBlockPos(anchor));
|
||||||
nbt.putBoolean("Stalled", stalled);
|
nbt.putBoolean("Stalled", stalled);
|
||||||
|
nbt.putBoolean("BottomlessSupply", hasUniversalCreativeCrate);
|
||||||
|
|
||||||
if (bounds != null) {
|
if (bounds != null) {
|
||||||
ListNBT bb = NBTHelper.writeAABB(bounds);
|
ListNBT bb = NBTHelper.writeAABB(bounds);
|
||||||
|
|
|
@ -496,7 +496,7 @@ public class EjectorTileEntity extends KineticTileEntity {
|
||||||
|
|
||||||
powered = compound.getBoolean("Powered");
|
powered = compound.getBoolean("Powered");
|
||||||
state = NBTHelper.readEnum(compound, "State", State.class);
|
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),
|
launchedItems = NBTHelper.readCompoundList(compound.getList("LaunchedItems", NBT.TAG_COMPOUND),
|
||||||
nbt -> IntAttached.read(nbt, ItemStack::read));
|
nbt -> IntAttached.read(nbt, ItemStack::read));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue