use of com.codetaylor.mc.artisanworktables.modules.worktables.tile.spi.TileEntityBase in project artisan-worktables by codetaylor.
the class SPacketWorktableTab method onMessage.
@Override
public IMessage onMessage(SPacketWorktableTab message, MessageContext ctx, TileEntity tileEntity) {
// Reference:
// https://github.com/SlimeKnights/TinkersConstruct/blob/master/src/main/java/slimeknights/tconstruct/tools/common/network/TinkerStationTabPacket.java
NetHandlerPlayServer serverHandler = ctx.getServerHandler();
EntityPlayerMP player = serverHandler.player;
ItemStack heldStack = player.inventory.getItemStack();
if (!heldStack.isEmpty()) {
player.inventory.setItemStack(ItemStack.EMPTY);
}
if (tileEntity instanceof TileEntityBase) {
player.openGui(ModuleWorktables.MOD_INSTANCE, 1, player.getEntityWorld(), message.blockPos.getX(), message.blockPos.getY(), message.blockPos.getZ());
}
if (!heldStack.isEmpty()) {
player.inventory.setItemStack(heldStack);
serverHandler.sendPacket(new SPacketSetSlot(-1, -1, heldStack));
}
return null;
}
use of com.codetaylor.mc.artisanworktables.modules.worktables.tile.spi.TileEntityBase in project artisan-worktables by codetaylor.
the class SPacketWorktableTankDestroyFluid method onMessage.
@Override
public IMessage onMessage(SPacketWorktableTankDestroyFluid message, MessageContext ctx, TileEntity tileEntity) {
if (tileEntity instanceof TileEntityBase) {
FluidTank tank = ((TileEntityBase) tileEntity).getTank();
tank.drain(tank.getCapacity(), true);
ModuleWorktables.PACKET_SERVICE.sendToAllAround(new CPacketWorktableFluidUpdate(tileEntity.getPos(), tank), tileEntity);
}
return null;
}
Aggregations