use of WayofTime.alchemicalWizardry.common.tileEntity.TEAltar in project BloodMagic by WayofTime.
the class TEAltarRenderer method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) {
if (tileEntity instanceof TEAltar) {
modelBloodAltar.renderBloodAltar((TEAltar) tileEntity, d0, d1, d2);
if (((TEAltar) tileEntity).getCurrentBlood() > 0)
modelBloodAltar.renderBloodLevel((TEAltar) tileEntity, d0, d1, d2);
TEAltar tileAltar = (TEAltar) tileEntity;
GL11.glPushMatrix();
if (tileAltar.getStackInSlot(0) != null) {
float scaleFactor = getGhostItemScaleFactor(tileAltar.getStackInSlot(0));
float rotationAngle = Minecraft.getMinecraft().gameSettings.fancyGraphics ? (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL) : 0;
EntityItem ghostEntityItem = new EntityItem(tileAltar.getWorldObj());
ghostEntityItem.hoverStart = 0.0F;
ghostEntityItem.setEntityItemStack(tileAltar.getStackInSlot(0));
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 + 0.6F, (float) d2 + 0.5F);
}
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
customRenderItem.doRender(ghostEntityItem, 0, 0, 0, 0, 0);
}
GL11.glPopMatrix();
}
}
use of WayofTime.alchemicalWizardry.common.tileEntity.TEAltar in project BloodMagic by WayofTime.
the class BlockAltar method getComparatorInputOverride.
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int meta) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TEAltar) {
ItemStack stack = ((TEAltar) tile).getStackInSlot(0);
if (stack != null && stack.getItem() instanceof EnergyBattery) {
EnergyBattery bloodOrb = (EnergyBattery) stack.getItem();
int maxEssence = bloodOrb.getMaxEssence();
int currentEssence = bloodOrb.getCurrentEssence(stack);
int level = currentEssence * 15 / maxEssence;
return Math.min(15, level) % 16;
}
}
return 0;
}
use of WayofTime.alchemicalWizardry.common.tileEntity.TEAltar in project BloodMagic by WayofTime.
the class BlockAltar method onBlockActivated.
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) {
TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
if (tileEntity == null || player.isSneaking()) {
return false;
}
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem != null) {
if (playerItem.getItem().equals(ModItems.divinationSigil)) {
if (player.worldObj.isRemote) {
world.markBlockForUpdate(x, y, z);
} else {
tileEntity.sendChatInfoToPlayer(player);
}
return true;
} else if (playerItem.getItem().equals(ModItems.itemSeerSigil)) {
if (player.worldObj.isRemote) {
world.markBlockForUpdate(x, y, z);
} else {
tileEntity.sendMoreChatInfoToPlayer(player);
}
return true;
} else if (playerItem.getItem() instanceof IAltarManipulator) {
return false;
} else if (playerItem.getItem().equals(ModItems.sigilOfHolding)) {
ItemStack item = SigilOfHolding.getCurrentSigil(playerItem);
if (item != null && item.getItem().equals(ModItems.divinationSigil)) {
if (player.worldObj.isRemote) {
world.markBlockForUpdate(x, y, z);
} else {
tileEntity.sendChatInfoToPlayer(player);
}
return true;
} else if (item != null && item.getItem().equals(ModItems.itemSeerSigil)) {
if (player.worldObj.isRemote) {
world.markBlockForUpdate(x, y, z);
} else {
tileEntity.sendMoreChatInfoToPlayer(player);
}
return true;
}
}
}
if (tileEntity.getStackInSlot(0) == null && playerItem != null) {
ItemStack newItem = playerItem.copy();
newItem.stackSize = 1;
--playerItem.stackSize;
tileEntity.setInventorySlotContents(0, newItem);
tileEntity.startCycle();
} else if (tileEntity.getStackInSlot(0) != null && playerItem == null) {
player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
tileEntity.setInventorySlotContents(0, null);
tileEntity.setActive();
}
world.markBlockForUpdate(x, y, z);
return true;
}
use of WayofTime.alchemicalWizardry.common.tileEntity.TEAltar in project BloodMagic by WayofTime.
the class ItemBloodLetterPack method onItemRightClick.
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
if (world.isRemote) {
return itemStack;
}
MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, player, false);
if (movingobjectposition == null) {
return super.onItemRightClick(itemStack, world, player);
} else {
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
int x = movingobjectposition.blockX;
int y = movingobjectposition.blockY;
int z = movingobjectposition.blockZ;
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TEAltar)) {
return super.onItemRightClick(itemStack, world, player);
}
TEAltar altar = (TEAltar) tile;
if (!altar.isActive()) {
int amount = this.getStoredLP(itemStack);
if (amount > 0) {
int filledAmount = altar.fillMainTank(amount);
amount -= filledAmount;
this.setStoredLP(itemStack, amount);
world.markBlockForUpdate(x, y, z);
}
}
}
}
return itemStack;
}
Aggregations