use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class CraftingSetType method processPacket.
@Override
public void processPacket(EntityPlayer player) {
TileEntity table = this.getTile(player.getEntityWorld(), TileEntity.class);
if (table instanceof LogisticsCraftingTableTileEntity) {
((LogisticsCraftingTableTileEntity) table).targetType = targetType;
((LogisticsCraftingTableTileEntity) table).cacheRecipe();
} else if (table instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) table).pipe instanceof PipeBlockRequestTable) {
((PipeBlockRequestTable) ((LogisticsTileGenericPipe) table).pipe).targetType = targetType;
((PipeBlockRequestTable) ((LogisticsTileGenericPipe) table).pipe).cacheRecipe();
}
}
use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class LogicControllerPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
ILogicControllerTile tile = this.getTile(player.getEntityWorld(), ILogicControllerTile.class);
if (tile == null) {
return;
}
NewGuiHandler.getGui(LogicControllerGuiProvider.class).setTilePos((TileEntity) tile).open(player);
}
use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class LogicControllerGuiProvider method getContainer.
@Override
public Container getContainer(EntityPlayer player) {
TileEntity pipe = this.getTile(player.getEntityWorld(), TileEntity.class);
if (pipe instanceof ILogicControllerTile) {
LogicController controller = ((ILogicControllerTile) pipe).getLogicController();
DummyContainer dummy = new DummyContainer(player.inventory, null);
dummy.addNormalSlotsForPlayerInventory(50, 190);
return dummy;
}
return null;
}
use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class LogisticsBlockGenericPipe method addCollisionBoxesToList.
@Override
@SuppressWarnings({ "rawtypes" })
public void addCollisionBoxesToList(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List arraylist, Entity par7Entity) {
TileEntity tile = world.getTileEntity(i, j, k);
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe instanceof PipeBlockRequestTable) {
setBlockBounds(0, 0, 0, 1, 1, 1);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
return;
}
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe != null && ((LogisticsTileGenericPipe) tile).pipe.isMultiBlock()) {
((CoreMultiBlockPipe) ((LogisticsTileGenericPipe) tile).pipe).addCollisionBoxesToList(arraylist, axisalignedbb);
if (!((LogisticsTileGenericPipe) tile).pipe.actAsNormalPipe()) {
return;
}
}
setBlockBounds(LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
if (tile instanceof LogisticsTileGenericPipe) {
LogisticsTileGenericPipe tileG = (LogisticsTileGenericPipe) tile;
if (tileG.isPipeConnected(ForgeDirection.WEST)) {
setBlockBounds(0.0F, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.isPipeConnected(ForgeDirection.EAST)) {
setBlockBounds(LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, 1.0F, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.isPipeConnected(ForgeDirection.DOWN)) {
setBlockBounds(LPConstants.PIPE_MIN_POS, 0.0F, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.isPipeConnected(ForgeDirection.UP)) {
setBlockBounds(LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MAX_POS, 1.0F, LPConstants.PIPE_MAX_POS);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.isPipeConnected(ForgeDirection.NORTH)) {
setBlockBounds(LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, 0.0F, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.isPipeConnected(ForgeDirection.SOUTH)) {
setBlockBounds(LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS, 1.0F);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
float facadeThickness = LPConstants.FACADE_THICKNESS;
if (tileG.tilePart.hasEnabledFacade(ForgeDirection.EAST)) {
setBlockBounds(1 - facadeThickness, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.tilePart.hasEnabledFacade(ForgeDirection.WEST)) {
setBlockBounds(0.0F, 0.0F, 0.0F, facadeThickness, 1.0F, 1.0F);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.tilePart.hasEnabledFacade(ForgeDirection.UP)) {
setBlockBounds(0.0F, 1 - facadeThickness, 0.0F, 1.0F, 1.0F, 1.0F);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.tilePart.hasEnabledFacade(ForgeDirection.DOWN)) {
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, facadeThickness, 1.0F);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.tilePart.hasEnabledFacade(ForgeDirection.SOUTH)) {
setBlockBounds(0.0F, 0.0F, 1 - facadeThickness, 1.0F, 1.0F, 1.0F);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
if (tileG.tilePart.hasEnabledFacade(ForgeDirection.NORTH)) {
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, facadeThickness);
super.addCollisionBoxesToList(world, i, j, k, axisalignedbb, arraylist, par7Entity);
}
}
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class LogisticsBlockGenericPipe method placePipe.
public static boolean placePipe(CoreUnroutedPipe pipe, World world, int i, int j, int k, Block block, int meta, ITubeOrientation orientation) {
if (world.isRemote) {
return true;
}
boolean placed = world.setBlock(i, j, k, block, meta, 2);
if (placed) {
TileEntity tile = world.getTileEntity(i, j, k);
if (tile instanceof LogisticsTileGenericPipe) {
LogisticsTileGenericPipe tilePipe = (LogisticsTileGenericPipe) tile;
if (pipe instanceof CoreMultiBlockPipe) {
if (orientation == null) {
throw new NullPointerException();
}
CoreMultiBlockPipe mPipe = (CoreMultiBlockPipe) pipe;
orientation.setOnPipe(mPipe);
DoubleCoordinates placeAt = new DoubleCoordinates(i, j, k);
LogisticsBlockGenericSubMultiBlock.currentCreatedMultiBlock = placeAt;
LPPositionSet<DoubleCoordinatesType<CoreMultiBlockPipe.SubBlockTypeForShare>> positions = ((CoreMultiBlockPipe) pipe).getSubBlocks();
orientation.rotatePositions(positions);
for (DoubleCoordinatesType<CoreMultiBlockPipe.SubBlockTypeForShare> pos : positions) {
pos.add(placeAt);
TileEntity subTile = world.getTileEntity(pos.getXInt(), pos.getYInt(), pos.getZInt());
if (subTile instanceof LogisticsTileGenericSubMultiBlock) {
((LogisticsTileGenericSubMultiBlock) subTile).addMultiBlockMainPos(placeAt);
((LogisticsTileGenericSubMultiBlock) subTile).addSubTypeTo(pos.getType());
MainProxy.sendPacketToAllWatchingChunk(subTile, ((LogisticsTileGenericSubMultiBlock) subTile).getLPDescriptionPacket());
} else {
world.setBlock(pos.getXInt(), pos.getYInt(), pos.getZInt(), LogisticsPipes.LogisticsSubMultiBlock, 0, 2);
subTile = world.getTileEntity(pos.getXInt(), pos.getYInt(), pos.getZInt());
if (subTile instanceof LogisticsTileGenericSubMultiBlock) {
((LogisticsTileGenericSubMultiBlock) subTile).addSubTypeTo(pos.getType());
}
}
world.notifyBlockChange(pos.getXInt(), pos.getYInt(), pos.getZInt(), LogisticsPipes.LogisticsSubMultiBlock);
}
LogisticsBlockGenericSubMultiBlock.currentCreatedMultiBlock = null;
}
tilePipe.initialize(pipe);
tilePipe.sendUpdateToClient();
}
world.notifyBlockChange(i, j, k, block);
}
return placed;
}
Aggregations