use of com.almuradev.almura.shared.network.handler.DualItemHandlerGui in project Almura by AlmuraDev.
the class CapabilityDualItemHandlerGuiHandler method getClientGuiElement.
@SideOnly(Side.CLIENT)
@Nullable
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
final BlockPos pos = new BlockPos(x, y, z);
final Block block = world.getBlockState(pos).getBlock();
final TileEntity te = world.getTileEntity(pos);
if (te == null || !(te instanceof MultiSlotTileEntity)) {
return null;
}
final IItemHandler teItemHandler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
if (teItemHandler == null) {
return null;
}
final IItemHandler playerItemHandler = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
if (playerItemHandler == null) {
return null;
}
return new DualItemHandlerGui(teItemHandler, playerItemHandler, new TextComponentString(block.getLocalizedName()), new TextComponentTranslation("container.inventory"));
}
Aggregations