use of WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo 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.api.alchemy.energy.ReagentContainerInfo in project BloodMagic by WayofTime.
the class RenderCrystalBelljar method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) {
if (tileEntity instanceof TEBellJar) {
TEBellJar tileAltar = (TEBellJar) tileEntity;
GL11.glPushMatrix();
GL11.glTranslatef((float) d0 + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
ResourceLocation test = new ResourceLocation("alchemicalwizardry:textures/models/CrystalBelljar.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();
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.api.alchemy.energy.ReagentContainerInfo in project BloodMagic by WayofTime.
the class TEBellJar method getContainerInfoFromItem.
public static ReagentContainerInfo[] getContainerInfoFromItem(ItemStack stack) {
if (stack != null && stack.getItem() instanceof ItemBlock && ModBlocks.blockCrystalBelljar == ((ItemBlock) stack.getItem()).field_150939_a) {
NBTTagCompound tag = stack.getTagCompound();
if (tag != null) {
NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND);
int size = tagList.tagCount();
ReagentContainer[] tanks = new ReagentContainer[size];
ReagentContainerInfo[] infos = new ReagentContainerInfo[size];
for (int i = 0; i < size; i++) {
NBTTagCompound savedTag = tagList.getCompoundTagAt(i);
tanks[i] = ReagentContainer.readFromNBT(savedTag);
if (tanks[i] != null) {
infos[i] = tanks[i].getInfo();
}
}
return infos;
}
}
return new ReagentContainerInfo[0];
}
use of WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo in project BloodMagic by WayofTime.
the class RitualEffectOmegaTest method performEffect.
@Override
public void performEffect(IMasterRitualStone ritualStone) {
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getWorldTime() % 200 != 0) {
return;
}
OmegaStructureParameters param = OmegaStructureHandler.getStructureStabilityFactor(world, x, y, z, 5, new Int3(0, 1, 0));
int stab = param.stability;
int enchantability = param.enchantability;
int enchantmentLevel = param.enchantmentLevel;
if (stab <= 0) {
return;
}
// System.out.println("Stability: " + stab + ", Enchantability: " + enchantability + ", Enchantment Level: " + enchantmentLevel);
double range = 0.5;
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 1.5, z + 0.5, range, range);
Reagent reagent = null;
Map<Reagent, Integer> reagentMap = new HashMap();
for (int i = 0; i < 4; i++) {
Int3 jarLoc = this.getJarLocation(i);
TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord);
if (tile instanceof IReagentHandler) {
IReagentHandler container = (IReagentHandler) tile;
ReagentContainerInfo[] containerInfoArray = container.getContainerInfo(ForgeDirection.UP);
if (containerInfoArray == null) {
continue;
}
for (ReagentContainerInfo containerInfo : containerInfoArray) {
ReagentStack containedReagent = containerInfo.reagent;
if (containedReagent == null) {
continue;
}
Reagent rea = containedReagent.reagent;
int amt = containedReagent.amount;
if (reagentMap.containsKey(rea)) {
reagentMap.put(rea, reagentMap.get(rea) + amt);
} else {
reagentMap.put(rea, amt);
}
}
}
}
for (Entry<Reagent, Integer> entry : reagentMap.entrySet()) {
if (entry.getValue() >= drainTotal) {
reagent = entry.getKey();
break;
}
}
if (reagent == null) {
return;
}
int tickDuration = isTesting ? 20 * 30 : 15 * 20 * 60 + (int) ((15 * 20 * 60) * Math.sqrt(stab / 700));
int affinity = 0;
for (EntityPlayer player : playerList) {
OmegaParadigm waterParadigm = OmegaRegistry.getParadigmForReagent(reagent);
if (waterParadigm != null && waterParadigm.convertPlayerArmour(player, x, y, z, stab, affinity, enchantability, enchantmentLevel)) {
APISpellHelper.setPlayerCurrentReagentAmount(player, tickDuration);
APISpellHelper.setPlayerMaxReagentAmount(player, tickDuration);
APISpellHelper.setPlayerReagentType(player, reagent);
APISpellHelper.setCurrentAdditionalMaxHP(player, waterParadigm.getMaxAdditionalHealth());
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getReagentBarPacket(reagent, APISpellHelper.getPlayerCurrentReagentAmount(player), APISpellHelper.getPlayerMaxReagentAmount(player)), (EntityPlayerMP) player);
if (!isTesting) {
int drainLeft = this.drainTotal;
for (int i = 0; i < 4; i++) {
if (drainLeft <= 0) {
break;
}
Int3 jarLoc = this.getJarLocation(i);
TileEntity tile = world.getTileEntity(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord);
if (tile instanceof IReagentHandler) {
IReagentHandler container = (IReagentHandler) tile;
ReagentStack drained = container.drain(ForgeDirection.UP, new ReagentStack(reagent, drainLeft), true);
if (drained != null) {
drainLeft -= drained.amount;
world.markBlockForUpdate(x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord);
world.addWeatherEffect(new EntityLightningBolt(world, x + jarLoc.xCoord, y + jarLoc.yCoord, z + jarLoc.zCoord));
}
}
}
ritualStone.setActive(false);
}
break;
}
}
}
use of WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentContainerInfo 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);
}
Aggregations