use of net.silentchaos512.gems.tile.TileChaosPylon 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.TileChaosPylon 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.TileChaosPylon in project SilentGems by SilentChaos512.
the class BlockChaosPylon method createNewTileEntity.
@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
TileChaosPylon toReturn = new TileChaosPylon();
toReturn.setPylonType(EnumPylonType.getByMeta(meta));
return toReturn;
}
use of net.silentchaos512.gems.tile.TileChaosPylon in project SilentGems by SilentChaos512.
the class RenderTileChaosPylon method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileChaosPylon te, double x, double y, double z, float partialTicks, int destroyStage) {
if (te != null && te.getWorld() != null && !te.getWorld().isBlockLoaded(te.getPos(), false)) {
return;
}
if (model == null) {
model = new ModelPylon();
}
if (plates == null) {
plates = new ModelPylonPlates();
}
double worldTime = (te.getWorld() == null) ? 0 : (double) (ClientTickHandler.ticksInGame + partialTicks) + new Random(te.getPos().hashCode()).nextInt(360);
int pylonType = te.getPylonType().getMeta();
double bobFactor = 1.0;
// render the pylon
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.translate(x + 0.5, y + 0.5 + 0.1 * Math.sin(worldTime / 20) * bobFactor, z + 0.5);
GlStateManager.rotate((float) worldTime, 0.0f, 1.0f, 0.0f);
model.renderPylon(pylonType);
GlStateManager.popMatrix();
// render the plates
GlStateManager.pushMatrix();
GlStateManager.translate(x + 0.5, y + 0.5 + 0.1 * Math.sin(worldTime / 20) * bobFactor, z + 0.5);
GlStateManager.rotate(-(float) worldTime, 0.0f, 1.0f, 0.0f);
// model = new ModelPylon();
plates.renderPylonPlates(pylonType);
GlStateManager.popMatrix();
}
use of net.silentchaos512.gems.tile.TileChaosPylon in project SilentGems by SilentChaos512.
the class RenderTileChaosPylon method clRender.
@Override
public void clRender(TileChaosPylon te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
if (te != null && te.getWorld() != null && !te.getWorld().isBlockLoaded(te.getPos(), false)) {
return;
}
if (model == null) {
model = new ModelPylon();
}
if (plates == null) {
plates = new ModelPylonPlates();
}
double worldTime = (te.getWorld() == null) ? 0 : (double) (ClientTickHandler.ticksInGame + partialTicks) + new Random(te.getPos().hashCode()).nextInt(360);
int pylonType = te.getPylonType().getMeta();
double bobFactor = 1.0;
// render the pylon
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.translate(x + 0.5, y + 0.5 + 0.1 * Math.sin(worldTime / 20) * bobFactor, z + 0.5);
GlStateManager.rotate((float) worldTime, 0.0f, 1.0f, 0.0f);
model.renderPylon(pylonType);
GlStateManager.popMatrix();
// render the plates
GlStateManager.pushMatrix();
GlStateManager.translate(x + 0.5, y + 0.5 + 0.1 * Math.sin(worldTime / 20) * bobFactor, z + 0.5);
GlStateManager.rotate(-(float) worldTime, 0.0f, 1.0f, 0.0f);
// model = new ModelPylon();
plates.renderPylonPlates(pylonType);
GlStateManager.popMatrix();
}
Aggregations