mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 19:13:42 +01:00
Add extra item capability checks
Many mods does not invalidate their capabilities, so fix it on our end
This commit is contained in:
parent
e3394a8907
commit
d75793d036
13 changed files with 63 additions and 22 deletions
|
@ -8,6 +8,8 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.crafter.ConnectedInputHandler.ConnectedInput;
|
import com.simibubi.create.content.contraptions.components.crafter.ConnectedInputHandler.ConnectedInput;
|
||||||
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity.Phase;
|
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity.Phase;
|
||||||
import com.simibubi.create.foundation.block.ITE;
|
import com.simibubi.create.foundation.block.ITE;
|
||||||
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
|
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
import com.simibubi.create.foundation.utility.Pointing;
|
import com.simibubi.create.foundation.utility.Pointing;
|
||||||
|
@ -234,6 +236,14 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock implements IT
|
||||||
return ActionResultType.PASS;
|
return ActionResultType.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
||||||
|
boolean isMoving) {
|
||||||
|
InvManipulationBehaviour behaviour = TileEntityBehaviour.get(worldIn, pos, InvManipulationBehaviour.TYPE);
|
||||||
|
if (behaviour != null)
|
||||||
|
behaviour.onNeighborChanged(fromPos);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getParticleTargetRadius() {
|
public float getParticleTargetRadius() {
|
||||||
return .85f;
|
return .85f;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.simibubi.create.content.logistics.block.belts.tunnel;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import com.simibubi.create.CreateClient;
|
|
||||||
import com.simibubi.create.content.logistics.packet.TunnelFlapPacket;
|
import com.simibubi.create.content.logistics.packet.TunnelFlapPacket;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
|
|
||||||
public abstract class AbstractChuteBlock extends Block implements IWrenchable, ITE<ChuteTileEntity> {
|
public abstract class AbstractChuteBlock extends Block implements IWrenchable, ITE<ChuteTileEntity> {
|
||||||
|
|
||||||
|
@ -156,9 +157,10 @@ public abstract class AbstractChuteBlock extends Block implements IWrenchable, I
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(BlockState p_220069_1_, World world, BlockPos pos, Block p_220069_4_,
|
public void neighborChanged(BlockState p_220069_1_, World world, BlockPos pos, Block p_220069_4_,
|
||||||
BlockPos neighbourPos, boolean p_220069_6_) {
|
BlockPos neighbourPos, boolean p_220069_6_) {
|
||||||
if (pos.down()
|
if (pos.down().equals(neighbourPos))
|
||||||
.equals(neighbourPos))
|
|
||||||
withTileEntityDo(world, pos, ChuteTileEntity::blockBelowChanged);
|
withTileEntityDo(world, pos, ChuteTileEntity::blockBelowChanged);
|
||||||
|
else if (pos.up().equals(neighbourPos))
|
||||||
|
withTileEntityDo(world, pos, chute -> chute.capAbove = LazyOptional.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract BlockState updateChuteState(BlockState state, BlockState above, IBlockReader world, BlockPos pos);
|
public abstract BlockState updateChuteState(BlockState state, BlockState above, IBlockReader world, BlockPos pos);
|
||||||
|
|
|
@ -272,6 +272,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
||||||
|
|
||||||
public void blockBelowChanged() {
|
public void blockBelowChanged() {
|
||||||
updateAirFlow = true;
|
updateAirFlow = true;
|
||||||
|
capBelow = LazyOptional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnParticles(float itemMotion) {
|
private void spawnParticles(float itemMotion) {
|
||||||
|
|
|
@ -59,6 +59,9 @@ public abstract class AbstractFunnelBlock extends Block implements ITE<FunnelTil
|
||||||
boolean isMoving) {
|
boolean isMoving) {
|
||||||
if (worldIn.isRemote)
|
if (worldIn.isRemote)
|
||||||
return;
|
return;
|
||||||
|
InvManipulationBehaviour behaviour = TileEntityBehaviour.get(worldIn, pos, InvManipulationBehaviour.TYPE);
|
||||||
|
if (behaviour != null)
|
||||||
|
behaviour.onNeighborChanged(fromPos);
|
||||||
boolean previouslyPowered = state.get(POWERED);
|
boolean previouslyPowered = state.get(POWERED);
|
||||||
if (previouslyPowered != worldIn.isBlockPowered(pos))
|
if (previouslyPowered != worldIn.isBlockPowered(pos))
|
||||||
worldIn.setBlockState(pos, state.cycle(POWERED), 2);
|
worldIn.setBlockState(pos, state.cycle(POWERED), 2);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.lang.ref.WeakReference;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.CreateClient;
|
|
||||||
import com.simibubi.create.content.contraptions.components.saw.SawTileEntity;
|
import com.simibubi.create.content.contraptions.components.saw.SawTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.goggles.IHaveHoveringInformation;
|
import com.simibubi.create.content.contraptions.goggles.IHaveHoveringInformation;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
|
||||||
|
@ -13,7 +12,6 @@ import com.simibubi.create.content.contraptions.relays.belt.transport.Transporte
|
||||||
import com.simibubi.create.content.logistics.block.chute.ChuteTileEntity;
|
import com.simibubi.create.content.logistics.block.chute.ChuteTileEntity;
|
||||||
import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape;
|
import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape;
|
||||||
import com.simibubi.create.content.logistics.packet.FunnelFlapPacket;
|
import com.simibubi.create.content.logistics.packet.FunnelFlapPacket;
|
||||||
import com.simibubi.create.content.logistics.packet.TunnelFlapPacket;
|
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||||
import com.simibubi.create.foundation.item.TooltipHelper;
|
import com.simibubi.create.foundation.item.TooltipHelper;
|
||||||
|
@ -42,7 +40,6 @@ import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
import net.minecraftforge.fml.network.PacketDistributor;
|
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class AdjustableCrateBlock extends CrateBlock {
|
||||||
public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) {
|
public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) {
|
||||||
TileEntity te = worldIn.getTileEntity(pos);
|
TileEntity te = worldIn.getTileEntity(pos);
|
||||||
if (te instanceof AdjustableCrateTileEntity) {
|
if (te instanceof AdjustableCrateTileEntity) {
|
||||||
AdjustableCrateTileEntity flexcrateTileEntity = (AdjustableCrateTileEntity) te;
|
AdjustableCrateTileEntity flexcrateTileEntity = ((AdjustableCrateTileEntity) te).getMainCrate();
|
||||||
return ItemHelper.calcRedstoneFromInventory(flexcrateTileEntity.inventory);
|
return ItemHelper.calcRedstoneFromInventory(flexcrateTileEntity.inventory);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.foundation.block.ITE;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
||||||
|
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.Iterate;
|
import com.simibubi.create.foundation.utility.Iterate;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -129,6 +130,14 @@ public class ContentObserverBlock extends HorizontalBlock implements ITE<Content
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
||||||
|
boolean isMoving) {
|
||||||
|
InvManipulationBehaviour behaviour = TileEntityBehaviour.get(worldIn, pos, InvManipulationBehaviour.TYPE);
|
||||||
|
if (behaviour != null)
|
||||||
|
behaviour.onNeighborChanged(fromPos);
|
||||||
|
}
|
||||||
|
|
||||||
public void onFunnelTransfer(World world, BlockPos funnelPos, ItemStack transferred) {
|
public void onFunnelTransfer(World world, BlockPos funnelPos, ItemStack transferred) {
|
||||||
for (Direction direction : Iterate.horizontalDirections) {
|
for (Direction direction : Iterate.horizontalDirections) {
|
||||||
BlockPos detectorPos = funnelPos.offset(direction);
|
BlockPos detectorPos = funnelPos.offset(direction);
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class StockpileSwitchTileEntity extends SmartTileEntity {
|
||||||
|
|
||||||
public void updateCurrentLevel() {
|
public void updateCurrentLevel() {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
observedInventory.findNewCapability();
|
||||||
if (!observedInventory.hasInventory()) {
|
if (!observedInventory.hasInventory()) {
|
||||||
if (currentLevel == -1)
|
if (currentLevel == -1)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -71,4 +71,10 @@ public class SchematicannonBlock extends Block implements ITE<SchematicannonTile
|
||||||
return SchematicannonTileEntity.class;
|
return SchematicannonTileEntity.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
||||||
|
boolean isMoving) {
|
||||||
|
withTileEntityDo(worldIn, pos, te -> te.neighbourCheckCooldown = 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.simibubi.create.content.schematics.block;
|
package com.simibubi.create.content.schematics.block;
|
||||||
|
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -9,7 +10,6 @@ import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllSoundEvents;
|
import com.simibubi.create.AllSoundEvents;
|
||||||
import com.simibubi.create.AllTags.AllBlockTags;
|
import com.simibubi.create.AllTags.AllBlockTags;
|
||||||
import com.simibubi.create.CreateClient;
|
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltPart;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltPart;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
|
||||||
|
@ -65,10 +65,10 @@ import net.minecraft.world.gen.feature.template.Template;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
import net.minecraftforge.items.CapabilityItemHandler;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||||
|
|
||||||
public class SchematicannonTileEntity extends SmartTileEntity implements INamedContainerProvider, IInstanceRendered {
|
public class SchematicannonTileEntity extends SmartTileEntity implements INamedContainerProvider, IInstanceRendered {
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
|
|
||||||
public BlockPos target;
|
public BlockPos target;
|
||||||
public BlockPos previousTarget;
|
public BlockPos previousTarget;
|
||||||
public List<IItemHandler> attachedInventories;
|
public LinkedHashSet<LazyOptional<IItemHandler>> attachedInventories;
|
||||||
public List<LaunchedItem> flyingBlocks;
|
public List<LaunchedItem> flyingBlocks;
|
||||||
public MaterialChecklist checklist;
|
public MaterialChecklist checklist;
|
||||||
|
|
||||||
|
@ -137,14 +137,13 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
public SchematicannonTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
public SchematicannonTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
||||||
super(tileEntityTypeIn);
|
super(tileEntityTypeIn);
|
||||||
setLazyTickRate(30);
|
setLazyTickRate(30);
|
||||||
attachedInventories = new LinkedList<>();
|
attachedInventories = new LinkedHashSet<>();
|
||||||
flyingBlocks = new LinkedList<>();
|
flyingBlocks = new LinkedList<>();
|
||||||
inventory = new SchematicannonInventory(this);
|
inventory = new SchematicannonInventory(this);
|
||||||
statusMsg = "idle";
|
statusMsg = "idle";
|
||||||
state = State.STOPPED;
|
state = State.STOPPED;
|
||||||
printingEntityIndex = -1;
|
printingEntityIndex = -1;
|
||||||
replaceMode = 2;
|
replaceMode = 2;
|
||||||
neighbourCheckCooldown = NEIGHBOUR_CHECKING;
|
|
||||||
checklist = new MaterialChecklist();
|
checklist = new MaterialChecklist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +163,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
LazyOptional<IItemHandler> capability =
|
LazyOptional<IItemHandler> capability =
|
||||||
tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite());
|
tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite());
|
||||||
if (capability.isPresent()) {
|
if (capability.isPresent()) {
|
||||||
attachedInventories.add(capability.orElse(null));
|
attachedInventories.add(capability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +287,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
if (neighbourCheckCooldown-- <= 0) {
|
if (state != State.STOPPED && neighbourCheckCooldown-- <= 0) {
|
||||||
neighbourCheckCooldown = NEIGHBOUR_CHECKING;
|
neighbourCheckCooldown = NEIGHBOUR_CHECKING;
|
||||||
findInventories();
|
findInventories();
|
||||||
}
|
}
|
||||||
|
@ -577,9 +576,12 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
if (hasCreativeCrate)
|
if (hasCreativeCrate)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
attachedInventories.removeIf(cap -> !cap.isPresent());
|
||||||
|
|
||||||
// Find and apply damage
|
// Find and apply damage
|
||||||
if (usage == ItemUseType.DAMAGE) {
|
if (usage == ItemUseType.DAMAGE) {
|
||||||
for (IItemHandler iItemHandler : attachedInventories) {
|
for (LazyOptional<IItemHandler> cap : attachedInventories) {
|
||||||
|
IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||||
for (int slot = 0; slot < iItemHandler.getSlots(); slot++) {
|
for (int slot = 0; slot < iItemHandler.getSlots(); slot++) {
|
||||||
ItemStack extractItem = iItemHandler.extractItem(slot, 1, true);
|
ItemStack extractItem = iItemHandler.extractItem(slot, 1, true);
|
||||||
if (!ItemRequirement.validate(required, extractItem))
|
if (!ItemRequirement.validate(required, extractItem))
|
||||||
|
@ -608,8 +610,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
if (usage == ItemUseType.CONSUME) {
|
if (usage == ItemUseType.CONSUME) {
|
||||||
int amountFound = 0;
|
int amountFound = 0;
|
||||||
for (IItemHandler iItemHandler : attachedInventories) {
|
for (LazyOptional<IItemHandler> cap : attachedInventories) {
|
||||||
|
IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||||
amountFound += ItemHelper
|
amountFound += ItemHelper
|
||||||
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
||||||
required.getCount(), true)
|
required.getCount(), true)
|
||||||
|
@ -625,7 +627,8 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
|
|
||||||
if (!simulate && success) {
|
if (!simulate && success) {
|
||||||
int amountFound = 0;
|
int amountFound = 0;
|
||||||
for (IItemHandler iItemHandler : attachedInventories) {
|
for (LazyOptional<IItemHandler> cap : attachedInventories) {
|
||||||
|
IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||||
amountFound += ItemHelper
|
amountFound += ItemHelper
|
||||||
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
.extract(iItemHandler, s -> ItemRequirement.validate(required, s), ExtractionCountMode.UPTO,
|
||||||
required.getCount(), false)
|
required.getCount(), false)
|
||||||
|
@ -916,7 +919,11 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checklist.gathered.clear();
|
checklist.gathered.clear();
|
||||||
for (IItemHandler inventory : attachedInventories) {
|
findInventories();
|
||||||
|
for (LazyOptional<IItemHandler> cap : attachedInventories) {
|
||||||
|
if (!cap.isPresent())
|
||||||
|
continue;
|
||||||
|
IItemHandler inventory = cap.orElse(EmptyHandler.INSTANCE);
|
||||||
for (int slot = 0; slot < inventory.getSlots(); slot++) {
|
for (int slot = 0; slot < inventory.getSlots(); slot++) {
|
||||||
ItemStack stackInSlot = inventory.getStackInSlot(slot);
|
ItemStack stackInSlot = inventory.getStackInSlot(slot);
|
||||||
if (inventory.extractItem(slot, 1, true)
|
if (inventory.extractItem(slot, 1, true)
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
@ -47,7 +46,7 @@ public abstract class TileEntityBehaviour {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNeighborChanged(Direction direction) {
|
public void onNeighborChanged(BlockPos neighborPos) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,13 @@ public class InvManipulationBehaviour extends TileEntityBehaviour {
|
||||||
findNewNextTick = true;
|
findNewNextTick = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNeighborChanged(BlockPos neighborPos) {
|
||||||
|
BlockFace targetBlockFace = target.getTarget(getWorld(), tileEntity.getPos(), tileEntity.getBlockState());
|
||||||
|
if (targetBlockFace.getConnectedPos().equals(neighborPos))
|
||||||
|
onHandlerInvalidated(targetCapability);
|
||||||
|
}
|
||||||
|
|
||||||
protected void onHandlerInvalidated(LazyOptional<IItemHandler> handler) {
|
protected void onHandlerInvalidated(LazyOptional<IItemHandler> handler) {
|
||||||
findNewNextTick = true;
|
findNewNextTick = true;
|
||||||
targetCapability = LazyOptional.empty();
|
targetCapability = LazyOptional.empty();
|
||||||
|
@ -167,7 +174,7 @@ public class InvManipulationBehaviour extends TileEntityBehaviour {
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void findNewCapability() {
|
public void findNewCapability() {
|
||||||
BlockFace targetBlockFace = target.getTarget(getWorld(), tileEntity.getPos(), tileEntity.getBlockState())
|
BlockFace targetBlockFace = target.getTarget(getWorld(), tileEntity.getPos(), tileEntity.getBlockState())
|
||||||
.getOpposite();
|
.getOpposite();
|
||||||
BlockPos pos = targetBlockFace.getPos();
|
BlockPos pos = targetBlockFace.getPos();
|
||||||
|
|
Loading…
Reference in a new issue