use of net.silentchaos512.gems.tile.TileChaosAltar in project SilentGems by SilentChaos512.
the class GuiHandlerSilentGems method getClientGuiElement.
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if (ID != ID_QUIVER && tile == null) {
SilentGems.logHelper.warning(String.format("Missing TileEntity at %d %d %d!", x, y, z));
return null;
}
switch(ID) {
case ID_ALTAR:
if (tile instanceof TileChaosAltar) {
TileChaosAltar tileAltar = (TileChaosAltar) tile;
return new GuiChaosAltar(player.inventory, tileAltar);
}
return null;
case ID_BURNER_PYLON:
if (tile instanceof TileChaosPylon) {
return new GuiBurnerPylon(player.inventory, (TileChaosPylon) tile);
}
return null;
case ID_MATERIAL_GRADER:
if (tile instanceof TileMaterialGrader) {
return new GuiMaterialGrader(player.inventory, (TileMaterialGrader) tile);
}
return null;
case ID_QUIVER:
EnumHand hand = x == 1 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND;
ItemStack stack = player.getHeldItem(hand);
return new GuiQuiver(new ContainerQuiver(stack, player.inventory, hand));
default:
SilentGems.logHelper.warning("No GUI with ID " + ID + "!");
return null;
}
}
use of net.silentchaos512.gems.tile.TileChaosAltar in project SilentGems by SilentChaos512.
the class GuiHandlerSilentGems method getServerGuiElement.
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
if (ID != ID_QUIVER && tile == null) {
SilentGems.logHelper.warning(String.format("Missing TileEntity at %d %d %d!", x, y, z));
return null;
}
switch(ID) {
case ID_ALTAR:
if (tile instanceof TileChaosAltar) {
TileChaosAltar tileAltar = (TileChaosAltar) tile;
return new ContainerChaosAltar(player.inventory, tileAltar);
}
return null;
case ID_BURNER_PYLON:
if (tile instanceof TileChaosPylon) {
return new ContainerBurnerPylon(player.inventory, (TileChaosPylon) tile);
}
return null;
case ID_MATERIAL_GRADER:
if (tile instanceof TileMaterialGrader) {
return new ContainerMaterialGrader(player.inventory, (TileMaterialGrader) tile);
}
return null;
case ID_QUIVER:
EnumHand hand = x == 1 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND;
ItemStack stack = player.getHeldItem(hand);
return new ContainerQuiver(stack, player.inventory, hand);
default:
SilentGems.logHelper.warning("No GUI with ID " + ID + "!");
return null;
}
}
use of net.silentchaos512.gems.tile.TileChaosAltar in project SilentGems by SilentChaos512.
the class BlockChaosAltar method getComparatorInputOverride.
@Override
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if (tile != null && tile instanceof TileChaosAltar) {
TileChaosAltar altar = (TileChaosAltar) tile;
float storedRatio = (float) altar.getCharge() / altar.getMaxCharge();
return (int) (15 * storedRatio);
}
return 0;
}
use of net.silentchaos512.gems.tile.TileChaosAltar in project SilentGems by SilentChaos512.
the class BlockChaosAltar method breakBlock.
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
TileEntity tileAltar = world.getTileEntity(pos);
if (tileAltar != null && tileAltar instanceof TileChaosAltar) {
InventoryHelper.dropInventoryItems(world, pos, (TileChaosAltar) tileAltar);
world.updateComparatorOutputLevel(pos, this);
}
super.breakBlock(world, pos, state);
}
Aggregations