diff options
| author | bspkrs <bspkrs@gmail.com> | 2013-12-16 14:19:04 -0500 |
|---|---|---|
| committer | bspkrs <bspkrs@gmail.com> | 2013-12-16 14:19:04 -0500 |
| commit | f15bc9e0abff4710d9860bd970b3b6820c5e78c6 (patch) | |
| tree | 6951055018820b7e604f3825a429c91b77e9eb27 | |
| parent | 43ef55b2424eb49110e27d603adf95a84bf37560 (diff) | |
tested creation of rings with custom NBT - working!
reformatted source
11 files changed, 161 insertions, 142 deletions
diff --git a/common/darkknight/jewelrycraft/CommonProxy.java b/common/darkknight/jewelrycraft/CommonProxy.java index 923828a..04c6a94 100644 --- a/common/darkknight/jewelrycraft/CommonProxy.java +++ b/common/darkknight/jewelrycraft/CommonProxy.java @@ -1,6 +1,5 @@ package darkknight.jewelrycraft; - public class CommonProxy { public void registerRenderers() diff --git a/common/darkknight/jewelrycraft/block/BlockSmelter.java b/common/darkknight/jewelrycraft/block/BlockSmelter.java index c9cf575..d78e85a 100644 --- a/common/darkknight/jewelrycraft/block/BlockSmelter.java +++ b/common/darkknight/jewelrycraft/block/BlockSmelter.java @@ -41,7 +41,7 @@ public class BlockSmelter extends BlockContainer @Override public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int par5) - { + { TileEntitySmelter te = (TileEntitySmelter) world.getBlockTileEntity(i, j, k); if (te != null) { @@ -74,7 +74,7 @@ public class BlockSmelter extends BlockContainer @Override public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) - { + { TileEntitySmelter te = (TileEntitySmelter) world.getBlockTileEntity(i, j, k); ItemStack item = entityPlayer.inventory.getCurrentItem(); if (te != null && !world.isRemote) @@ -105,7 +105,7 @@ public class BlockSmelter extends BlockContainer @Override public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player) - { + { TileEntitySmelter te = (TileEntitySmelter) world.getBlockTileEntity(i, j, k); TileEntityMolder me = null; if (world.getBlockMetadata(i, j, k) == 0) @@ -155,7 +155,7 @@ public class BlockSmelter extends BlockContainer @Override public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack) - { + { int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; world.setBlockMetadataWithNotify(i, j, k, rotation, 2); } diff --git a/common/darkknight/jewelrycraft/config/ConfigHandler.java b/common/darkknight/jewelrycraft/config/ConfigHandler.java index 56eb42e..ab19b5b 100644 --- a/common/darkknight/jewelrycraft/config/ConfigHandler.java +++ b/common/darkknight/jewelrycraft/config/ConfigHandler.java @@ -9,23 +9,23 @@ public class ConfigHandler public static int idThiefGloves = 17493; public static int idShadowIngot = 17494; public static int idMolds = 17495; - public static int idRing = 17496; - + public static int idRing = 17496; + public static int idShadowOre = 1750; public static int idSmelter = 1751; public static int idMolder = 1752; public static int idJewelCraftingTable = 1753; - + private static boolean isInitialized = false; - + public static void preInit(FMLPreInitializationEvent e) { if (!isInitialized) { config = new Configuration(e.getSuggestedConfigurationFile()); - + config.load(); - + idThiefGloves = config.getItem("id.ThiefGloves", idThiefGloves).getInt(); idShadowIngot = config.getItem("id.ShadowIngot", idShadowIngot).getInt(); idMolds = config.getItem("id.Molds", idMolds).getInt(); @@ -34,9 +34,9 @@ public class ConfigHandler idSmelter = config.getBlock("id.Smelter", idSmelter).getInt(); idMolder = config.getBlock("id.Molder", idMolder).getInt(); idJewelCraftingTable = config.getBlock("id.JewelCraftingTable", idJewelCraftingTable).getInt(); - + config.save(); - + isInitialized = true; } } diff --git a/common/darkknight/jewelrycraft/item/ItemMolds.java b/common/darkknight/jewelrycraft/item/ItemMolds.java index 090d53a..25ebe70 100644 --- a/common/darkknight/jewelrycraft/item/ItemMolds.java +++ b/common/darkknight/jewelrycraft/item/ItemMolds.java @@ -14,10 +14,10 @@ import net.minecraft.util.MathHelper; public class ItemMolds extends Item { /** List of molds color names */ - public static final String[] moldsItemNames = new String[] {"ingot", "ring"}; + public static final String[] moldsItemNames = new String[] { "ingot", "ring" }; @SideOnly(Side.CLIENT) - private Icon[] moldsIcons; - + private Icon[] moldsIcons; + public ItemMolds(int par1) { super(par1); @@ -25,9 +25,8 @@ public class ItemMolds extends Item this.setMaxDamage(0); this.setMaxStackSize(1); } - + @SideOnly(Side.CLIENT) - /** * Gets an icon index based on an item's damage value */ @@ -36,20 +35,19 @@ public class ItemMolds extends Item int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1); return this.moldsIcons[j]; } - + /** - * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have - * different names based on their damage or NBT. + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on + * their damage or NBT. */ public String getUnlocalizedName(ItemStack par1ItemStack) { int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1); return super.getUnlocalizedName() + "." + moldsItemNames[i]; } - + @SuppressWarnings({ "unchecked", "rawtypes" }) @SideOnly(Side.CLIENT) - /** * returns a list of items with the same ID, but different meta (eg: molds returns 16 items) */ @@ -60,12 +58,12 @@ public class ItemMolds extends Item par3List.add(new ItemStack(par1, 1, j)); } } - + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.moldsIcons = new Icon[moldsItemNames.length]; - + for (int i = 0; i < moldsItemNames.length; ++i) { this.moldsIcons[i] = par1IconRegister.registerIcon("jewelrycraft:" + moldsItemNames[i] + this.getIconString()); diff --git a/common/darkknight/jewelrycraft/item/ItemThiefGloves.java b/common/darkknight/jewelrycraft/item/ItemThiefGloves.java index 5e43010..ff934a9 100644 --- a/common/darkknight/jewelrycraft/item/ItemThiefGloves.java +++ b/common/darkknight/jewelrycraft/item/ItemThiefGloves.java @@ -23,6 +23,7 @@ import net.minecraft.village.MerchantRecipeList; public class ItemThiefGloves extends ItemBase { public Random rand; + public ItemThiefGloves(int par1) { super(par1); @@ -38,27 +39,31 @@ public class ItemThiefGloves extends ItemBase EntityVillager villager = (EntityVillager) par3EntityLivingBase; int wealth = (Integer) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "wealth", "field_70956_bz"); MerchantRecipeList buyingList = (MerchantRecipeList) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "buyingList", "field_70963_i"); - if(buyingList!=null) + if (buyingList != null) { Iterator<?> iterator = buyingList.iterator(); - while(iterator.hasNext()) + while (iterator.hasNext()) { - MerchantRecipe recipe = (MerchantRecipe)iterator.next(); + MerchantRecipe recipe = (MerchantRecipe) iterator.next(); int toolUses = (Integer) ReflectionHelper.getPrivateValue(MerchantRecipe.class, recipe, "toolUses", "field_77400_d"); int quantity; - if(recipe.getItemToSell().isStackable()) quantity = recipe.getItemToSell().stackSize * (7 - toolUses); - else quantity = 1; + if (recipe.getItemToSell().isStackable()) + quantity = recipe.getItemToSell().stackSize * (7 - toolUses); + else + quantity = 1; ItemStack s = new ItemStack(recipe.getItemToSell().itemID, quantity, recipe.getItemToSell().getItemDamage()); s.setTagCompound(recipe.getItemToSell().getTagCompound()); - if(par2EntityPlayer.inventory.addItemStackToInventory(s)); - else villager.entityDropItem(s, 0); + if (par2EntityPlayer.inventory.addItemStackToInventory(s)) + ; + else + villager.entityDropItem(s, 0); par2EntityPlayer.addChatMessage("Villager #" + villager.getProfession() + ": Hmmm... I seem to have lost my " + s.getDisplayName() + "!"); - } + } buyingList.clear(); ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 300, "timeUntilReset", "field_70961_j"); ReflectionHelper.setPrivateValue(EntityVillager.class, villager, true, "needsInitilization", "field_70959_by"); - } - + } + villager.dropItem(Item.emerald.itemID, wealth); ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 0, "wealth", "field_70956_bz"); return true; @@ -68,11 +73,14 @@ public class ItemThiefGloves extends ItemBase return super.itemInteractionForEntity(par1ItemStack, par2EntityPlayer, par3EntityLivingBase); } } + @SuppressWarnings("unchecked") public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { - if(!shouldAddAdditionalInfo()) list.add(EnumChatFormatting.GRAY + additionalInfoInstructions()); - else{ + if (!shouldAddAdditionalInfo()) + list.add(EnumChatFormatting.GRAY + additionalInfoInstructions()); + else + { list.add(EnumChatFormatting.GRAY + "Right click with the gloves,"); list.add(EnumChatFormatting.GRAY + "while sneaking, on a villager"); list.add(EnumChatFormatting.GRAY + "to steal his stuff."); @@ -90,8 +98,7 @@ public class ItemThiefGloves extends ItemBase } return false; } - - + public static String additionalInfoInstructions() { String message = "§oPress §b<SHIFT>§7§o for more information."; diff --git a/common/darkknight/jewelrycraft/model/ModelMolder.java b/common/darkknight/jewelrycraft/model/ModelMolder.java index 172d593..374b218 100644 --- a/common/darkknight/jewelrycraft/model/ModelMolder.java +++ b/common/darkknight/jewelrycraft/model/ModelMolder.java @@ -12,12 +12,12 @@ public class ModelMolder extends ModelBase ModelRenderer Side1; ModelRenderer Side2; ModelRenderer Side3; - + public ModelMolder() { textureWidth = 64; textureHeight = 32; - + Base = new ModelRenderer(this, 0, 0); Base.addBox(0F, 0F, 0F, 10, 1, 10); Base.setRotationPoint(-5F, 23F, -5F); @@ -49,7 +49,7 @@ public class ModelMolder extends ModelBase Side3.mirror = true; setRotation(Side3, 0F, 0F, 0F); } - + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); @@ -60,17 +60,17 @@ public class ModelMolder extends ModelBase Side2.render(f5); Side3.render(f5); } - + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } - + } diff --git a/common/darkknight/jewelrycraft/model/ModelSmelter.java b/common/darkknight/jewelrycraft/model/ModelSmelter.java index 2e71dac..afb3b09 100644 --- a/common/darkknight/jewelrycraft/model/ModelSmelter.java +++ b/common/darkknight/jewelrycraft/model/ModelSmelter.java @@ -37,12 +37,12 @@ public class ModelSmelter extends ModelBase ModelRenderer HeatSourceSide10; ModelRenderer HeatSourceSide11; ModelRenderer HeatSourceSide12; - + public ModelSmelter() { textureWidth = 64; textureHeight = 32; - + Support1 = new ModelRenderer(this, 0, 0); Support1.addBox(0F, 0F, 0F, 2, 15, 3); Support1.setRotationPoint(6F, 9F, -1F); @@ -224,7 +224,7 @@ public class ModelSmelter extends ModelBase HeatSourceSide12.mirror = true; setRotation(HeatSourceSide12, 0F, 0F, 0F); } - + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); @@ -260,17 +260,17 @@ public class ModelSmelter extends ModelBase HeatSourceSide11.render(f5); HeatSourceSide12.render(f5); } - + private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } - + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5, null); } - + } diff --git a/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java b/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java index 054cabd..2d40bf0 100644 --- a/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java +++ b/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java @@ -18,25 +18,25 @@ import net.minecraft.world.World; public class TileEntityMolderRender extends TileEntitySpecialRenderer { ModelMolder modelMolder = new ModelMolder(); - String texture = "textures/tileentities/Molder.png"; - + String texture = "textures/tileentities/Molder.png"; + @Override - public void renderTileEntityAt (TileEntity te, double x, double y, double z, float scale) + 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; - + TileEntityMolder me = (TileEntityMolder) te; + ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture); Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture); Tessellator tessellator = Tessellator.instance; - + GL11.glPushMatrix(); - GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - modelMolder.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - if(me != null) + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + modelMolder.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); + if (me != null) { - if(me.hasMold) + if (me.hasMold) { String name = me.mold.getDisplayName().substring(0, 1).toLowerCase() + me.mold.getDisplayName().trim().substring(1).replace(" M", "M"); String texture = "textures/items/" + name + ".png"; @@ -44,34 +44,36 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer Minecraft.getMinecraft().renderEngine.bindTexture(lava); me.mold.getIconIndex().getInterpolatedU(0); int decal = 0; - if(me.mold.getItemDamage() == 0) decal = 32; - else if(me.mold.getItemDamage() > 0) decal = 64; + if (me.mold.getItemDamage() == 0) + decal = 32; + else if (me.mold.getItemDamage() > 0) + decal = 64; double minu = me.mold.getIconIndex().getInterpolatedU(16); double minv = me.mold.getIconIndex().getInterpolatedV(-decal); - double maxu = me.mold.getIconIndex().getInterpolatedU(256+16); - double maxv = me.mold.getIconIndex().getInterpolatedV(256-decal); + double maxu = me.mold.getIconIndex().getInterpolatedU(256 + 16); + double maxv = me.mold.getIconIndex().getInterpolatedV(256 - decal); GL11.glPushMatrix(); - GL11.glScalef(1f/16f, 1f/16f, 1f/16f); + GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f); GL11.glDisable(GL11.GL_LIGHTING); - - for(float f = 0; f <= 2; f+=0.01) + + for (float f = 0; f <= 2; f += 0.01) { - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(5, 21+f, 5, minu, minv); - tessellator.addVertexWithUV(-5, 21+f, 5, maxu, minv); - tessellator.addVertexWithUV(-5, 21+f, -5, maxu, maxv); - tessellator.addVertexWithUV(5, 21+f, -5, minu, maxv); + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(5, 21 + f, 5, minu, minv); + tessellator.addVertexWithUV(-5, 21 + f, 5, maxu, minv); + tessellator.addVertexWithUV(-5, 21 + f, -5, maxu, maxv); + tessellator.addVertexWithUV(5, 21 + f, -5, minu, maxv); tessellator.draw(); } - GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } } GL11.glPopMatrix(); GL11.glPopMatrix(); } - - public void adjustLightFixture (World world, int i, int j, int k, Block block) + + public void adjustLightFixture(World world, int i, int j, int k, Block block) { Tessellator tess = Tessellator.instance; float brightness = block.getBlockBrightness(world, i, j, k); @@ -81,6 +83,5 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer tess.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier); } - - + } diff --git a/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java b/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java index 48e5353..616919d 100644 --- a/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java +++ b/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java @@ -18,49 +18,53 @@ import net.minecraft.world.World; public class TileEntitySmelterRender extends TileEntitySpecialRenderer { ModelSmelter modelSmelter = new ModelSmelter(); - String texture = "textures/tileentities/Smelter.png", lava = "texture/blocks/lava_still.png"; - + String texture = "textures/tileentities/Smelter.png", lava = "texture/blocks/lava_still.png"; + @Override - public void renderTileEntityAt (TileEntity te, double x, double y, double z, float scale) + 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); - + ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture); Tessellator tessellator = Tessellator.instance; ResourceLocation lava = new ResourceLocation(null, "textures/blocks/lava_still.png"); Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture); int block = te.getBlockMetadata(); - + GL11.glPushMatrix(); - if(block == 0) GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); - else if(block == 1) GL11.glRotatef(180F, 1F, 0.0F, 1F); - else if(block == 2) GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); - else if(block == 3) GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); + if (block == 0) + GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); + else if (block == 1) + GL11.glRotatef(180F, 1F, 0.0F, 1F); + else if (block == 2) + GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); + else if (block == 3) + GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); - modelSmelter.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); + modelSmelter.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); Minecraft.getMinecraft().renderEngine.bindTexture(lava); Block.lavaStill.getIcon(3, 0).getInterpolatedU(0); double minu = Block.lavaStill.getIcon(3, 0).getInterpolatedU(0); - double minv = Block.lavaStill.getIcon(3, 0).getInterpolatedV(((TileEntitySmelter)te).flow); + double minv = Block.lavaStill.getIcon(3, 0).getInterpolatedV(((TileEntitySmelter) te).flow); double maxu = Block.lavaStill.getIcon(3, 0).getInterpolatedU(256); - double maxv = Block.lavaStill.getIcon(3, 0).getInterpolatedV(16 + ((TileEntitySmelter)te).flow); + double maxv = Block.lavaStill.getIcon(3, 0).getInterpolatedV(16 + ((TileEntitySmelter) te).flow); GL11.glPushMatrix(); - GL11.glScalef(1f/16f, 1f/16f, 1f/16f); + GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f); GL11.glDisable(GL11.GL_LIGHTING); - tessellator.startDrawingQuads(); + tessellator.startDrawingQuads(); tessellator.addVertexWithUV(5, 20, 6, minu, minv); tessellator.addVertexWithUV(-5, 20, 6, maxu, minv); tessellator.addVertexWithUV(-5, 20, -6, maxu, maxv); tessellator.addVertexWithUV(5, 20, -6, minu, maxv); - + tessellator.addVertexWithUV(-4, 20, -7, maxu, maxv); tessellator.addVertexWithUV(4, 20, -7, maxu, minv); tessellator.addVertexWithUV(4, 20, -6, minu, minv); tessellator.addVertexWithUV(-4, 20, -6, minu, maxv); - + tessellator.addVertexWithUV(4, 20, 7, maxu, maxv); tessellator.addVertexWithUV(-4, 20, 7, maxu, minv); tessellator.addVertexWithUV(-4, 20, 6, minu, minv); @@ -72,8 +76,8 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer GL11.glPopMatrix(); GL11.glPopMatrix(); } - - public void adjustLightFixture (World world, int i, int j, int k, Block block) + + public void adjustLightFixture(World world, int i, int j, int k, Block block) { Tessellator tess = Tessellator.instance; float brightness = block.getBlockBrightness(world, i, j, k); @@ -83,6 +87,5 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer tess.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier); } - - + } diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java index 600bc0f..5f60c3f 100644 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java +++ b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java @@ -13,7 +13,7 @@ public class TileEntityMolder extends TileEntity public int cooling; public boolean hasMoltenMetal, hasJewelBase, hasMold; public ItemStack mold, jewelBase, moltenMetal, ringMetal; - + public TileEntityMolder() { this.moltenMetal = new ItemStack(0, 0, 0); @@ -25,7 +25,7 @@ public class TileEntityMolder extends TileEntity this.hasMoltenMetal = false; this.hasMold = false; } - + @Override public void writeToNBT(NBTTagCompound nbt) { @@ -47,7 +47,7 @@ public class TileEntityMolder extends TileEntity this.ringMetal.writeToNBT(tag2); nbt.setCompoundTag("ringMetal", tag3); } - + @Override public void readFromNBT(NBTTagCompound nbt) { @@ -65,40 +65,43 @@ public class TileEntityMolder extends TileEntity this.ringMetal = new ItemStack(0, 0, 0); this.ringMetal.readFromNBT(nbt.getCompoundTag("ringMetal")); } - + public void updateEntity() { super.updateEntity(); - if(moltenMetal.itemID != 0) - { - this.worldObj.playSoundEffect((double)((float)xCoord + 0.5F), (double)((float)yCoord + 0.5F), (double)((float)zCoord + 0.5F), "random.fizz", 0.5F, 2.6F + 0.2F * 0.8F); + if (moltenMetal.itemID != 0) + { + this.worldObj.playSoundEffect((double) ((float) xCoord + 0.5F), (double) ((float) yCoord + 0.5F), (double) ((float) zCoord + 0.5F), "random.fizz", 0.5F, 2.6F + 0.2F * 0.8F); for (int l = 0; l < 2; ++l) { //EntityFX entityfx = new EntityReddustFX(this.worldObj, (double)xCoord + Math.random(), (double)yCoord + 0.2D, (double)zCoord + Math.random(), 0.0F, 0.0F, 0.0F); - this.worldObj.spawnParticle("reddust", (double)xCoord + Math.random(), (double)yCoord + 0.2F, (double)zCoord + Math.random(), 0.0D, 1.0D, 1.0D); + this.worldObj.spawnParticle("reddust", (double) xCoord + Math.random(), (double) yCoord + 0.2F, (double) zCoord + Math.random(), 0.0D, 1.0D, 1.0D); } } - if(this.hasMoltenMetal && !this.hasJewelBase) - { + if (this.hasMoltenMetal && !this.hasJewelBase) + { ringMetal = moltenMetal; - if(cooling > 0) this.cooling--; - if(cooling == 0) + if (cooling > 0) + this.cooling--; + if (cooling == 0) { this.hasMoltenMetal = false; - if(mold.getItemDamage() == 0) this.jewelBase = moltenMetal; - else this.jewelBase = new ItemStack(ItemList.ring); + if (mold.getItemDamage() == 0) + this.jewelBase = moltenMetal; + else + this.jewelBase = new ItemStack(ItemList.ring); this.moltenMetal = new ItemStack(0, 0, 0); this.hasJewelBase = true; } } } - + public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) { readFromNBT(pkt.data); } - - public Packet getDescriptionPacket() + + public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java index 85503c9..514d879 100644 --- a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java +++ b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java @@ -10,20 +10,20 @@ import net.minecraft.tileentity.TileEntity; public class TileEntitySmelter extends TileEntity { - public int melting, flow, n=0, p=0; + public int melting, flow, n = 0, p = 0; public boolean hasMetal, hasMoltenMetal; public ItemStack metal, moltenMetal; - + public TileEntitySmelter() { this.melting = 0; this.flow = 0; this.hasMetal = false; - this.hasMoltenMetal= false; + this.hasMoltenMetal = false; this.metal = new ItemStack(0, 0, 0); this.moltenMetal = new ItemStack(0, 0, 0); } - + @Override public void writeToNBT(NBTTagCompound nbt) { @@ -38,7 +38,7 @@ public class TileEntitySmelter extends TileEntity this.moltenMetal.writeToNBT(tag1); nbt.setCompoundTag("moltenMetal", tag1); } - + @Override public void readFromNBT(NBTTagCompound nbt) { @@ -51,40 +51,48 @@ public class TileEntitySmelter extends TileEntity this.moltenMetal = new ItemStack(0, 0, 0); this.moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal")); } - + public void updateEntity() { super.updateEntity(); Random rand = new Random(); - if(p>0)--p; - else p=5; - if(n == 0 && p == 0){ - flow+=16; - if(flow >= 16*20) n=1; + 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 (n == 1 && p == 0) + { + flow -= 16; + if (flow <= 0) + n = 0; } - if(this.melting > 0) - { + if (this.melting > 0) + { for (int l = 0; l < 5; ++l) { //EntityFX entityfx = new EntityReddustFX(this.worldObj, (double)xCoord + Math.random(), (double)yCoord + 0.2D, (double)zCoord + Math.random(), 0.0F, 0.0F, 0.0F); - this.worldObj.spawnParticle("flame", (double)xCoord, (double)yCoord + 1.5F, (double)zCoord, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle("flame", (double) xCoord, (double) yCoord + 1.5F, (double) zCoord, 0.0D, 0.0D, 0.0D); } } - if(rand.nextInt(65) == 0){ - double d5 = (double)((float)this.xCoord + rand.nextFloat()); - double d7 = (double)this.yCoord; - double d6 = (double)((float)this.zCoord + rand.nextFloat()); + if (rand.nextInt(65) == 0) + { + double d5 = (double) ((float) this.xCoord + rand.nextFloat()); + double d7 = (double) this.yCoord; + double d6 = (double) ((float) this.zCoord + rand.nextFloat()); //this.worldObj.spawnParticle("lava", d5, d7, d6, 0.0D, 0.0D, 0.0D); this.worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false); } - if(this.hasMetal) - { - if(melting > 0) this.melting--; - if(melting == 0) + if (this.hasMetal) + { + if (melting > 0) + this.melting--; + if (melting == 0) { this.hasMetal = false; this.moltenMetal = metal; @@ -93,8 +101,8 @@ public class TileEntitySmelter extends TileEntity } } } - - public Packet getDescriptionPacket() + + public Packet getDescriptionPacket() { NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); |
