use of WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent in project BloodMagic by WayofTime.
the class TEBellJarItemRenderer method renderConduitItem.
private void renderConduitItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) {
GL11.glPushMatrix();
GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(mainResource);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
this.modelConduit.renderSpecialItem((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, 0);
GL11.glPopMatrix();
GL11.glPopMatrix();
ReagentContainerInfo[] info = TEBellJar.getContainerInfoFromItem(item);
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(translateX, translateY, translateZ, reagent.getColourRed(), reagent.getColourGreen(), reagent.getColourBlue(), 200 * reagentStack.amount / capacity);
}
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glPushMatrix();
GL11.glTranslatef((float) translateX + 0.5F, (float) translateY + 1.5F, (float) translateZ + 0.5F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(mainResource);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
this.modelConduit.renderSpecialItem((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, 1);
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
}
use of WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent in project BloodMagic by WayofTime.
the class RenderHelper method renderTestHUD.
private static void renderTestHUD(Minecraft mc, ReagentStack reagentStack, int maxAmount) {
GL11.glPushMatrix();
Reagent reagent = reagentStack.reagent;
int xSize = 32;
int ySize = 32;
int amount = Math.max((int) (256 * ((double) (maxAmount - reagentStack.amount) / maxAmount)), 0);
int x = (lpBarX + 16 - xSize / 2) * 8;
int y = (lpBarY - ySize / 2) * 8;
GL11.glScalef(1f / 8f, 1f / 8f, 1f / 8f);
ResourceLocation test2 = new ResourceLocation("alchemicalwizardry", "textures/gui/container1.png");
GL11.glColor4f(reagent.getColourRed() / 255f, reagent.getColourGreen() / 255f, reagent.getColourBlue() / 255f, 1.0F);
mc.getTextureManager().bindTexture(test2);
drawTexturedModalRect(x, y + amount, 0, amount, 256, 256 - amount);
ResourceLocation test = new ResourceLocation("alchemicalwizardry", "textures/gui/container.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(test);
drawTexturedModalRect(x, y, 0, 0, 256, 256);
GL11.glPopMatrix();
}
use of WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent in project BloodMagic by WayofTime.
the class AlchemicalWizardryEventHooks method onLivingHurtEvent.
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onLivingHurtEvent(LivingHurtEvent event) {
if (!event.isCanceled() && event.entityLiving instanceof EntityPlayer && !event.entityLiving.worldObj.isRemote) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (APISpellHelper.getCurrentAdditionalMaxHP(player) > 0) {
APISpellHelper.setPlayerReagentRegenCooldownTag(player, 20 * 20);
}
float prevHp = APISpellHelper.getCurrentAdditionalHP((EntityPlayer) event.entityLiving);
if (prevHp > 0) {
float recalculatedAmount = ArmorProperties.ApplyArmor(player, player.inventory.armorInventory, event.source, event.ammount);
if (recalculatedAmount <= 0)
return;
// Recalculated damage
recalculatedAmount = SpellHelper.applyPotionDamageCalculations(player, event.source, recalculatedAmount);
float ratio = recalculatedAmount / event.ammount;
float f1 = recalculatedAmount;
recalculatedAmount = Math.max(recalculatedAmount - player.getAbsorptionAmount(), 0.0F);
player.setAbsorptionAmount(player.getAbsorptionAmount() - (f1 - recalculatedAmount));
if (prevHp > recalculatedAmount) {
// New HP - this is obviously > 0...
float hp = (prevHp - recalculatedAmount);
// event.setCanceled(true);
event.ammount = 0;
Reagent reagent = APISpellHelper.getPlayerReagentType(player);
OmegaParadigm paradigm = OmegaRegistry.getParadigmForReagent(reagent);
if (paradigm != null) {
ItemStack chestStack = player.inventory.armorInventory[2];
if (chestStack != null && chestStack.getItem() instanceof OmegaArmour) {
if (((OmegaArmour) chestStack.getItem()).paradigm == paradigm) {
paradigm.onHPBarDepleted(player, chestStack);
}
}
}
APISpellHelper.setCurrentAdditionalHP(player, hp);
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(hp, APISpellHelper.getCurrentAdditionalMaxHP(player)), (EntityPlayerMP) player);
// if(event.ammount <= 0.3)
// {
// event.ammount++;
// }
} else {
APISpellHelper.setCurrentAdditionalHP(player, 0);
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(0, APISpellHelper.getCurrentAdditionalMaxHP(player)), (EntityPlayerMP) player);
event.ammount -= prevHp / ratio;
if (event.ammount < 0) {
event.ammount = 0;
}
}
}
}
}
Aggregations