mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-11 04:54:12 +01:00
More generic chest detection
- Possibly enabled the use of modded chest blocks for portable inventories - More safety checks
This commit is contained in:
parent
e891aeb8c1
commit
1da43f8ffc
@ -298,8 +298,11 @@ public class RotationPropagator {
|
||||
BlockState neighbourState = worldIn.getBlockState(neighbourPos);
|
||||
if (!(neighbourState.getBlock() instanceof IRotate))
|
||||
continue;
|
||||
|
||||
final KineticTileEntity neighbourTE = (KineticTileEntity) worldIn.getTileEntity(neighbourPos);
|
||||
TileEntity tileEntity = worldIn.getTileEntity(neighbourPos);
|
||||
if (!(tileEntity instanceof KineticTileEntity))
|
||||
continue;
|
||||
|
||||
final KineticTileEntity neighbourTE = (KineticTileEntity) tileEntity;
|
||||
if (!neighbourTE.hasSource() || !neighbourTE.source.equals(pos))
|
||||
continue;
|
||||
|
||||
|
@ -7,6 +7,8 @@ import net.minecraft.block.ChestBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.properties.ChestType;
|
||||
import net.minecraft.tileentity.BarrelTileEntity;
|
||||
import net.minecraft.tileentity.ChestTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
@ -105,9 +107,9 @@ public class MountedStorage {
|
||||
TileEntityType<?> type = te.getType();
|
||||
if (type == AllTileEntities.FLEXCRATE.type)
|
||||
return true;
|
||||
if (type == TileEntityType.BARREL)
|
||||
if (te instanceof ChestTileEntity)
|
||||
return true;
|
||||
if (type == TileEntityType.CHEST || type == TileEntityType.TRAPPED_CHEST)
|
||||
if (te instanceof BarrelTileEntity)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -97,7 +97,12 @@ public class SawBlock extends DirectionalAxisKineticBlock implements IWithTileEn
|
||||
super.onLanded(worldIn, entityIn);
|
||||
if (!(entityIn instanceof ItemEntity))
|
||||
return;
|
||||
withTileEntityDo(entityIn.world, entityIn.getPosition(), te -> {
|
||||
BlockPos pos = entityIn.getPosition();
|
||||
if (!(worldIn.getTileEntity(pos) instanceof SawTileEntity))
|
||||
return;
|
||||
if (entityIn.world.isRemote)
|
||||
return;
|
||||
withTileEntityDo(entityIn.world, pos, te -> {
|
||||
te.insertItem((ItemEntity) entityIn);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user