diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-08-13 21:12:11 +0100 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-08-13 21:12:11 +0100 |
| commit | 0ef6a00aa79f022e5bd56b3f77e6861bbecf6d94 (patch) | |
| tree | 03966c83cd16d1912ec1596d83f89f251cc35f83 /src/main/java/darkknight/jewelrycraft/tileentity | |
| parent | 921f1ba6f30e66c80c803618ebff496778e78970 (diff) | |
Added a new structure, a new curse, achievements, challenges, curses
entry in the guide; reworked liquids to be tile entities, cleaned the
structures code, potion code and... you know what? I improved and
changed so much stuff that I literally forgot what I did...
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/tileentity')
9 files changed, 1222 insertions, 1096 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java index 7eac88f..9cb60e4 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityCrystal.java @@ -1,42 +1,45 @@ -/** - * - */ -package darkknight.jewelrycraft.tileentity; - -import darkknight.jewelrycraft.config.ConfigHandler; -import net.minecraft.tileentity.TileEntity; - -/** - * @author Sorin - */ -public class TileEntityCrystal extends TileEntity -{ - public int shine = 120; - boolean descent = false; - int timer = 0; - - @Override - public void updateEntity() - { - if (ConfigHandler.CRYSTAL_GLOW){ - timer++; - if (timer > 20){ - if (shine < 230 && !descent){ - shine += 2; - if (shine >= 230) descent = true; - }else if (shine > 100 && descent){ - shine -= 2; - if (shine <= 100) descent = false; - } - this.worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord); - timer = 0; - } - } - } - - public boolean canUpdate() - { - return ConfigHandler.CRYSTAL_GLOW; - } - -} +/**
+ *
+ */
+package darkknight.jewelrycraft.tileentity;
+
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * @author Sorin
+ */
+public class TileEntityCrystal extends TileEntity
+{
+ public int shine = 120;
+ boolean descent = false;
+ int timer = 0;
+
+ @Override
+ public void updateEntity()
+ {
+ if (ConfigHandler.CRYSTAL_GLOW){
+ timer++;
+ if (timer > 20){
+ if (shine < 230 && !descent){
+ shine += 2;
+ if (shine >= 230) descent = true;
+ }else if (shine > 100 && descent){
+ shine -= 2;
+ if (shine <= 100) descent = false;
+ }
+ this.worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
+ timer = 0;
+ }
+ }
+ if(ConfigHandler.CRYSTAL_PARTICLES)
+ worldObj.spawnParticle("instantSpell", xCoord + worldObj.rand.nextFloat(), yCoord + worldObj.rand.nextFloat(), zCoord + worldObj.rand.nextFloat(), 0.0D, -1.0D, 0.0D);
+ }
+
+ public boolean canUpdate()
+ {
+ return ConfigHandler.CRYSTAL_GLOW || ConfigHandler.CRYSTAL_PARTICLES;
+ }
+
+}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java index ee48d08..e4a8602 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java @@ -1,182 +1,168 @@ -package darkknight.jewelrycraft.tileentity; - -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; - -/** - * @author Paul Fulham (pau101) - */ -public class TileEntityHandPedestal extends TileEntity -{ - protected boolean isDirty; - protected ItemStack heldItemStack; - /** - * When the hand is open the grip is 0 and is 20 when closed. - */ - private float grip; - private float prevGrip; - private float gripMax; - private float gripScale; - private boolean isHandOpen; - - /** - * - */ - public TileEntityHandPedestal() - { - isDirty = false; - heldItemStack = null; - grip = 0; - gripMax = 20; - gripScale = 1; - isHandOpen = true; - } - - /** - * @param tagCompound - */ - @Override - public void writeToNBT(NBTTagCompound tagCompound) - { - super.writeToNBT(tagCompound); - if (heldItemStack != null){ - NBTTagCompound objectCompound = new NBTTagCompound(); - heldItemStack.writeToNBT(objectCompound); - tagCompound.setTag("object", objectCompound); - } - tagCompound.setBoolean("isHandOpen", isHandOpen); - } - - /** - * @param tagCompound - */ - @Override - public void readFromNBT(NBTTagCompound tagCompound) - { - super.readFromNBT(tagCompound); - if (tagCompound.hasKey("object", 10)) setHeldItemStack(ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("object"))); - else removeHeldItemStack(); - isHandOpen = tagCompound.getBoolean("isHandOpen"); - } - - /** - * - */ - @Override - public void updateEntity() - { - super.updateEntity(); - updateGrip(); - if (isDirty){ - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - isDirty = false; - } - } - - /** - * - */ - private void updateGrip() - { - prevGrip = grip; - if (grip > 0 && isHandOpen) grip -= 1 / gripScale; - else if (grip < gripMax && !isHandOpen) grip += 1 / gripScale; - } - - /** - * @return - */ - @Override - public Packet getDescriptionPacket() - { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - writeToNBT(nbttagcompound); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound); - } - - /** - * @param networkManager - * @param packet - */ - @Override - public void onDataPacket(NetworkManager networkManager, S35PacketUpdateTileEntity packet) - { - readFromNBT(packet.func_148857_g()); - worldObj.func_147479_m(xCoord, yCoord, zCoord); - } - - /** - * - */ - @Override - public void markDirty() - { - super.markDirty(); - isDirty = true; - } - - /** - * @return - */ - public ItemStack getHeldItemStack() - { - return heldItemStack; - } - - /** - * @param heldItemStack - */ - public void setHeldItemStack(ItemStack heldItemStack) - { - heldItemStack.stackSize = 1; - this.heldItemStack = heldItemStack; - if (heldItemStack.getItem() instanceof ItemBlock) gripScale = 0.5f; - else gripScale = 1; - } - - /** - * - */ - public void removeHeldItemStack() - { - heldItemStack = null; - } - - /** - * - */ - public void openHand() - { - isHandOpen = true; - } - - /** - * - */ - public void closeHand() - { - isHandOpen = false; - } - - /** - * @param t - * @return - */ - public float getGrip(float t) - { - return (prevGrip * (1 - t) + grip * t) / gripMax; - } - - /** - * @return - */ - public float getGripScale() - { - return gripScale; - } +package darkknight.jewelrycraft.tileentity;
+
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * @author Paul Fulham (pau101)
+ */
+public class TileEntityHandPedestal extends TileEntity {
+ protected boolean isDirty;
+ protected ItemStack heldItemStack;
+ /**
+ * When the hand is open the grip is 0 and is 20 when closed.
+ */
+ private float grip;
+ private float prevGrip;
+ private float gripMax;
+ private float gripScale;
+ private boolean isHandOpen;
+
+ /**
+ *
+ */
+ public TileEntityHandPedestal() {
+ isDirty = false;
+ heldItemStack = null;
+ grip = 0;
+ gripMax = 20;
+ gripScale = 1;
+ isHandOpen = true;
+ }
+
+ /**
+ * @param tagCompound
+ */
+ @Override
+ public void writeToNBT(NBTTagCompound tagCompound) {
+ super.writeToNBT(tagCompound);
+ if (heldItemStack != null) {
+ NBTTagCompound objectCompound = new NBTTagCompound();
+ heldItemStack.writeToNBT(objectCompound);
+ tagCompound.setTag("object", objectCompound);
+ }
+ tagCompound.setBoolean("isHandOpen", isHandOpen);
+ }
+
+ /**
+ * @param tagCompound
+ */
+ @Override
+ public void readFromNBT(NBTTagCompound tagCompound) {
+ super.readFromNBT(tagCompound);
+ if (tagCompound.hasKey("object", 10)) setHeldItemStack(ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("object")));
+ else removeHeldItemStack();
+ isHandOpen = tagCompound.getBoolean("isHandOpen");
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void updateEntity() {
+ super.updateEntity();
+ updateGrip();
+ if (isDirty) {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ isDirty = false;
+ }
+ }
+
+ /**
+ *
+ */
+ private void updateGrip() {
+ prevGrip = grip;
+ if (grip > 0 && isHandOpen) grip -= 1 / gripScale;
+ else if (grip < gripMax && !isHandOpen) grip += 1 / gripScale;
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound);
+ }
+
+ /**
+ * @param networkManager
+ * @param packet
+ */
+ @Override
+ public void onDataPacket(NetworkManager networkManager, S35PacketUpdateTileEntity packet) {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void markDirty() {
+ super.markDirty();
+ isDirty = true;
+ }
+
+ /**
+ * @return
+ */
+ public ItemStack getHeldItemStack() {
+ return heldItemStack;
+ }
+
+ /**
+ * @param heldItemStack
+ */
+ public void setHeldItemStack(ItemStack heldItemStack) {
+ if (heldItemStack != null && heldItemStack.getItem() != null) {
+ heldItemStack.stackSize = 1;
+ this.heldItemStack = heldItemStack;
+ if (heldItemStack.getItem() instanceof ItemBlock) gripScale = 0.5f;
+ else gripScale = 1;
+ }
+ }
+
+ /**
+ *
+ */
+ public void removeHeldItemStack() {
+ heldItemStack = null;
+ }
+
+ /**
+ *
+ */
+ public void openHand() {
+ isHandOpen = true;
+ }
+
+ /**
+ *
+ */
+ public void closeHand() {
+ isHandOpen = false;
+ }
+
+ /**
+ * @param t
+ * @return
+ */
+ public float getGrip(float t) {
+ return (prevGrip * (1 - t) + grip * t) / gripMax;
+ }
+
+ /**
+ * @return
+ */
+ public float getGripScale() {
+ return gripScale;
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java index cb216a0..4ecaf7d 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java @@ -1,154 +1,224 @@ -package darkknight.jewelrycraft.tileentity; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.util.JewelryNBT; -import darkknight.jewelrycraft.util.JewelrycraftUtil; - -public class TileEntityJewelrsCraftingTable extends TileEntity -{ - public boolean hasJewelry, hasEndItem, isDirty, hasGem, crafting; - public ItemStack jewelry, endItem, gem; - public int carving, effect; - public float angle; - - /** - * - */ - public TileEntityJewelrsCraftingTable() - { - jewelry = new ItemStack(Item.getItemById(0), 0, 0); - endItem = new ItemStack(Item.getItemById(0), 0, 0); - gem = new ItemStack(Item.getItemById(0), 0, 0); - hasJewelry = false; - hasEndItem = false; - hasGem = false; - crafting = false; - carving = 0; - effect = 0; - angle = 0; - isDirty = false; - } - - /** - * @param nbt - */ - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setBoolean("hasJewelry", hasJewelry); - nbt.setBoolean("hasEndItem", hasEndItem); - nbt.setBoolean("hasJewel", hasGem); - nbt.setBoolean("crafting", crafting); - nbt.setInteger("timer", carving); - nbt.setInteger("effect", effect); - nbt.setFloat("angle", angle); - NBTTagCompound tag1 = new NBTTagCompound(); - NBTTagCompound tag2 = new NBTTagCompound(); - NBTTagCompound tag3 = new NBTTagCompound(); - jewelry.writeToNBT(tag1); - nbt.setTag("jewelry", tag1); - endItem.writeToNBT(tag2); - nbt.setTag("endItem", tag2); - gem.writeToNBT(tag3); - nbt.setTag("jewel", tag3); - } - - /** - * @param nbt - */ - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - hasJewelry = nbt.getBoolean("hasJewelry"); - hasEndItem = nbt.getBoolean("hasEndItem"); - hasGem = nbt.getBoolean("hasJewel"); - crafting = nbt.getBoolean("crafting"); - carving = nbt.getInteger("timer"); - effect = nbt.getInteger("effect"); - angle = nbt.getFloat("angle"); - jewelry = new ItemStack(Item.getItemById(0), 0, 0); - jewelry.readFromNBT(nbt.getCompoundTag("jewelry")); - endItem = new ItemStack(Item.getItemById(0), 0, 0); - endItem.readFromNBT(nbt.getCompoundTag("endItem")); - gem = new ItemStack(Item.getItemById(0), 0, 0); - gem.readFromNBT(nbt.getCompoundTag("jewel")); - } - - /** - * - */ - @Override - public void updateEntity() - { - super.updateEntity(); - if (isDirty){ - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - isDirty = false; - } - if (angle < 360F) angle += 3F; - else angle = 0F; - if (hasJewelry && hasGem && !hasEndItem && crafting){ - if (carving > 0) carving--; - if (crafting) for(int l = 0; l < ConfigHandler.GEM_PLACEMENT_TIME / (carving + 2); ++l){ - if (worldObj.rand.nextInt(10) == 0) worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.orb", 0.05F, 1F); - if (getBlockMetadata() == 0) worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double)yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D); - if (getBlockMetadata() == 1) worldObj.spawnParticle("instantSpell", xCoord + 0.8F, (double)yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D); - if (getBlockMetadata() == 2) worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double)yCoord + 0.8F, zCoord + 0.8F, 0.0D, 0.0D, 0.0D); - if (getBlockMetadata() == 3) worldObj.spawnParticle("instantSpell", xCoord + 0.2F, (double)yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D); - } - if (carving == 0){ - hasEndItem = true; - endItem = jewelry.copy(); - if (hasGem && gem != new ItemStack(Item.getItemById(0), 0, 0)) if (!JewelryNBT.hasTag(jewelry, "gem")){ - JewelryNBT.addGem(endItem, gem); - hasGem = false; - gem = new ItemStack(Item.getItemById(0), 0, 0); - }else{ - ItemStack aux = JewelryNBT.gem(jewelry); - JewelryNBT.addGem(endItem, gem); - if (JewelrycraftUtil.rand.nextBoolean()) gem = aux.copy(); - else{ - hasGem = false; - gem = new ItemStack(Item.getItemById(0), 0, 0); - } - } - hasJewelry = false; - jewelry = new ItemStack(Item.getItemById(0), 0, 0); - carving = -1; - crafting = false; - isDirty = true; - } - } - } - - /** - * @return - */ - @Override - public Packet getDescriptionPacket() - { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - writeToNBT(nbttagcompound); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound); - } - - /** - * @param net - * @param packet - */ - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) - { - readFromNBT(packet.func_148857_g()); - worldObj.func_147479_m(xCoord, yCoord, zCoord); - } -} +package darkknight.jewelrycraft.tileentity;
+
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+public class TileEntityJewelrsCraftingTable extends TileEntity
+{
+ public boolean hasJewelry, hasEndItem, isDirty, hasGem, crafting;
+ public ItemStack jewelry, endItem, gem;
+ public int carving, effect;
+ public float angle;
+
+ /**
+ *
+ */
+ public TileEntityJewelrsCraftingTable()
+ {
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ hasJewelry = false;
+ hasEndItem = false;
+ hasGem = false;
+ crafting = false;
+ carving = 0;
+ effect = 0;
+ angle = 0;
+ isDirty = false;
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ nbt.setBoolean("hasJewelry", hasJewelry);
+ nbt.setBoolean("hasEndItem", hasEndItem);
+ nbt.setBoolean("hasJewel", hasGem);
+ nbt.setBoolean("crafting", crafting);
+ nbt.setInteger("timer", carving);
+ nbt.setInteger("effect", effect);
+ nbt.setFloat("angle", angle);
+ NBTTagCompound tag1 = new NBTTagCompound();
+ NBTTagCompound tag2 = new NBTTagCompound();
+ NBTTagCompound tag3 = new NBTTagCompound();
+ jewelry.writeToNBT(tag1);
+ nbt.setTag("jewelry", tag1);
+ endItem.writeToNBT(tag2);
+ nbt.setTag("endItem", tag2);
+ gem.writeToNBT(tag3);
+ nbt.setTag("jewel", tag3);
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ hasJewelry = nbt.getBoolean("hasJewelry");
+ hasEndItem = nbt.getBoolean("hasEndItem");
+ hasGem = nbt.getBoolean("hasJewel");
+ crafting = nbt.getBoolean("crafting");
+ carving = nbt.getInteger("timer");
+ effect = nbt.getInteger("effect");
+ angle = nbt.getFloat("angle");
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ jewelry.readFromNBT(nbt.getCompoundTag("jewelry"));
+ endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ endItem.readFromNBT(nbt.getCompoundTag("endItem"));
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ gem.readFromNBT(nbt.getCompoundTag("jewel"));
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ if (isDirty){
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ isDirty = false;
+ }
+ if (angle < 360F) angle += 3F;
+ else angle = 0F;
+ if (hasJewelry && hasGem && !hasEndItem && crafting){
+ if (carving > 0) carving--;
+ if (crafting) for(int l = 0; l < ConfigHandler.GEM_PLACEMENT_TIME / (carving + 2); ++l){
+ if (worldObj.rand.nextInt(10) == 0) worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.orb", 0.05F, 1F);
+ if (getBlockMetadata() == 0) worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double)yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
+ if (getBlockMetadata() == 1) worldObj.spawnParticle("instantSpell", xCoord + 0.8F, (double)yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
+ if (getBlockMetadata() == 2) worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double)yCoord + 0.8F, zCoord + 0.8F, 0.0D, 0.0D, 0.0D);
+ if (getBlockMetadata() == 3) worldObj.spawnParticle("instantSpell", xCoord + 0.2F, (double)yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
+ }
+ if (carving == 0){
+ hasEndItem = true;
+ endItem = jewelry.copy();
+ if (hasGem && gem != new ItemStack(Item.getItemById(0), 0, 0)) if (!JewelryNBT.hasTag(jewelry, "gem")){
+ JewelryNBT.addGem(endItem, gem);
+ hasGem = false;
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ }else{
+ ItemStack aux = JewelryNBT.gem(jewelry);
+ JewelryNBT.addGem(endItem, gem);
+ if (JewelrycraftUtil.rand.nextBoolean()) gem = aux.copy();
+ else{
+ hasGem = false;
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ }
+ }
+ hasJewelry = false;
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ carving = -1;
+ crafting = false;
+ isDirty = true;
+ }
+ }
+ }
+
+ public void setGemItemStack(ItemStack itemStack)
+ {
+ if (itemStack != null && itemStack.getItem() != null) {
+ this.gem = itemStack.copy();
+ this.gem.stackSize = 1;
+ this.hasGem = true;
+ this.isDirty = true;
+ }
+ }
+
+ public void setJewelryItemStack(ItemStack itemStack)
+ {
+ if (itemStack != null && itemStack.getItem() != null) {
+ this.jewelry = itemStack.copy();
+ this.jewelry.stackSize = 1;
+ this.hasJewelry = true;
+ this.isDirty = true;
+ }
+ }
+
+ public void setCrafting()
+ {
+ carving = ConfigHandler.GEM_PLACEMENT_TIME;
+ angle = 0;
+ crafting = true;
+ isDirty = true;
+ }
+
+ public void removeGem()
+ {
+ dropItem(worldObj, xCoord, yCoord, zCoord, gem.copy());
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ hasGem = false;
+ carving = -1;
+ crafting = false;
+ angle = 0F;
+ isDirty = true;
+ }
+
+ public void removeJewelry()
+ {
+ dropItem(worldObj, xCoord, yCoord, zCoord, jewelry.copy());
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ hasJewelry = false;
+ carving = -1;
+ crafting = false;
+ angle = 0F;
+ isDirty = true;
+ }
+
+ public void removeResult()
+ {
+ dropItem(worldObj, xCoord, yCoord, zCoord, endItem.copy());
+ endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ hasEndItem = false;
+ isDirty = true;
+ }
+
+ public void dropItem(World world, double x, double y, double z, ItemStack stack)
+ {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.21000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public Packet getDescriptionPacket()
+ {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
+ }
+
+ /**
+ * @param net
+ * @param packet
+ */
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
+ {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java new file mode 100644 index 0000000..5da722a --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java @@ -0,0 +1,66 @@ +/**
+ *
+ */
+package darkknight.jewelrycraft.tileentity;
+
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * @author Sorin
+ */
+public class TileEntityMoltenMetal extends TileEntity {
+ private ItemStack metal;
+
+ public TileEntityMoltenMetal() {
+ metal = null;
+ }
+
+ public boolean canUpdate() {
+ return false;
+ }
+
+ public void setMetal(ItemStack metal) {
+ if(metal != null) this.metal = metal.copy();
+ else this.metal = null;
+ }
+
+ public ItemStack getMetal() {
+ return metal;
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt) {
+ super.writeToNBT(nbt);
+ if (metal != null) {
+ NBTTagCompound tag = new NBTTagCompound();
+ metal.writeToNBT(tag);
+ nbt.setTag("metal", tag);
+ }
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ if (nbt.hasKey("metal")) setMetal(ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("metal")));
+ else metal = null;
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java index cac74e2..c5e77e6 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java @@ -30,7 +30,7 @@ import darkknight.jewelrycraft.util.Variables; public class TileEntityShadowEye extends TileEntity
{
- public int opening, timer, t = 20;
+ public int opening, timer, t = 20, soundTimer;
public boolean active, shouldAddData;
public ArrayList<ItemStack> pedestalItems = new ArrayList<ItemStack>();
ResourceLocation particleTexture = new ResourceLocation(Variables.MODID, "textures/particle/shadows.png");
@@ -107,6 +107,7 @@ public class TileEntityShadowEye extends TileEntity if (opening < 4){
opening++;
timer = 20;
+ soundTimer = 0;
}
if (canStartRitual && opening == 4) timer = ConfigHandler.RITUAL_TIME;
else if (!canStartRitual){
@@ -124,6 +125,9 @@ public class TileEntityShadowEye extends TileEntity int i = Minecraft.getMinecraft().gameSettings.particleSetting;
for(int l = 0; l <= 100 - i*45; l++)
worldObj.spawnParticle("depthsuspend", xCoord + 6.5F - worldObj.rand.nextInt(12) - worldObj.rand.nextFloat(), yCoord - 2F + worldObj.rand.nextInt(9) - worldObj.rand.nextFloat(), zCoord + 6.5F - worldObj.rand.nextInt(12) - worldObj.rand.nextFloat(), 0, 0, 0);
+ if(soundTimer == 0) worldObj.playSound(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D, "jewelrycraft2:Ritual", 1.0F, 1.0F, false);
+ if(soundTimer < 20*14) soundTimer++;
+ else soundTimer = 0;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java index 745eb51..cb3da14 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java @@ -1,190 +1,189 @@ -package darkknight.jewelrycraft.tileentity; - -import java.util.Random; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; -import net.minecraft.tileentity.TileEntity; -import darkknight.jewelrycraft.config.ConfigHandler; -import darkknight.jewelrycraft.util.JewelryNBT; -import darkknight.jewelrycraft.util.JewelrycraftUtil; - -public class TileEntitySmelter extends TileEntity -{ - public int melting, flow, n = 0, p = 0; - public boolean hasMetal, hasMoltenMetal, isDirty, pouring; - public ItemStack metal, moltenMetal; - public float quantity, pouredQuantity = 0.1f; - - /** - * - */ - public TileEntitySmelter() - { - melting = 0; - pouring = false; - flow = 0; - quantity = 0f; - hasMetal = false; - hasMoltenMetal = false; - metal = new ItemStack(Item.getItemById(0), 0, 0); - moltenMetal = new ItemStack(Item.getItemById(0), 0, 0); - isDirty = false; - } - - /** - * @param nbt - */ - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setInteger("melting", melting); - nbt.setFloat("quantity", quantity); - nbt.setBoolean("hasMetal", hasMetal); - nbt.setBoolean("hasMoltenMetal", hasMoltenMetal); - nbt.setBoolean("pouring", pouring); - NBTTagCompound tag = new NBTTagCompound(); - NBTTagCompound tag1 = new NBTTagCompound(); - metal.writeToNBT(tag); - nbt.setTag("metal", tag); - moltenMetal.writeToNBT(tag1); - nbt.setTag("moltenMetal", tag1); - } - - /** - * @param nbt - */ - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - melting = nbt.getInteger("melting"); - quantity = nbt.getFloat("quantity"); - hasMetal = nbt.getBoolean("hasMetal"); - hasMoltenMetal = nbt.getBoolean("hasMoltenMetal"); - pouring = nbt.getBoolean("pouring"); - metal = new ItemStack(Item.getItemById(0), 0, 0); - metal.readFromNBT(nbt.getCompoundTag("metal")); - moltenMetal = new ItemStack(Item.getItemById(0), 0, 0); - moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal")); - } - - /** - * - */ - @Override - public void updateEntity() - { - super.updateEntity(); - Random rand = new Random(); - if (isDirty){ - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - isDirty = false; - } - if (p > 0) --p; - else p = 5; - if (n == 0 && p == 0){ - flow += 16; - if (flow >= 16 * 20) n = 1; - } - if (n == 1 && p == 0){ - flow -= 16; - if (flow <= 0) n = 0; - } - if (hasMetal) for(int l = 0; l < 2; ++l) - worldObj.spawnParticle("flame", xCoord + rand.nextFloat(), (double)yCoord + 0.3F, zCoord + rand.nextFloat(), 0.0D, 0.0D, 0.0D); - if (rand.nextInt(65) == 0){ - double d5 = xCoord + rand.nextFloat(); - double d7 = yCoord; - double d6 = zCoord + rand.nextFloat(); - worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false); - } - if (hasMetal && !hasMoltenMetal){ - boolean isOre = JewelrycraftUtil.isOre(metal); - if (melting > 0) melting--; - if (melting == 0){ - hasMetal = false; - if (!isOre){ - if(JewelryNBT.ingot(metal) == null) moltenMetal = metal; - else moltenMetal = JewelryNBT.ingot(metal); - } - else{ - moltenMetal = JewelrycraftUtil.getIngotFromOre(metal); - moltenMetal.stackSize *= 2; - } - hasMoltenMetal = true; - if (!isOre) quantity = 0.1f * metal.stackSize; - else quantity = 0.2f * metal.stackSize; - metal = new ItemStack(Item.getItemById(0), 0, 0); - melting = -1; - isDirty = true; - } - }else if (hasMoltenMetal){ - boolean isOre = JewelrycraftUtil.isOre(metal); - if (melting > 0) melting--; - if (melting == 0){ - hasMetal = false; - if (!isOre) moltenMetal.stackSize += metal.stackSize; - else moltenMetal.stackSize += metal.stackSize * 2; - if (!isOre) quantity += 0.1f * metal.stackSize; - else quantity += 0.2f * metal.stackSize; - metal = new ItemStack(Item.getItemById(0), 0, 0); - melting = -1; - isDirty = true; - } - } - TileEntityMolder me = null; - if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0 && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord, yCoord, zCoord - 1); - else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord + 1, yCoord, zCoord); - else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 2 && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord, yCoord, zCoord + 1); - else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 3 && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord - 1, yCoord, zCoord); - if (pouring && pouredQuantity > 0f){ - quantity -= 0.01f; - pouredQuantity -= 0.01f; - me.quantity += 0.01f; - if (!me.hasMoltenMetal){ - me.moltenMetal = moltenMetal; - me.hasMoltenMetal = true; - } - if (pouredQuantity <= 0f){ - pouring = false; - pouredQuantity = 0.1f; - me.cooling = ConfigHandler.INGOT_COOLING_TIME; - } - if (quantity <= 0f){ - quantity = 0f; - hasMoltenMetal = false; - moltenMetal = new ItemStack(Item.getItemById(0), 0, 0); - // pouring = false; - me.cooling = ConfigHandler.INGOT_COOLING_TIME; - } - me.isDirty = true; - } - } - - /** - * @return - */ - @Override - public Packet getDescriptionPacket() - { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - writeToNBT(nbttagcompound); - return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound); - } - - /** - * @param net - * @param packet - */ - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) - { - readFromNBT(packet.func_148857_g()); - worldObj.func_147479_m(xCoord, yCoord, zCoord); - } -} +package darkknight.jewelrycraft.tileentity;
+
+import java.util.Random;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+public class TileEntitySmelter extends TileEntity
+{
+ public int melting, flow, n = 0, p = 0;
+ public boolean hasMetal, hasMoltenMetal, isDirty, pouring;
+ public ItemStack metal, moltenMetal;
+ public float quantity, pouredQuantity = 0.1f;
+
+ /**
+ *
+ */
+ public TileEntitySmelter()
+ {
+ melting = 0;
+ pouring = false;
+ flow = 0;
+ quantity = 0f;
+ hasMetal = false;
+ hasMoltenMetal = false;
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ isDirty = false;
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ nbt.setInteger("melting", melting);
+ nbt.setFloat("quantity", quantity);
+ nbt.setBoolean("hasMetal", hasMetal);
+ nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
+ nbt.setBoolean("pouring", pouring);
+ NBTTagCompound tag = new NBTTagCompound();
+ NBTTagCompound tag1 = new NBTTagCompound();
+ metal.writeToNBT(tag);
+ nbt.setTag("metal", tag);
+ moltenMetal.writeToNBT(tag1);
+ nbt.setTag("moltenMetal", tag1);
+ }
+
+ /**
+ * @param nbt
+ */
+ @Override
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ melting = nbt.getInteger("melting");
+ quantity = nbt.getFloat("quantity");
+ hasMetal = nbt.getBoolean("hasMetal");
+ hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
+ pouring = nbt.getBoolean("pouring");
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ metal.readFromNBT(nbt.getCompoundTag("metal"));
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ Random rand = new Random();
+ if (isDirty){
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ isDirty = false;
+ }
+ if (p > 0) --p;
+ else p = 5;
+ if (n == 0 && p == 0){
+ flow += 16;
+ if (flow >= 16 * 20) n = 1;
+ }
+ if (n == 1 && p == 0){
+ flow -= 16;
+ if (flow <= 0) n = 0;
+ }
+ if (hasMetal) for(int l = 0; l < 2; ++l)
+ worldObj.spawnParticle("flame", xCoord + rand.nextFloat(), (double)yCoord + 0.3F, zCoord + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
+ if (rand.nextInt(65) == 0){
+ double d5 = xCoord + rand.nextFloat();
+ double d7 = yCoord;
+ double d6 = zCoord + rand.nextFloat();
+ worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
+ }
+ if (hasMetal && !hasMoltenMetal){
+ boolean isOre = JewelrycraftUtil.isOre(metal);
+ if (melting > 0) melting--;
+ if (melting == 0){
+ hasMetal = false;
+ if (!isOre){
+ if(JewelryNBT.ingot(metal) == null) moltenMetal = metal;
+ else moltenMetal = JewelryNBT.ingot(metal);
+ }
+ else{
+ moltenMetal = JewelrycraftUtil.getIngotFromOre(metal);
+ moltenMetal.stackSize *= 2;
+ }
+ hasMoltenMetal = true;
+ if (!isOre) quantity = 0.1f * metal.stackSize;
+ else quantity = 0.2f * metal.stackSize;
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ melting = -1;
+ isDirty = true;
+ }
+ }else if (hasMoltenMetal){
+ boolean isOre = JewelrycraftUtil.isOre(metal);
+ if (melting > 0) melting--;
+ if (melting == 0){
+ hasMetal = false;
+ if (!isOre) moltenMetal.stackSize += metal.stackSize;
+ else moltenMetal.stackSize += metal.stackSize * 2;
+ if (!isOre) quantity += 0.1f * metal.stackSize;
+ else quantity += 0.2f * metal.stackSize;
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ melting = -1;
+ isDirty = true;
+ }
+ }
+ TileEntityMolder me = null;
+ if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0 && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord, yCoord, zCoord - 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord + 1, yCoord, zCoord);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 2 && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord, yCoord, zCoord + 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 3 && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord - 1, yCoord, zCoord);
+ if (pouring && pouredQuantity > 0f){
+ quantity -= 0.01f;
+ pouredQuantity -= 0.01f;
+ me.quantity += 0.01f;
+ if (!me.hasMoltenMetal){
+ me.moltenMetal = moltenMetal;
+ me.hasMoltenMetal = true;
+ }
+ if (pouredQuantity <= 0f){
+ pouring = false;
+ pouredQuantity = 0.1f;
+ me.cooling = ConfigHandler.INGOT_COOLING_TIME;
+ }
+ if (quantity <= 0f){
+ quantity = 0f;
+ hasMoltenMetal = false;
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ me.cooling = ConfigHandler.INGOT_COOLING_TIME;
+ }
+ me.isDirty = true;
+ }
+ }
+
+ /**
+ * @return
+ */
+ @Override
+ public Packet getDescriptionPacket()
+ {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
+ }
+
+ /**
+ * @param net
+ * @param packet
+ */
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
+ {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java index 750c7cb..f36fa84 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java @@ -1,264 +1,264 @@ -package darkknight.jewelrycraft.tileentity.renders; - -import java.awt.Color; -import java.util.HashMap; -import java.util.List; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import darkknight.jewelrycraft.model.ModelDisplayer; -import darkknight.jewelrycraft.tileentity.TileEntityDisplayer; -import darkknight.jewelrycraft.util.Variables; - -public class TileEntityDisplayerRender extends TileEntitySpecialRenderer -{ - ModelDisplayer displayer = new ModelDisplayer(); - String texture = "textures/tileentities/Displayer.png"; - HashMap<EnumChatFormatting, Integer> colors = new HashMap<EnumChatFormatting, Integer>(){ - { - put(EnumChatFormatting.AQUA, 5636095); - put(EnumChatFormatting.BLACK, 0); - put(EnumChatFormatting.BLUE, 5592575); - put(EnumChatFormatting.DARK_AQUA, 43690); - put(EnumChatFormatting.DARK_BLUE, 170); - put(EnumChatFormatting.DARK_GRAY, 5592405); - put(EnumChatFormatting.DARK_GREEN, 43520); - put(EnumChatFormatting.DARK_PURPLE, 11141290); - put(EnumChatFormatting.DARK_RED, 11141120); - put(EnumChatFormatting.GOLD, 16755200); - put(EnumChatFormatting.GRAY, 11184810); - put(EnumChatFormatting.GREEN, 5635925); - put(EnumChatFormatting.LIGHT_PURPLE, 16733695); - put(EnumChatFormatting.RED, 16733525); - put(EnumChatFormatting.WHITE, 16777215); - put(EnumChatFormatting.YELLOW, 16777045); - } - }; - - /** - * @param te - * @param x - * @param y - * @param z - * @param scale - */ - @Override - public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); - TileEntityDisplayer disp = (TileEntityDisplayer)te; - ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture); - Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture); - GL11.glPushMatrix(); - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - displayer.render((Entity)null, disp.ringTranslation1, disp.ringTranslation2, disp.ringTranslation3, 0.0F, 0.0F, 0.0625F); - try{ - int block = disp.getBlockMetadata(); - if (disp != null && disp.hasObject && disp.object != null && disp.object.getItem() != null && disp.object != new ItemStack(Item.getItemById(0), 0, 0)){ - int ind = -3; - GL11.glPushMatrix(); - EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, disp.object); - entityitem.hoverStart = 0.0F; - disp.object.stackSize = 1; - GL11.glRotatef(180F, 1F, 0F, 0F); - GL11.glTranslatef(0.0F, -0.6F + disp.ringTranslation1 / 5, 0F); - GL11.glRotatef(disp.rotAngle, 0F, 1F, 0F); - GL11.glColor4f(1F, 1F, 1F, 1F); - if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - else{ - GL11.glRotatef(180F, 0F, 1F, 0F); - RenderManager.instance.options.fancyGraphics = true; - int i = 15728880; - int j = i % 65536; - int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F); - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - RenderManager.instance.options.fancyGraphics = false; - } - EntityPlayer player = te.getWorldObj().getClosestPlayer(te.xCoord, te.yCoord, te.zCoord, 5D); - GL11.glPopMatrix(); - GL11.glPushMatrix(); - if (player != null) renderLabel(disp.object.getDisplayName(), 0F, -0.171F * ind, 0F, block, disp, colors.get(disp.object.getRarity().rarityColor)); - GL11.glPopMatrix(); - ind++; - if (player != null && disp.quantity > 1){ - GL11.glPushMatrix(); - renderLabel("x" + Integer.toString(disp.quantity), 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB()); - GL11.glPopMatrix(); - ind++; - } - if (disp.object.getItem() != Items.map && player != null && disp.object.getTooltip(player, true) != null){ - List tooltips = disp.object.getTooltip(player, true); - if (disp.infoIndex + 5 > tooltips.size()) disp.infoIndex = 1; - if (tooltips.size() < 5) for(int i = 1; i < tooltips.size(); i++){ - String tooltip = tooltips.get(i).toString(); - RenderManager.instance.getFontRenderer(); - if (tooltip != ""){ - GL11.glPushMatrix(); - renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB()); - GL11.glPopMatrix(); - ind++; - } - } - else for(int i = disp.infoIndex; i < disp.infoIndex + 5; i++){ - String tooltip = tooltips.get(i).toString(); - RenderManager.instance.getFontRenderer(); - if (tooltip != ""){ - GL11.glPushMatrix(); - renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB()); - GL11.glPopMatrix(); - ind++; - } - } - } - } - } - catch(Exception e){} - GL11.glPopMatrix(); - GL11.glPopMatrix(); - } - - /** - * @param par2Str - * @param x - * @param y - * @param z - * @param metadata - * @param te - * @param color - */ - protected void renderLabel(String par2Str, double x, double y, double z, int metadata, TileEntity te, int color) - { - FontRenderer fontrenderer = RenderManager.instance.getFontRenderer(); - float var14 = 0.01266667F * 1.5F; - float var17 = 0.015F; - GL11.glRotatef(180F, 0F, 0F, 1F); - if (metadata == 0) GL11.glRotatef(0F, 0F, 1F, 0F); - else if (metadata == 1) GL11.glRotatef(270F, 0F, 1F, 0F); - else if (metadata == 2) GL11.glRotatef(180F, 0F, 1F, 0F); - else if (metadata == 3) GL11.glRotatef(90F, 0F, 1F, 0F); - GL11.glTranslatef((float)x, (float)y, (float)z + 0.45F); - GL11.glScalef(-0.015F, -var14, 0.015F); - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - Tessellator tessellator = Tessellator.instance; - GL11.glDisable(GL11.GL_TEXTURE_2D); - int j = fontrenderer.getStringWidth(par2Str) / 2; - tessellator.startDrawingQuads(); - tessellator.setColorRGBA_F(0.0F, 0.2F, 0.2F, 0.9F); - tessellator.addVertex(-33.333 - 0, 0D, 0.1D); - tessellator.addVertex(-33.333 - 0, 9D, 0.1D); - tessellator.addVertex(33.333 + 0, 9D, 0.1D); - tessellator.addVertex(33.333 + 0, 0D, 0.1D); - tessellator.draw(); - if (fontrenderer.getStringWidth(par2Str) / 2 > 20) var17 = 0.9F / fontrenderer.getStringWidth(par2Str); - else var17 = var14; - int red = color >> 16 & 0xFF; - int green = color >> 8 & 0xFF; - int blue = color & 0xFF; - GL11.glTranslatef((float)x + 1f, (float)y + 1f, (float)z); - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glScalef(var17 * 70F, 1F, 0F); - int i = 15728880; - int t = i % 65536; - int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, t / 1.0F, k / 1.0F); - fontrenderer.drawString(par2Str.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 65536 * (red > 170 ? red - 170 : 0) + 256 * (green > 170 ? green - 170 : 0) + (blue > 170 ? blue - 170 : 0)); - GL11.glPopMatrix(); - GL11.glTranslatef((float)x - 1f, (float)y - 1f, (float)z - 1F); - GL11.glScalef(var17 * 70F, 1F, 0F); - fontrenderer.drawString(par2Str, -j, 0, color); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - - /** - * @param str - * @param color - */ - public void replaceEnumEnchValues(String str, int color) - { - if (str.contains("§0")){ - color = Color.BLACK.getRGB(); - str.replace("§0", ""); - } - if (str.contains("§1")){ - color = 85; - str.replace("§1", ""); - } - if (str.contains("§2")){ - color = 17920; - str.replace("§2", ""); - } - if (str.contains("§3")){ - color = 1336183; - str.replace("§3", ""); - } - if (str.contains("§4")){ - color = 4587520; - str.replace("§4", ""); - } - if (str.contains("§5")){ - color = 5701759; - str.replace("§5", ""); - } - if (str.contains("§6")){ - color = 16762880; - str.replace("§6", ""); - } - if (str.contains("§7")){ - color = Color.GRAY.getRGB(); - str.replace("§7", ""); - } - if (str.contains("§8")){ - color = Color.DARK_GRAY.getRGB(); - str.replace("§8", ""); - } - if (str.contains("§9")){ - color = Color.BLUE.getRGB(); - str.replace("§9", ""); - } - if (str.contains("§a")){ - color = Color.GREEN.getRGB(); - str.replace("§a", ""); - } - if (str.contains("§b")){ - color = Color.CYAN.getRGB(); - str.replace("§b", ""); - } - if (str.contains("§c")){ - color = Color.RED.getRGB(); - str.replace("§c", ""); - } - if (str.contains("§d")){ - color = 11665663; - str.replace("§d", ""); - } - if (str.contains("§e")){ - color = Color.YELLOW.getRGB(); - str.replace("§e", ""); - } - if (str.contains("§f")){ - color = Color.WHITE.getRGB(); - str.replace("§f", ""); - } - } +package darkknight.jewelrycraft.tileentity.renders;
+
+import java.awt.Color;
+import java.util.HashMap;
+import java.util.List;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.model.ModelDisplayer;
+import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
+import darkknight.jewelrycraft.util.Variables;
+
+public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
+{
+ ModelDisplayer displayer = new ModelDisplayer();
+ String texture = "textures/tileentities/Displayer.png";
+ HashMap<EnumChatFormatting, Integer> colors = new HashMap<EnumChatFormatting, Integer>(){
+ {
+ put(EnumChatFormatting.AQUA, 5636095);
+ put(EnumChatFormatting.BLACK, 0);
+ put(EnumChatFormatting.BLUE, 5592575);
+ put(EnumChatFormatting.DARK_AQUA, 43690);
+ put(EnumChatFormatting.DARK_BLUE, 170);
+ put(EnumChatFormatting.DARK_GRAY, 5592405);
+ put(EnumChatFormatting.DARK_GREEN, 43520);
+ put(EnumChatFormatting.DARK_PURPLE, 11141290);
+ put(EnumChatFormatting.DARK_RED, 11141120);
+ put(EnumChatFormatting.GOLD, 16755200);
+ put(EnumChatFormatting.GRAY, 11184810);
+ put(EnumChatFormatting.GREEN, 5635925);
+ put(EnumChatFormatting.LIGHT_PURPLE, 16733695);
+ put(EnumChatFormatting.RED, 16733525);
+ put(EnumChatFormatting.WHITE, 16777215);
+ put(EnumChatFormatting.YELLOW, 16777045);
+ }
+ };
+
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
+ {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
+ TileEntityDisplayer disp = (TileEntityDisplayer)te;
+ ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
+ GL11.glPushMatrix();
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ displayer.render((Entity)null, disp.ringTranslation1, disp.ringTranslation2, disp.ringTranslation3, 0.0F, 0.0F, 0.0625F);
+ try{
+ int block = disp.getBlockMetadata();
+ if (disp != null && disp.hasObject && disp.object != null && disp.object.getItem() != null && disp.object != new ItemStack(Item.getItemById(0), 0, 0)){
+ int ind = -3;
+ GL11.glPushMatrix();
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, disp.object);
+ entityitem.hoverStart = 0.0F;
+ disp.object.stackSize = 1;
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glTranslatef(0.0F, -0.6F + disp.ringTranslation1 / 5, 0F);
+ GL11.glRotatef(disp.rotAngle, 0F, 1F, 0F);
+ GL11.glColor4f(1F, 1F, 1F, 1F);
+ if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ else{
+ GL11.glRotatef(180F, 0F, 1F, 0F);
+ RenderManager.instance.options.fancyGraphics = true;
+ int i = 15728880;
+ int j = i % 65536;
+ int k = i / 65536;
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
+ }
+ EntityPlayer player = te.getWorldObj().getClosestPlayer(te.xCoord, te.yCoord, te.zCoord, 5D);
+ GL11.glPopMatrix();
+ GL11.glPushMatrix();
+ if (player != null) renderLabel(disp.object.getDisplayName(), 0F, -0.171F * ind, 0F, block, disp, colors.get(disp.object.getRarity().rarityColor));
+ GL11.glPopMatrix();
+ ind++;
+ if (player != null && disp.quantity > 1){
+ GL11.glPushMatrix();
+ renderLabel("x" + Integer.toString(disp.quantity), 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
+ GL11.glPopMatrix();
+ ind++;
+ }
+ if (disp.object.getItem() != Items.map && player != null && disp.object.getTooltip(player, true) != null){
+ List tooltips = disp.object.getTooltip(player, true);
+ if (disp.infoIndex + 5 > tooltips.size()) disp.infoIndex = 1;
+ if (tooltips.size() < 5) for(int i = 1; i < tooltips.size(); i++){
+ String tooltip = tooltips.get(i).toString();
+ RenderManager.instance.getFontRenderer();
+ if (tooltip != ""){
+ GL11.glPushMatrix();
+ renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
+ GL11.glPopMatrix();
+ ind++;
+ }
+ }
+ else for(int i = disp.infoIndex; i < disp.infoIndex + 5; i++){
+ String tooltip = tooltips.get(i).toString();
+ RenderManager.instance.getFontRenderer();
+ if (tooltip != ""){
+ GL11.glPushMatrix();
+ renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
+ GL11.glPopMatrix();
+ ind++;
+ }
+ }
+ }
+ }
+ }
+ catch(Exception e){}
+ GL11.glPopMatrix();
+ GL11.glPopMatrix();
+ }
+
+ /**
+ * @param par2Str
+ * @param x
+ * @param y
+ * @param z
+ * @param metadata
+ * @param te
+ * @param color
+ */
+ protected void renderLabel(String par2Str, double x, double y, double z, int metadata, TileEntity te, int color)
+ {
+ FontRenderer fontrenderer = RenderManager.instance.getFontRenderer();
+ float var14 = 0.01266667F * 1.5F;
+ float var17 = 0.015F;
+ GL11.glRotatef(180F, 0F, 0F, 1F);
+ if (metadata == 0) GL11.glRotatef(0F, 0F, 1F, 0F);
+ else if (metadata == 1) GL11.glRotatef(270F, 0F, 1F, 0F);
+ else if (metadata == 2) GL11.glRotatef(180F, 0F, 1F, 0F);
+ else if (metadata == 3) GL11.glRotatef(90F, 0F, 1F, 0F);
+ GL11.glTranslatef((float)x, (float)y, (float)z + 0.45F);
+ GL11.glScalef(-0.015F, -var14, 0.015F);
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ Tessellator tessellator = Tessellator.instance;
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ int j = fontrenderer.getStringWidth(par2Str) / 2;
+ tessellator.startDrawingQuads();
+ tessellator.setColorRGBA_F(0.0F, 0.2F, 0.2F, 0.9F);
+ tessellator.addVertex(-33.333 - 0, 0D, 0.1D);
+ tessellator.addVertex(-33.333 - 0, 9D, 0.1D);
+ tessellator.addVertex(33.333 + 0, 9D, 0.1D);
+ tessellator.addVertex(33.333 + 0, 0D, 0.1D);
+ tessellator.draw();
+ if (fontrenderer.getStringWidth(par2Str) / 2 > 20) var17 = 0.9F / fontrenderer.getStringWidth(par2Str);
+ else var17 = var14;
+ int red = color >> 16 & 0xFF;
+ int green = color >> 8 & 0xFF;
+ int blue = color & 0xFF;
+ GL11.glTranslatef((float)x + 1f, (float)y + 1f, (float)z);
+ GL11.glPushMatrix();
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glScalef(var17 * 70F, 1F, 0F);
+ int i = 15728880;
+ int t = i % 65536;
+ int k = i / 65536;
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, t / 1.0F, k / 1.0F);
+ fontrenderer.drawString(par2Str.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 1973790);
+ GL11.glPopMatrix();
+ GL11.glTranslatef((float)x - 1f, (float)y - 1f, (float)z - 1F);
+ GL11.glScalef(var17 * 70F, 1F, 0F);
+ fontrenderer.drawString(par2Str, -j, 0, color);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+
+ /**
+ * @param str
+ * @param color
+ */
+ public void replaceEnumEnchValues(String str, int color)
+ {
+ if (str.contains("§0")){
+ color = Color.BLACK.getRGB();
+ str.replace("§0", "");
+ }
+ if (str.contains("§1")){
+ color = 85;
+ str.replace("§1", "");
+ }
+ if (str.contains("§2")){
+ color = 17920;
+ str.replace("§2", "");
+ }
+ if (str.contains("§3")){
+ color = 1336183;
+ str.replace("§3", "");
+ }
+ if (str.contains("§4")){
+ color = 4587520;
+ str.replace("§4", "");
+ }
+ if (str.contains("§5")){
+ color = 5701759;
+ str.replace("§5", "");
+ }
+ if (str.contains("§6")){
+ color = 16762880;
+ str.replace("§6", "");
+ }
+ if (str.contains("§7")){
+ color = Color.GRAY.getRGB();
+ str.replace("§7", "");
+ }
+ if (str.contains("§8")){
+ color = Color.DARK_GRAY.getRGB();
+ str.replace("§8", "");
+ }
+ if (str.contains("§9")){
+ color = Color.BLUE.getRGB();
+ str.replace("§9", "");
+ }
+ if (str.contains("§a")){
+ color = Color.GREEN.getRGB();
+ str.replace("§a", "");
+ }
+ if (str.contains("§b")){
+ color = Color.CYAN.getRGB();
+ str.replace("§b", "");
+ }
+ if (str.contains("§c")){
+ color = Color.RED.getRGB();
+ str.replace("§c", "");
+ }
+ if (str.contains("§d")){
+ color = 11665663;
+ str.replace("§d", "");
+ }
+ if (str.contains("§e")){
+ color = Color.YELLOW.getRGB();
+ str.replace("§e", "");
+ }
+ if (str.contains("§f")){
+ color = Color.WHITE.getRGB();
+ str.replace("§f", "");
+ }
+ }
}
\ No newline at end of file diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java index 62e3945..6067e2a 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java @@ -1,139 +1,138 @@ -package darkknight.jewelrycraft.tileentity.renders; - -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -import org.lwjgl.opengl.GL11; -import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.item.ItemList; -import darkknight.jewelrycraft.model.ModelMolder; -import darkknight.jewelrycraft.tileentity.TileEntityMolder; -import darkknight.jewelrycraft.util.JewelryNBT; -import darkknight.jewelrycraft.util.Variables; - -public class TileEntityMolderRender extends TileEntitySpecialRenderer -{ - ModelMolder modelMolder = new ModelMolder(); - - /** - * @param te - * @param x - * @param y - * @param z - * @param scale - */ - @Override - public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); - TileEntityMolder me = (TileEntityMolder)te; - String texture = "textures/tileentities/Molder.png"; - ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture); - Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture); - GL11.glPushMatrix(); - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - try{ - int block = me.getBlockMetadata(); - if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); - else if (block == 2){ - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); - }else if (block == 3){ - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); - } - } - catch(Exception e){} - modelMolder.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics; - if (me != null){ - if (me.hasMold){ - GL11.glPushMatrix(); - EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.mold); - entityitem.getEntityItem().stackSize = 1; - entityitem.hoverStart = 0.0F; - GL11.glTranslatef(0F, 1.43F, -0.28F); - GL11.glScalef(1.25F, 1.0F, 1.25F); - GL11.glRotatef(90F, 1F, 0F, 0f); - Minecraft.getMinecraft().gameSettings.fancyGraphics = true; - if (entityitem != null){ - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.03D, 0.0F, 0.0F); - } - Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics; - GL11.glPopMatrix(); - } - if (me.hasJewelBase && me.jewelBase != null && me.jewelBase.getItem() != Item.getItemFromBlock(Blocks.air) && me.jewelBase.getIconIndex() != null && me.jewelBase.getIconIndex().getIconName() != ""){ - GL11.glPushMatrix(); - EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.jewelBase); - entityitem.getEntityItem().stackSize = 1; - entityitem.hoverStart = 0.0F; - GL11.glTranslatef(0F, 1.4F, -0.28F); - GL11.glScalef(1.25F, 1.0F, 1.25F); - GL11.glRotatef(90F, 1F, 0F, 0f); - Minecraft.getMinecraft().gameSettings.fancyGraphics = true; - if (entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.01D, 0.0F, 0.0F); - Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics; - GL11.glColor4f(1, 1F, 1F, 1.0F); - GL11.glPopMatrix(); - } - if (me.hasMoltenMetal && me.moltenMetal != null && me.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0)){ - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - if (JewelrycraftMod.fancyRender){ - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(1, 1, 0, 0); - } - ItemStack metal = new ItemStack(ItemList.metal); - ItemStack ingot = me.moltenMetal.copy(); - if (Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.carpet)) ingot.setItemDamage(15 - ingot.getItemDamage()); - JewelryNBT.addMetal(metal, ingot); - EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal); - moltenMetal.getEntityItem().stackSize = 1; - moltenMetal.hoverStart = 0.0F; - GL11.glTranslatef(-0F, 1.4f - 0.005f * me.quantity, -0.29F); - GL11.glScalef(1.2F, 1.0F, 1.4F); - GL11.glRotatef(90F, 1F, 0F, 0f); - RenderItem.renderInFrame = true; - RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - RenderItem.renderInFrame = false; - if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - } - GL11.glPopMatrix(); - GL11.glPopMatrix(); - } - - /** - * @param world - * @param i - * @param j - * @param k - * @param block - */ - public void adjustLightFixture(World world, int i, int j, int k, Block block) - { - Tessellator tess = Tessellator.instance; - float brightness = block.getLightOpacity(world, i, j, k); - int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); - int modulousModifier = skyLight % 65536; - int divModifier = skyLight / 65536; - tess.setColorOpaque_F(brightness, brightness, brightness); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier); - } -} +package darkknight.jewelrycraft.tileentity.renders;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.entity.RenderItem;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.World;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.model.ModelMolder;
+import darkknight.jewelrycraft.tileentity.TileEntityMolder;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.Variables;
+
+public class TileEntityMolderRender extends TileEntitySpecialRenderer
+{
+ ModelMolder modelMolder = new ModelMolder();
+
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
+ {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
+ TileEntityMolder me = (TileEntityMolder)te;
+ String texture = "textures/tileentities/Molder.png";
+ ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
+ GL11.glPushMatrix();
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ try{
+ int block = me.getBlockMetadata();
+ if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
+ else if (block == 2){
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
+ }else if (block == 3){
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
+ }
+ }
+ catch(Exception e){}
+ modelMolder.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
+ boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics;
+ if (me != null){
+ if (me.hasMold){
+ GL11.glPushMatrix();
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.mold);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+ GL11.glTranslatef(0F, 1.43F, -0.28F);
+ GL11.glScalef(1.25F, 1.0F, 1.25F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
+ if (entityitem != null){
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.03D, 0.0F, 0.0F);
+ }
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
+ GL11.glPopMatrix();
+ }
+ if (me.hasJewelBase && me.jewelBase != null && me.jewelBase.getItem() != Item.getItemFromBlock(Blocks.air) && me.jewelBase.getIconIndex() != null && me.jewelBase.getIconIndex().getIconName() != ""){
+ GL11.glPushMatrix();
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.jewelBase);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+ GL11.glTranslatef(0F, 1.4F, -0.28F);
+ GL11.glScalef(1.25F, 1.0F, 1.25F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
+ if (entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.01D, 0.0F, 0.0F);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
+ GL11.glColor4f(1, 1F, 1F, 1.0F);
+ GL11.glPopMatrix();
+ }
+ if (me.hasMoltenMetal && me.moltenMetal != null && me.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0)){
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ if (JewelrycraftMod.fancyRender){
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(1, 1, 0, 0);
+ }
+ ItemStack metal = new ItemStack(ItemList.metal);
+ ItemStack ingot = me.moltenMetal.copy();
+ JewelryNBT.addMetal(metal, ingot);
+ EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal);
+ moltenMetal.getEntityItem().stackSize = 1;
+ moltenMetal.hoverStart = 0.0F;
+ GL11.glTranslatef(-0F, 1.4f - 0.005f * me.quantity, -0.29F);
+ GL11.glScalef(1.2F, 1.0F, 1.4F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ RenderItem.renderInFrame = true;
+ RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+ if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ }
+ GL11.glPopMatrix();
+ GL11.glPopMatrix();
+ }
+
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ */
+ public void adjustLightFixture(World world, int i, int j, int k, Block block)
+ {
+ Tessellator tess = Tessellator.instance;
+ float brightness = block.getLightOpacity(world, i, j, k);
+ int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
+ int modulousModifier = skyLight % 65536;
+ int divModifier = skyLight / 65536;
+ tess.setColorOpaque_F(brightness, brightness, brightness);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java index 2892ead..3db99c8 100644 --- a/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java +++ b/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java @@ -1,126 +1,125 @@ -package darkknight.jewelrycraft.tileentity.renders; - -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import darkknight.jewelrycraft.JewelrycraftMod; -import darkknight.jewelrycraft.item.ItemList; -import darkknight.jewelrycraft.model.ModelSmelter; -import darkknight.jewelrycraft.tileentity.TileEntitySmelter; -import darkknight.jewelrycraft.util.JewelryNBT; -import darkknight.jewelrycraft.util.Variables; - -public class TileEntitySmelterRender extends TileEntitySpecialRenderer -{ - ModelSmelter modelSmelter = new ModelSmelter(); - public static final float p = 1 / 16, p3 = 3 * p, p13 = 13 * p, p15 = 15 * p; - - /** - * @param te - * @param x - * @param y - * @param z - * @param scale - */ - @Override - public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); - String texture = "textures/tileentities/Smelter.png"; - ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture); - Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture); - TileEntitySmelter st = (TileEntitySmelter)te; - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - try{ - int block = te.getBlockMetadata(); - if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); - else if (block == 2){ - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); - }else if (block == 3){ - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); - } - } - catch(Exception e){} - boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics; - modelSmelter.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - if (scale != 0){ - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - if (JewelrycraftMod.fancyRender){ - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(1, 1, 0, 0); - } - EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, new ItemStack(Blocks.lava, 1, 1)); - entityitem.hoverStart = 0.0F; - GL11.glTranslatef(-0F, 1.25F, -0.345F); - GL11.glScalef(1.2F, 1.0F, 1.7F); - GL11.glRotatef(90F, 1F, 0F, 0f); - RenderItem.renderInFrame = true; - int i = 15728880; - int j = i % 65536; - int k = i / 65536; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F); - RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - RenderItem.renderInFrame = false; - if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - if (st != null){ - if (st.hasMetal && st.metal != null && st.metal.getItem() != null){ - GL11.glPushMatrix(); - EntityItem metal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, st.metal); - metal.getEntityItem().stackSize = 1; - metal.hoverStart = 0.0F; - GL11.glRotatef(-50F, 1F, 0F, 0F); - GL11.glRotatef(-50F, 0F, 0F, 1F); - GL11.glRotatef(180F, 1F, 0F, 0F); - GL11.glScalef(0.5F, 0.5F, 0.5F); - GL11.glTranslatef(-0.9F, -0.9F, -1.6F); - Minecraft.getMinecraft().gameSettings.fancyGraphics = true; - RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics; - GL11.glPopMatrix(); - } - if (st.hasMoltenMetal && st.moltenMetal != null && st.moltenMetal.getItem() != null){ - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - if (JewelrycraftMod.fancyRender){ - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(1, 1, 0, 0); - } - ItemStack metal = new ItemStack(ItemList.metal); - ItemStack ingot = st.moltenMetal.copy(); - if (Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.carpet)) ingot.setItemDamage(15 - ingot.getItemDamage()); - JewelryNBT.addMetal(metal, ingot); - EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal); - moltenMetal.getEntityItem().stackSize = 1; - moltenMetal.hoverStart = 0.0F; - GL11.glTranslatef(-0F, 1.00f - .4F * st.quantity, -0.14F); - GL11.glScalef(0.71F, 1F, 0.84F); - GL11.glRotatef(90F, 1F, 0F, 0f); - RenderItem.renderInFrame = true; - RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); - RenderItem.renderInFrame = false; - if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } - } - GL11.glPopMatrix(); - } -} +package darkknight.jewelrycraft.tileentity.renders;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.entity.RenderItem;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.model.ModelSmelter;
+import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.Variables;
+
+public class TileEntitySmelterRender extends TileEntitySpecialRenderer
+{
+ ModelSmelter modelSmelter = new ModelSmelter();
+ public static final float p = 1 / 16, p3 = 3 * p, p13 = 13 * p, p15 = 15 * p;
+
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
+ {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
+ String texture = "textures/tileentities/Smelter.png";
+ ResourceLocation blockTexture = new ResourceLocation(Variables.MODID, texture);
+ Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
+ TileEntitySmelter st = (TileEntitySmelter)te;
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ try{
+ int block = te.getBlockMetadata();
+ if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
+ else if (block == 2){
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
+ }else if (block == 3){
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
+ }
+ }
+ catch(Exception e){}
+ boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics;
+ modelSmelter.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
+ if (scale != 0){
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ if (JewelrycraftMod.fancyRender){
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(1, 1, 0, 0);
+ }
+ EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, new ItemStack(Blocks.lava, 1, 1));
+ entityitem.hoverStart = 0.0F;
+ GL11.glTranslatef(-0F, 1.25F, -0.345F);
+ GL11.glScalef(1.2F, 1.0F, 1.7F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ RenderItem.renderInFrame = true;
+ int i = 15728880;
+ int j = i % 65536;
+ int k = i / 65536;
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+ if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ if (st != null){
+ if (st.hasMetal && st.metal != null && st.metal.getItem() != null){
+ GL11.glPushMatrix();
+ EntityItem metal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, st.metal);
+ metal.getEntityItem().stackSize = 1;
+ metal.hoverStart = 0.0F;
+ GL11.glRotatef(-50F, 1F, 0F, 0F);
+ GL11.glRotatef(-50F, 0F, 0F, 1F);
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(-0.9F, -0.9F, -1.6F);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
+ GL11.glPopMatrix();
+ }
+ if (st.hasMoltenMetal && st.moltenMetal != null && st.moltenMetal.getItem() != null){
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ if (JewelrycraftMod.fancyRender){
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(1, 1, 0, 0);
+ }
+ ItemStack metal = new ItemStack(ItemList.metal);
+ ItemStack ingot = st.moltenMetal.copy();
+ JewelryNBT.addMetal(metal, ingot);
+ EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal);
+ moltenMetal.getEntityItem().stackSize = 1;
+ moltenMetal.hoverStart = 0.0F;
+ GL11.glTranslatef(-0F, 1.00f - .4F * st.quantity, -0.14F);
+ GL11.glScalef(0.71F, 1F, 0.84F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ RenderItem.renderInFrame = true;
+ RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+ if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ }
+ GL11.glPopMatrix();
+ }
+}
|
