use of WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator in project BloodMagic by WayofTime.
the class RenderAlchemicCalcinator method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) {
if (tileEntity instanceof TEAlchemicCalcinator) {
TEAlchemicCalcinator tileAltar = (TEAlchemicCalcinator) tileEntity;
GL11.glPushMatrix();
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/AlchemicalCalcinator.png");
FMLClientHandler.instance().getClient().renderEngine.bindTexture(test);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
this.modelConduit.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glPushMatrix();
if (tileAltar.getStackInSlot(1) != null) {
boolean fancySaved = Minecraft.isFancyGraphicsEnabled();
Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(1));
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(1));
float displacement = 0.2F;
if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) {
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F);
} else {
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f * 2f);
}
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) {
GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F);
}
customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
Minecraft.getMinecraft().gameSettings.fancyGraphics = fancySaved;
}
GL11.glPopMatrix();
GL11.glPushMatrix();
if (tileAltar.getStackInSlot(0) != null) {
boolean fancySaved = Minecraft.isFancyGraphicsEnabled();
Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0));
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0));
float displacement = -0.5F;
if (ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock) {
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 0.7F, (float) d2 + 0.5F);
} else {
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + displacement + 10.4f / 16.0f, (float) d2 + 0.5F - 0.0625f * 2f);
}
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
if (!(ghostEntityItem.getEntityItem().getItem() instanceof ItemBlock)) {
GL11.glRotatef(90f, 1.0f, 0.0f, 0.0F);
}
customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
Minecraft.getMinecraft().gameSettings.fancyGraphics = fancySaved;
}
GL11.glPopMatrix();
ReagentContainerInfo[] info = tileAltar.getContainerInfo(ForgeDirection.UNKNOWN);
if (info.length >= 1 && info[0] != null) {
ReagentStack reagentStack = info[0].reagent;
int capacity = info[0].capacity;
if (reagentStack != null && reagentStack.reagent != null) {
Reagent reagent = reagentStack.reagent;
this.renderTankContents(d0, d1, d2, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity);
}
}
}
}
use of WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator in project BloodMagic by WayofTime.
the class BlockAlchemicCalcinator method onBlockActivated.
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) {
TEAlchemicCalcinator tileEntity = (TEAlchemicCalcinator) world.getTileEntity(x, y, z);
if (tileEntity == null || player.isSneaking()) {
return false;
}
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null) {
if (playerItem.getItem() instanceof IReagentManipulator) {
return false;
}
if (playerItem.getItem() instanceof IBloodOrb) {
if (tileEntity.getStackInSlot(0) == null) {
ItemStack newItem = playerItem.copy();
newItem.stackSize = 1;
--playerItem.stackSize;
tileEntity.setInventorySlotContents(0, newItem);
}
} else if (tileEntity.getStackInSlot(1) == null) {
ItemStack newItem = playerItem.copy();
newItem.stackSize = 1;
--playerItem.stackSize;
tileEntity.setInventorySlotContents(1, newItem);
}
} else {
if (tileEntity.getStackInSlot(1) != null) {
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(1));
tileEntity.setInventorySlotContents(1, null);
} else if (tileEntity.getStackInSlot(0) != null) {
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
tileEntity.setInventorySlotContents(0, null);
}
}
tileEntity.getWorldObj().markBlockForUpdate(x, y, z);
return true;
}
Aggregations