diff --git a/src/main/java/vazkii/botania/client/render/tile/RenderTileAltar.java b/src/main/java/vazkii/botania/client/render/tile/RenderTileAltar.java index ca41bf56c..9535a05e9 100644 --- a/src/main/java/vazkii/botania/client/render/tile/RenderTileAltar.java +++ b/src/main/java/vazkii/botania/client/render/tile/RenderTileAltar.java @@ -13,8 +13,10 @@ package vazkii.botania.client.render.tile; import java.awt.Color; +import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; +import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.TextureMap; @@ -56,89 +58,113 @@ public class RenderTileAltar extends TileEntitySpecialRenderer { GL11.glScalef(1F, -1F, -1F); GL11.glEnable(GL12.GL_RESCALE_NORMAL); - if(altar.hasWater) { + boolean water = altar.hasWater(); + boolean lava = altar.hasLava(); + if(water || lava) { GL11.glPushMatrix(); float s = 1F / 256F * 10F; float v = 1F / 8F; float w = -v * 2.5F; - int petals = 0; - for(int i = 0; i < altar.getSizeInventory(); i++) - if(altar.getStackInSlot(i) != null) - petals++; - else break; + if(water) { + int petals = 0; + for(int i = 0; i < altar.getSizeInventory(); i++) + if(altar.getStackInSlot(i) != null) + petals++; + else break; - if(petals > 0) { - final float modifier = 6F; - final float rotationModifier = 0.25F; - final float radiusBase = 1.2F; - final float radiusMod = 0.1F; + if(petals > 0) { + final float modifier = 6F; + final float rotationModifier = 0.25F; + final float radiusBase = 1.2F; + final float radiusMod = 0.1F; - double ticks = (ClientTickHandler.ticksInGame + pticks) * 0.5; - float offsetPerPetal = 360 / petals; - - GL11.glPushMatrix(); - GL11.glTranslatef(-0.05F, -0.5F, 0F); - GL11.glScalef(v, v, v); - for(int i = 0; i < petals; i++) { - float offset = offsetPerPetal * i; - float deg = (int) (ticks / rotationModifier % 360F + offset); - float rad = deg * (float) Math.PI / 180F; - float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier)); - float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier)); - float x = (float) (radiusX * Math.cos(rad)); - float z = (float) (radiusZ * Math.sin(rad)); - float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F; + double ticks = (ClientTickHandler.ticksInGame + pticks) * 0.5; + float offsetPerPetal = 360 / petals; GL11.glPushMatrix(); - GL11.glTranslatef(x, y, z); - float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F; - float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F); - float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F; + GL11.glTranslatef(-0.05F, -0.5F, 0F); + GL11.glScalef(v, v, v); + for(int i = 0; i < petals; i++) { + float offset = offsetPerPetal * i; + float deg = (int) (ticks / rotationModifier % 360F + offset); + float rad = deg * (float) Math.PI / 180F; + float radiusX = (float) (radiusBase + radiusMod * Math.sin(ticks / modifier)); + float radiusZ = (float) (radiusBase + radiusMod * Math.cos(ticks / modifier)); + float x = (float) (radiusX * Math.cos(rad)); + float z = (float) (radiusZ * Math.sin(rad)); + float y = (float) Math.cos((ticks + 50 * i) / 5F) / 10F; - v /= 2F; - GL11.glTranslatef(v, v, v); - GL11.glRotatef(deg, xRotate, yRotate, zRotate); - GL11.glTranslatef(-v, -v, -v); - v *= 2F; + GL11.glPushMatrix(); + GL11.glTranslatef(x, y, z); + float xRotate = (float) Math.sin(ticks * rotationModifier) / 2F; + float yRotate = (float) Math.max(0.6F, Math.sin(ticks * 0.1F) / 2F + 0.5F); + float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F; - GL11.glColor4f(1F, 1F, 1F, 1F); + v /= 2F; + GL11.glTranslatef(v, v, v); + GL11.glRotatef(deg, xRotate, yRotate, zRotate); + GL11.glTranslatef(-v, -v, -v); + v *= 2F; - ItemStack stack = altar.getStackInSlot(i); - Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); - IIcon icon = stack.getItem().getIcon(stack, 0); - if(icon != null) { - Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0)); - GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); - float f = icon.getMinU(); - float f1 = icon.getMaxU(); - float f2 = icon.getMinV(); - float f3 = icon.getMaxV(); - ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); - GL11.glColor3f(1F, 1F, 1F); + GL11.glColor4f(1F, 1F, 1F, 1F); + + ItemStack stack = altar.getStackInSlot(i); + Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); + IIcon icon = stack.getItem().getIcon(stack, 0); + if(icon != null) { + Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0)); + GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); + float f = icon.getMinU(); + float f1 = icon.getMaxU(); + float f2 = icon.getMinV(); + float f3 = icon.getMaxV(); + ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); + GL11.glColor3f(1F, 1F, 1F); + } + + GL11.glPopMatrix(); } GL11.glPopMatrix(); } - - GL11.glPopMatrix(); } Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); - + Block block = lava ? Blocks.lava : Blocks.water; + int brightness = lava ? 240 : -1; + float alpha = lava ? 1F : 0.7F; + GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glColor4f(1F, 1F, 1F, 0.7F); + if(lava) + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glColor4f(1F, 1F, 1F, alpha); GL11.glTranslatef(w, -0.3F, w); GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glScalef(s, s, s); - renderItem.renderIcon(0, 0, Blocks.water.getIcon(0, 0), 16, 16); + + renderIcon(0, 0, block.getIcon(0, 0), 16, 16, brightness); + if(lava) + GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); } GL11.glPopMatrix(); } + + public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5, int brightness) { + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + if(brightness != -1) + tessellator.setBrightness(brightness); + tessellator.addVertexWithUV(par1 + 0, par2 + par5, 0, par3Icon.getMinU(), par3Icon.getMaxV()); + tessellator.addVertexWithUV(par1 + par4, par2 + par5, 0, par3Icon.getMaxU(), par3Icon.getMaxV()); + tessellator.addVertexWithUV(par1 + par4, par2 + 0, 0, par3Icon.getMaxU(), par3Icon.getMinV()); + tessellator.addVertexWithUV(par1 + 0, par2 + 0, 0, par3Icon.getMinU(), par3Icon.getMinV()); + tessellator.draw(); + } } diff --git a/src/main/java/vazkii/botania/common/block/BlockAltar.java b/src/main/java/vazkii/botania/common/block/BlockAltar.java index a3791bf5c..46a8cb818 100644 --- a/src/main/java/vazkii/botania/common/block/BlockAltar.java +++ b/src/main/java/vazkii/botania/common/block/BlockAltar.java @@ -20,6 +20,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -94,11 +95,18 @@ public class BlockAltar extends BlockModContainer implements ILexiconable { else if(!par5EntityPlayer.capabilities.isCreativeMode) par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, getContainer(stack)); - tile.hasWater = true; + tile.setWater(true); par1World.func_147453_f(par2, par3, par4, this); - par1World.markBlockForUpdate(par2, par3, par4); } + return true; + } else if(stack != null && stack.getItem() == Items.lava_bucket) { + if(!par5EntityPlayer.capabilities.isCreativeMode) + par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, getContainer(stack)); + + tile.setLava(true); + par1World.func_147453_f(par2, par3, par4, this); + return true; } } diff --git a/src/main/java/vazkii/botania/common/block/tile/TileAltar.java b/src/main/java/vazkii/botania/common/block/tile/TileAltar.java index 511876aa9..2f42b0aab 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileAltar.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileAltar.java @@ -35,9 +35,12 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I private static final Pattern SEED_PATTERN = Pattern.compile("(?:(?:(?:[A-Z-_.:]|^)seed)|(?:(?:[a-z-_.:]|^)Seed))(?:[sA-Z-_.:]|$)"); public static final String TAG_HAS_WATER = "hasWater"; + public static final String TAG_HAS_LAVA = "hasLava"; public static final String TAG_IS_MOSSY = "isMossy"; public boolean hasWater = false; + public boolean hasLava = false; + public boolean isMossy = false; public boolean collideEntityItem(EntityItem item) { @@ -56,14 +59,23 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I } } - if(!hasWater()) { + if(!hasWater() && !hasLava()) { if(stack.getItem() == Items.water_bucket && !worldObj.isRemote) { setWater(true); worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); stack.func_150996_a(Items.bucket); // Set item + } else if(stack.getItem() == Items.lava_bucket && !worldObj.isRemote) { + setLava(true); + worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord)); + stack.func_150996_a(Items.bucket); // Set item } else return false; - } + } + if(hasLava()) { + item.setFire(100); + return true; + } + boolean didChange = false; if(stack.getItem() instanceof IFlowerComponent) { @@ -150,6 +162,13 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I Botania.proxy.sparkleFX(worldObj, xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10); } } + + if(hasLava()) { + isMossy = false; + worldObj.spawnParticle("smoke", xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, 0, 0.05, 0); + if(Math.random() > 0.9) + worldObj.spawnParticle("lava", xCoord + 0.5 + Math.random() * 0.4 - 0.2, yCoord + 1, zCoord + 0.5 + Math.random() * 0.4 - 0.2, 0, 0.01, 0); + } } @Override @@ -157,6 +176,7 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I super.writeCustomNBT(cmp); cmp.setBoolean(TAG_HAS_WATER, hasWater()); + cmp.setBoolean(TAG_HAS_LAVA, hasLava()); cmp.setBoolean(TAG_IS_MOSSY, isMossy); } @@ -165,6 +185,7 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I super.readCustomNBT(cmp); hasWater = cmp.getBoolean(TAG_HAS_WATER); + hasLava = cmp.getBoolean(TAG_HAS_LAVA); isMossy = cmp.getBoolean(TAG_IS_MOSSY); } @@ -208,10 +229,19 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I hasWater = water; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } + + public void setLava(boolean lava) { + hasLava = lava; + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } @Override public boolean hasWater() { return hasWater; } + + public boolean hasLava() { + return hasLava; + } } diff --git a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java index 7c1e332a2..98b9d90e2 100644 --- a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java +++ b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java @@ -221,7 +221,7 @@ public final class LexiconData { new PageText("6"), new PageCraftingRecipe("7", ModCraftingRecipes.recipeFertilizerPowder), new PageCraftingRecipe("8", ModCraftingRecipes.recipeFerilizerDye)); apothecary = new BLexiconEntry(LibLexicon.BASICS_APOTHECARY, categoryBasics); - apothecary.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_APOTHECARY), new PageText("2"), new PageText("3"), new PageCraftingRecipe("4", ModCraftingRecipes.recipesApothecary)); + apothecary.setPriority().setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_APOTHECARY), new PageText("2"), new PageText("3"), new PageText("4"), new PageCraftingRecipe("5", ModCraftingRecipes.recipesApothecary)); lexicon = new BLexiconEntry(LibLexicon.BASICS_LEXICON, categoryBasics); lexicon.setPriority().setLexiconPages(new PageText("0"), new PageText("3"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeLexicon), new PageText("2")); diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index cdd03379c..c920afe41 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -872,8 +872,9 @@ botania.entry.apothecary=Petal Apothecary botania.page.apothecary0=In order for a botanist to create plantlife that can do its bidding, one would need special means of infusing plants with mystical energy.
Luckily, the &1Petal Apothecary&0 does just that. botania.page.apothecary1=The &1Petal Apothecary&0. botania.page.apothecary2=This block, when placed in the world and given some water (by use of a &1Water Bucket&0), will accept any &1Mystical Petals&0 thrown at it, releasing their energies.
Once one has set the correct petals in, throwing some &1Seeds&0 in will finalize the proccess.
Tossing in the full bucket will also fill the recipient with water. -botania.page.apothecary3=Quite a few plants can be made using this method, for more information, read on the &4Functional Flora&0 and &4Generation Flora&0 sections of this Lexicon.
Shift-right clicking the &1Petal Apothecary&0 with an empty hand will remove the last item thrown in.
Lastly, tossing in &1Vines&0 also gives the block an overgrown visual. -botania.page.apothecary4=Crafting the &1Petal Apothecary&0. +botania.page.apothecary3=Quite a few plants can be made using this method, for more information, read on the &4Functional Flora&0 and &4Generation Flora&0 sections of this Lexicon.
Shift-right clicking the &1Petal Apothecary&0 with an empty hand will remove the last item thrown in. +botania.page.apothecary4=Instead of &1Water&0, one can place &1Lava&0 in this block, if that is done, it'll serve as a brazier and incinerator, destroying any items that come in contact.
Lastly, tossing in &1Vines&0 also gives the block an overgrown visual. +botania.page.apothecary5=Crafting the &1Petal Apothecary&0. # -- PURE DAISY botania.entry.pureDaisy=Pure Daisy