diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2013-12-22 02:07:29 +0200 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2013-12-22 02:07:29 +0200 |
| commit | b01cf1aa1d3480ad52ee7940f213596bfe6a2090 (patch) | |
| tree | 75a1c11a4fb4b84297d9dd6b691575e003a37a82 | |
| parent | 6e9f023d2a5d272640149c85a36c7aa05845a984 (diff) | |
Could it be? Could I have fixed it?
6 files changed, 102 insertions, 73 deletions
diff --git a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java index 282e483..c30e78c 100644 --- a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java +++ b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java @@ -24,8 +24,8 @@ import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable; public class BlockJewelrsCraftingTable extends BlockContainer { Random rand = new Random(); - int modifiers[] = new int[] { Item.blazePowder.itemID }; - int effects[] = new int[] { 12 }; + ItemStack modifiers[] = new ItemStack[] { new ItemStack(Item.blazePowder), new ItemStack(Item.diamond), new ItemStack(Item.sugar), new ItemStack(Item.slimeBall)}; + int effects[] = new int[] { Potion.fireResistance.id, Potion.digSpeed.id, Potion.moveSpeed.id, Potion.jump.id}; protected BlockJewelrsCraftingTable(int par1, Material par2Material) { @@ -60,13 +60,21 @@ public class BlockJewelrsCraftingTable extends BlockContainer if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; entityPlayer.inventory.onInventoryChanged(); } - if (!te.hasEndItem && !te.hasModifier && item != null && item.getItem().itemID == modifiers[0]) + if (!te.hasEndItem && !te.hasModifier && item != null) { - te.modifier = item.copy(); - te.modifier.stackSize = 1; - te.hasModifier = true; - if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; - entityPlayer.inventory.onInventoryChanged(); + int itemIndex = -1; + for(int q=0; q < modifiers.length; q++) + if (item.itemID == modifiers[q].itemID && item.getItemDamage() == modifiers[q].getItemDamage()) + itemIndex = q; + if(itemIndex != -1) + { + te.modifier = item.copy(); + te.modifier.stackSize = 1; + te.effect = effects[itemIndex]; + te.hasModifier = true; + if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize; + entityPlayer.inventory.onInventoryChanged(); + } } if(te.timer == 0 && !te.hasEndItem && te.hasJewel && te.hasModifier) te.timer = ConfigHandler.jewelryCraftingTime; if(te.hasEndItem && item != null) entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.hasenditem")); @@ -114,7 +122,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer { if (item != null) { - ItemRing.addEffect(item, Potion.fireResistance.id); + ItemRing.addEffect(item, cf.effect); dropItem(cf.worldObj, (double)cf.xCoord, (double)cf.yCoord, (double)cf.zCoord, item.copy()); } } diff --git a/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java b/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java index a24fb88..b222d83 100644 --- a/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java +++ b/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java @@ -18,7 +18,7 @@ public class CraftingRecipes if (!isInitialized) { GameRegistry.addRecipe(new ItemStack(ItemList.thiefGloves), "x x", "yxy", "yxy", 'x', ItemList.shadowIngot, 'y', new ItemStack(Block.cloth, 1, 15)); - GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 0), "xx", "xx", 'x', Item.clay); + GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 0), "xx", 'x', Item.clay); GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 1), " x ", "x x", " x ", 'x', Item.clay); GameRegistry.addRecipe(new ItemStack(BlockList.molder), "x x", "xxx", 'x', Block.cobblestone); GameRegistry.addRecipe(new ItemStack(BlockList.smelter), "xyx", "x x", "xzx", 'x', Block.cobblestone, 'y', Item.bucketEmpty, 'z', Item.bucketLava); diff --git a/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java b/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java index 51cfe03..aca01aa 100644 --- a/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java +++ b/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java @@ -10,8 +10,12 @@ 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.item.ItemBlock; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -37,73 +41,94 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer modelMolder.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); if (me != null) { + 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"; +// ResourceLocation lava = new ResourceLocation("jewelrycraft", texture); +// Minecraft.getMinecraft().renderEngine.bindTexture(lava); +// double minu = me.mold.getIconIndex().getInterpolatedU(16D); +// double minv = me.mold.getIconIndex().getInterpolatedV(-96D); +// double maxu = me.mold.getIconIndex().getInterpolatedU(16.0D * 256D); +// double maxv = me.mold.getIconIndex().getInterpolatedV(-96.0D * 256D); +// GL11.glDisable(GL11.GL_LIGHTING); +// GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f); +// GL11.glRotatef(180F, 0F, 1F, 0F); + //GL11.glRotatef(90F, 1, 0F, 0F); +// GL11.glEnable(GL11.GL_LIGHTING); +// 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.draw(); +// } + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_LIGHTING); + EntityItem entityitem = new EntityItem(te.worldObj, 0.0D, 0.0D, 0.0D, me.mold); + entityitem.getEntityItem().stackSize = 1; + entityitem.hoverStart = 0.0F; + GL11.glTranslatef(0F, 1.312F, -0.25F); + GL11.glScalef(1.25F, 1.0F, 1.25F); + GL11.glRotatef(90F, 1F, 0F, 0f); + RenderItem.renderInFrame = true; + RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + RenderItem.renderInFrame = false; + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glPopMatrix(); + } if (me.hasJewelBase) { if(me.jewelBase.getIconIndex().getIconName() != "") { - String domain = ""; - if(me.jewelBase.getIconIndex().getIconName().substring(0, me.jewelBase.getIconIndex().getIconName().indexOf(":") + 1) != "") - domain = me.jewelBase.getIconIndex().getIconName().substring(0, me.jewelBase.getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim(); - else - domain = "minecraft"; - String texture = me.jewelBase.getIconIndex().getIconName().substring(me.jewelBase.getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png"; - ResourceLocation lava = new ResourceLocation(domain, "textures/items/" + texture); - Minecraft.getMinecraft().renderEngine.bindTexture(lava); - double minu = me.jewelBase.getIconIndex().getInterpolatedU(16D); - double minv = me.jewelBase.getIconIndex().getInterpolatedV(-96D); - double maxu = me.jewelBase.getIconIndex().getInterpolatedU(16.0D * 256D); - double maxv = me.jewelBase.getIconIndex().getInterpolatedV(-96.0D * 256D); +// String domain = ""; +// if(me.jewelBase.getIconIndex().getIconName().substring(0, me.jewelBase.getIconIndex().getIconName().indexOf(":") + 1) != "") +// domain = me.jewelBase.getIconIndex().getIconName().substring(0, me.jewelBase.getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim(); +// else +// domain = "minecraft"; +// String texture = me.jewelBase.getIconIndex().getIconName().substring(me.jewelBase.getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png"; +// ResourceLocation lava = new ResourceLocation(domain, "textures/items/" + texture); +// Minecraft.getMinecraft().renderEngine.bindTexture(lava); +// double minu = me.jewelBase.getIconIndex().getInterpolatedU(16D); +// double minv = me.jewelBase.getIconIndex().getInterpolatedV(-96D); +// double maxu = me.jewelBase.getIconIndex().getInterpolatedU(16.0D * 256D); +// double maxv = me.jewelBase.getIconIndex().getInterpolatedV(-96.0D * 256D); + +// GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f); +// GL11.glRotatef(180F, 0F, 1F, 0F); +// int color = me.jewelBase.getItem().getColorFromItemStack(me.jewelBase, 0); +// float red = (float)(color >> 16 & 255) / 255.0F; +// float green = (float)(color >> 8 & 255) / 255.0F; +// float blue = (float)(color & 255) / 255.0F; +// if(!me.jewelBase.getDisplayName().contains("Ingot")) GL11.glColor4f(red, green, blue, 1F); +// for(float f = 0; f <= 0.3; f+=0.01) +// { +// tessellator.startDrawingQuads(); +// tessellator.addVertexWithUV(5, 20.8 + f, 5, minu, minv); +// tessellator.addVertexWithUV(-5, 20.8 + f, 5, maxu, minv); +// tessellator.addVertexWithUV(-5, 20.8 + f, -5, maxu, maxv); +// tessellator.addVertexWithUV(5, 20.8 + f, -5, minu, maxv); +// tessellator.draw(); +// } GL11.glPushMatrix(); - GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f); - GL11.glRotatef(180F, 0F, 1F, 0F); GL11.glDisable(GL11.GL_LIGHTING); ItemRing.addMetal(me.jewelBase, me.ringMetal); - int color = me.jewelBase.getItem().getColorFromItemStack(me.jewelBase, 0); - float red = (float)(color >> 16 & 255) / 255.0F; - float green = (float)(color >> 8 & 255) / 255.0F; - float blue = (float)(color & 255) / 255.0F; - if(!me.jewelBase.getDisplayName().contains("Ingot")) GL11.glColor4f(red, green, blue, 1F); - for(float f = 0; f <= 0.3; f+=0.01) - { - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(5, 20.8 + f, 5, minu, minv); - tessellator.addVertexWithUV(-5, 20.8 + f, 5, maxu, minv); - tessellator.addVertexWithUV(-5, 20.8 + f, -5, maxu, maxv); - tessellator.addVertexWithUV(5, 20.8 + f, -5, minu, maxv); - tessellator.draw(); - } + EntityItem entityitem = new EntityItem(te.worldObj, 0.0D, 0.0D, 0.0D, me.jewelBase); + entityitem.getEntityItem().stackSize = 1; + entityitem.hoverStart = 0.0F; + GL11.glTranslatef(0F, 1.312F, -0.25F); + GL11.glScalef(1.25F, 1.0F, 1.25F); + GL11.glRotatef(90F, 1F, 0F, 0f); + RenderItem.renderInFrame = true; + RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); + RenderItem.renderInFrame = false; GL11.glColor4f(1, 1F, 1F, 1.0F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } } - 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"; - ResourceLocation lava = new ResourceLocation("jewelrycraft", texture); - Minecraft.getMinecraft().renderEngine.bindTexture(lava); - double minu = me.mold.getIconIndex().getInterpolatedU(16D); - double minv = me.mold.getIconIndex().getInterpolatedV(-96D); - double maxu = me.mold.getIconIndex().getInterpolatedU(16.0D * 256D); - double maxv = me.mold.getIconIndex().getInterpolatedV(-96.0D * 256D); - GL11.glPushMatrix(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f); - GL11.glRotatef(180F, 0F, 1F, 0F); - - 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.draw(); - } - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glPopMatrix(); - } } GL11.glPopMatrix(); GL11.glPopMatrix(); diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java index 10fd05d..6eb2212 100644 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java +++ b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java @@ -11,7 +11,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity { public boolean hasJewel, hasModifier, hasEndItem, isDirty; public ItemStack jewel, modifier, endItem; - public int timer; + public int timer, effect; public TileEntityJewelrsCraftingTable() { @@ -22,6 +22,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity this.hasModifier = false; this.hasEndItem = false; this.timer = 0; + this.effect = 0; this.isDirty = false; } @@ -33,6 +34,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity nbt.setBoolean("hasModifier", hasModifier); nbt.setBoolean("hasEndItem", hasEndItem); nbt.setInteger("timer", timer); + nbt.setInteger("effect", effect); NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag1 = new NBTTagCompound(); NBTTagCompound tag2 = new NBTTagCompound(); @@ -52,6 +54,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity this.hasModifier = nbt.getBoolean("hasModifier"); this.hasEndItem = nbt.getBoolean("hasEndItem"); this.timer = nbt.getInteger("timer"); + this.effect = nbt.getInteger("effect"); this.jewel = new ItemStack(0, 0, 0); this.jewel.readFromNBT(nbt.getCompoundTag("jewel")); this.modifier = new ItemStack(0, 0, 0); diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java index 608ceb9..d25d369 100644 --- a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java +++ b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java @@ -79,10 +79,7 @@ public class TileEntityMolder extends TileEntity { if(worldObj.rand.nextInt(20) == 0) this.worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.fizz", 0.5F, 1F); 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", xCoord + Math.random(), (double) yCoord + 0.2F, zCoord + Math.random(), 0.0D, 1.0D, 1.0D); - } } if (this.hasMoltenMetal && !this.hasJewelBase) { diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java index d86b4b9..ff396de 100644 --- a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java +++ b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java @@ -82,17 +82,13 @@ public class TileEntitySmelter extends TileEntity if (this.hasMetal) { 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("flame", xCoord + rand.nextFloat(), (double) yCoord + 0.3F, zCoord + rand.nextFloat(), 0.0D, 0.0D, 0.0D); - } } if (rand.nextInt(65) == 0) { double d5 = this.xCoord + rand.nextFloat(); double d7 = this.yCoord; double d6 = 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) |
