summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-23 22:03:06 +0200
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-23 22:03:06 +0200
commit198677e5b01009a65d243da1d25a14f879df659c (patch)
tree512da4c4fbccc40fdcfc79a6f6cbf0f4eb0efd50
parentb01cf1aa1d3480ad52ee7940f213596bfe6a2090 (diff)
Changed lots of stuff, added new features. Ender Rings!!!
-rw-r--r--common/darkknight/jewelrycraft/JewelrycraftMod.java3
-rw-r--r--common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java163
-rw-r--r--common/darkknight/jewelrycraft/block/BlockMolder.java26
-rw-r--r--common/darkknight/jewelrycraft/block/BlockSmelter.java1
-rw-r--r--common/darkknight/jewelrycraft/config/ConfigHandler.java4
-rw-r--r--common/darkknight/jewelrycraft/item/ItemRing.java210
-rw-r--r--common/darkknight/jewelrycraft/item/ItemThiefGloves.java6
-rw-r--r--common/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java223
-rw-r--r--common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java100
-rw-r--r--common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java93
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java54
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java3
-rw-r--r--common/darkknight/jewelrycraft/util/JewelryNBT.java73
-rw-r--r--resources/assets/jewelrycraft/lang/en_US.lang10
-rw-r--r--resources/assets/jewelrycraft/textures/items/jewel.pngbin0 -> 244 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/ring.pngbin267 -> 272 bytes
16 files changed, 584 insertions, 385 deletions
diff --git a/common/darkknight/jewelrycraft/JewelrycraftMod.java b/common/darkknight/jewelrycraft/JewelrycraftMod.java
index ae8a229..b4c9c9d 100644
--- a/common/darkknight/jewelrycraft/JewelrycraftMod.java
+++ b/common/darkknight/jewelrycraft/JewelrycraftMod.java
@@ -22,6 +22,7 @@ import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.common.registry.GameRegistry;
+import darkknight.jewelrycraft.block.BlockJewelrsCraftingTable;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.client.JewelryCraftClient;
import darkknight.jewelrycraft.config.ConfigHandler;
@@ -77,7 +78,7 @@ public class JewelrycraftMod implements IConnectionHandler
@EventHandler
public void postInit(FMLPostInitializationEvent e)
{
-
+ BlockJewelrsCraftingTable.addStuff();
}
@Override
diff --git a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
index c30e78c..c9372a9 100644
--- a/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
+++ b/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
@@ -1,7 +1,10 @@
package darkknight.jewelrycraft.block;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.Random;
+import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@@ -10,7 +13,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.potion.Potion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
@@ -18,14 +20,15 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.item.ItemList;
-import darkknight.jewelrycraft.item.ItemRing;
import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
public class BlockJewelrsCraftingTable extends BlockContainer
{
- Random rand = new Random();
- 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};
+ Random rand = new Random();
+
+ public static ArrayList<ItemStack> modifiers = new ArrayList<ItemStack>();
+ public static ArrayList<ItemStack> jewel = new ArrayList<ItemStack>();
+ public static ArrayList<ItemStack> jewelry = new ArrayList<ItemStack>();
protected BlockJewelrsCraftingTable(int par1, Material par2Material)
{
@@ -33,6 +36,24 @@ public class BlockJewelrsCraftingTable extends BlockContainer
this.setBlockBounds(0.0F, 0F, 0.0F, 1.0F, 0.8F, 1.0F);
}
+ public static void addStuff()
+ {
+ //Modifiers
+ modifiers.add(new ItemStack(Item.blazePowder));
+ modifiers.add(new ItemStack(Item.sugar));
+ modifiers.add(new ItemStack(Block.chest));
+ modifiers.add(new ItemStack(Item.pickaxeIron));
+
+ //Jewels
+ jewel.add(new ItemStack(Item.enderPearl));
+ jewel.add(new ItemStack(Item.diamond));
+ jewel.add(new ItemStack(Item.emerald));
+ jewel.add(new ItemStack(Block.obsidian));
+
+ //Jewelry
+ jewelry.add(new ItemStack(ItemList.ring));
+ }
+
@Override
public TileEntity createNewTileEntity(World world)
{
@@ -53,43 +74,74 @@ public class BlockJewelrsCraftingTable extends BlockContainer
if (te != null && !world.isRemote)
{
te.isDirty = true;
- if (!te.hasEndItem && !te.hasJewel && item != null && item.getItem().itemID == ItemList.ring.itemID)
+ if (!te.hasEndItem && !te.hasJewelry && item != null && isJewelry(item))
{
- te.jewel = item.copy();
- te.hasJewel = true;
- if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
- entityPlayer.inventory.onInventoryChanged();
+ if(te.hasModifier && te.hasJewel && item.hasTagCompound() && item.getTagCompound().hasKey("modifier") && item.getTagCompound().hasKey("jewel"))
+ entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.jewelrymodifiedfull"));
+ else if(te.hasJewel && item.hasTagCompound() && item.getTagCompound().hasKey("jewel"))
+ entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.jewelrycontainsjewel"));
+ else if(te.hasModifier && item.hasTagCompound() && item.getTagCompound().hasKey("modifier"))
+ entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.jewelrycontainsmodifier"));
+ else
+ {
+ te.jewelry = item.copy();
+ te.hasJewelry = true;
+ if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ entityPlayer.inventory.onInventoryChanged();
+ }
}
- if (!te.hasEndItem && !te.hasModifier && item != null)
+ if (!te.hasEndItem && !te.hasModifier && item != null && isModifier(item))
{
- 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)
+ if(te.hasJewelry && te.jewelry.hasTagCompound() && te.jewelry.getTagCompound().hasKey("modifier"))
+ entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.jewelrycontainsmodifier"));
+ else
{
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"));
+ if (!te.hasEndItem && !te.hasJewel && item != null && isJewel(item))
+ {
+ if(te.hasJewelry && te.jewelry.hasTagCompound() && te.jewelry.getTagCompound().hasKey("jewel"))
+ entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.jewelrycontainsjewel"));
+ else
+ {
+ te.jewel = item.copy();
+ te.jewel.stackSize = 1;
+ te.hasJewel = true;
+ if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ entityPlayer.inventory.onInventoryChanged();
+ }
+ }
+ if (te.timer <= 0 && !te.hasEndItem && te.hasJewelry && (te.hasModifier || te.hasJewel)){ te.timer = ConfigHandler.jewelryCraftingTime; te.angle = 0;}
+ if (te.hasEndItem && item != null) entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.hasenditem"));
if (te.hasModifier && entityPlayer.isSneaking())
{
- dropItem( world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.modifier.copy());
+ dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.modifier.copy());
te.modifier = new ItemStack(0, 0, 0);
te.hasModifier = false;
+ te.timer = 0;
+ te.angle = 0F;
+ }
+ if (te.hasJewelry && entityPlayer.isSneaking())
+ {
+ dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy());
+ te.jewelry = new ItemStack(0, 0, 0);
+ te.hasJewelry = false;
+ te.timer = 0;
+ te.angle = 0F;
}
if (te.hasJewel && entityPlayer.isSneaking())
{
- dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.jewel.copy());
+ dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewel.copy());
te.jewel = new ItemStack(0, 0, 0);
te.hasJewel = false;
+ te.timer = 0;
+ te.angle = 0F;
}
te.isDirty = true;
world.setBlockTileEntity(i, j, k, te);
@@ -97,6 +149,45 @@ public class BlockJewelrsCraftingTable extends BlockContainer
return true;
}
+ public boolean isModifier(ItemStack item)
+ {
+ Iterator<ItemStack> i = modifiers.iterator();
+
+ while (i.hasNext())
+ {
+ ItemStack temp = i.next();
+ if (temp.itemID == item.itemID && temp.getItemDamage() == item.getItemDamage())
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isJewel(ItemStack item)
+ {
+ Iterator<ItemStack> i = jewel.iterator();
+
+ while (i.hasNext())
+ {
+ ItemStack temp = i.next();
+ if (temp.itemID == item.itemID && temp.getItemDamage() == item.getItemDamage())
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isJewelry(ItemStack item)
+ {
+ Iterator<ItemStack> i = jewelry.iterator();
+
+ while (i.hasNext())
+ {
+ ItemStack temp = i.next();
+ if (temp.itemID == item.itemID && temp.getItemDamage() == item.getItemDamage())
+ return true;
+ }
+ return false;
+ }
+
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);
@@ -111,22 +202,14 @@ public class BlockJewelrsCraftingTable extends BlockContainer
TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getBlockTileEntity(i, j, k);
if (te != null)
{
- if(te.hasModifier) dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.modifier.copy());
- if(te.hasJewel) dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.jewel.copy());
- if(te.hasEndItem) giveJewelToPlayer(te, te.endItem, te.modifier);
+ if (te.hasModifier) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.modifier.copy());
+ if (te.hasJewelry) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy());
+ if (te.hasJewel) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewel.copy());
+ if (te.hasEndItem) dropItem(te.worldObj, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy());
}
super.breakBlock(world, i, j, k, par5, par6);
}
- public void giveJewelToPlayer(TileEntityJewelrsCraftingTable cf, ItemStack item, ItemStack modifier)
- {
- if (item != null)
- {
- ItemRing.addEffect(item, cf.effect);
- dropItem(cf.worldObj, (double)cf.xCoord, (double)cf.yCoord, (double)cf.zCoord, item.copy());
- }
- }
-
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -142,18 +225,14 @@ public class BlockJewelrsCraftingTable extends BlockContainer
{
if (te.hasEndItem)
{
- giveJewelToPlayer(te, te.endItem, te.modifier);
+ dropItem(te.worldObj, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy());
te.endItem = new ItemStack(0, 0, 0);
te.hasEndItem = false;
}
- else if (te.hasJewel && te.hasModifier && te.timer > 0 && te.jewel != null)
- player.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.table.iscrafting", te.jewel.getDisplayName()) + " (" + ((ConfigHandler.jewelryCraftingTime - te.timer)*100/ConfigHandler.jewelryCraftingTime) + "%)");
- else if (!te.hasModifier && !te.hasJewel)
- player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingjewelryandmodifier"));
- else if (!te.hasJewel)
- player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.misingjewelry"));
- else if (!te.hasModifier)
- player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingmodifier"));
+ else if (te.hasJewelry && (te.hasModifier || te.hasJewel) && te.timer > 0 && te.jewelry != null) player.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.table.iscrafting", te.jewelry.getDisplayName()) + " (" + ((ConfigHandler.jewelryCraftingTime - te.timer) * 100 / ConfigHandler.jewelryCraftingTime) + "%)");
+ else if ((!te.hasModifier || !te.hasJewel) && !te.hasJewelry) player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingjewelryandmodifierorjewel"));
+ else if (!te.hasJewelry) player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingjewelry"));
+ else if (!te.hasModifier || !te.hasJewel) player.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.table.missingmodifierorjewel"));
te.isDirty = true;
}
}
diff --git a/common/darkknight/jewelrycraft/block/BlockMolder.java b/common/darkknight/jewelrycraft/block/BlockMolder.java
index cd4b83b..cae036e 100644
--- a/common/darkknight/jewelrycraft/block/BlockMolder.java
+++ b/common/darkknight/jewelrycraft/block/BlockMolder.java
@@ -5,16 +5,17 @@ import java.util.Random;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.item.ItemList;
-import darkknight.jewelrycraft.item.ItemRing;
import darkknight.jewelrycraft.tileentity.TileEntityMolder;
public class BlockMolder extends BlockContainer
@@ -54,13 +55,14 @@ public class BlockMolder extends BlockContainer
entityPlayer.addChatMessage(StatCollector.translateToLocalFormatted("chatmessage.jewelrycraft.molder.addedmold", te.mold.getDisplayName()));
te.isDirty = true;
}
- if (te.hasMold && entityPlayer.isSneaking())
+ if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal)
{
dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.mold.copy());
te.mold = new ItemStack(0, 0, 0);
te.hasMold = false;
te.isDirty = true;
}
+ else if(te.hasMoltenMetal) entityPlayer.addChatMessage(StatCollector.translateToLocal("chatmessage.jewelrycraft.molder.hasmoltenmetal"));
}
return true;
}
@@ -80,24 +82,18 @@ public class BlockMolder extends BlockContainer
if (te != null)
{
- if(te.hasJewelBase) giveJewelToPlayer(te, te.jewelBase, te.ringMetal);
+ if(te.hasJewelBase) dropItem(te.worldObj, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.jewelBase.copy());
if(te.hasMold) dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.mold.copy());
}
super.breakBlock(world, i, j, k, par5, par6);
}
-
- public void giveJewelToPlayer(TileEntityMolder md, ItemStack item, ItemStack metal)
+
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
- if (item != null)
- {
- if (item.itemID == ItemList.ring.itemID && metal != null)
- {
- ItemRing.addMetal(item, metal);
- }
- dropItem(md.worldObj, (double)md.xCoord, (double)md.yCoord, (double)md.zCoord, item.copy());
- md.isDirty = true;
- }
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
@Override
@@ -108,7 +104,7 @@ public class BlockMolder extends BlockContainer
{
if (me.hasJewelBase)
{
- giveJewelToPlayer(me, me.jewelBase, me.ringMetal);
+ dropItem(me.worldObj, (double)me.xCoord, (double)me.yCoord, (double)me.zCoord, me.jewelBase.copy());
me.jewelBase = new ItemStack(0, 0, 0);
me.hasJewelBase = false;
}
diff --git a/common/darkknight/jewelrycraft/block/BlockSmelter.java b/common/darkknight/jewelrycraft/block/BlockSmelter.java
index 23b9275..c762005 100644
--- a/common/darkknight/jewelrycraft/block/BlockSmelter.java
+++ b/common/darkknight/jewelrycraft/block/BlockSmelter.java
@@ -84,6 +84,7 @@ public class BlockSmelter extends BlockContainer
{
dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy());
te.hasMetal = false;
+ te.melting = 0;
}
world.setBlockTileEntity(i, j, k, te);
te.isDirty = true;
diff --git a/common/darkknight/jewelrycraft/config/ConfigHandler.java b/common/darkknight/jewelrycraft/config/ConfigHandler.java
index e4b87f5..a4b2b27 100644
--- a/common/darkknight/jewelrycraft/config/ConfigHandler.java
+++ b/common/darkknight/jewelrycraft/config/ConfigHandler.java
@@ -9,13 +9,13 @@ 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 = 17498;
public static int idClayMolds = 17497;
public static int idShadowOre = 1750;
public static int idSmelter = 1751;
public static int idMolder = 1752;
- public static int idJewelCraftingTable = 1753;
+ public static int idJewelCraftingTable = 1754;
public static int ingotCoolingTime = 200;
public static int ingotMeltingTime = 1500;
diff --git a/common/darkknight/jewelrycraft/item/ItemRing.java b/common/darkknight/jewelrycraft/item/ItemRing.java
index 3368032..268a6aa 100644
--- a/common/darkknight/jewelrycraft/item/ItemRing.java
+++ b/common/darkknight/jewelrycraft/item/ItemRing.java
@@ -8,66 +8,118 @@ import javax.imageio.ImageIO;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.util.JewelryNBT;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.resources.ResourceManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
public class ItemRing extends ItemBase
{
+ public Icon jewel;
+ private int amplifier;
+
public ItemRing(int par1)
{
super(par1);
this.setMaxStackSize(1);
}
+ public void registerIcons(IconRegister iconRegister)
+ {
+ itemIcon = iconRegister.registerIcon("jewelrycraft:ring");
+ jewel = iconRegister.registerIcon("jewelrycraft:jewel");
+ }
+
+ public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
+ {
+ if (stack.hasTagCompound() && stack.getTagCompound().hasKey("jewel")) return getIcon(stack, 1);
+ return getIcon(stack, 0);
+ }
+
+ @Override
+ public Icon getIconFromDamageForRenderPass(int damage, int pass)
+ {
+ return pass == 0 ? super.getIconFromDamageForRenderPass(damage, pass) : jewel;
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
@SideOnly(Side.CLIENT)
- public int getColorFromItemStack(ItemStack par1ItemStack, int par2)
+ public int getColorFromItemStack(ItemStack par1ItemStack, int pass)
{
try
{
- return color(par1ItemStack);
+ if(par1ItemStack != null) return color(par1ItemStack, pass);
}
catch (IOException e)
{
e.printStackTrace();
}
- return 0;
+ return 16777215;
}
- public static int color(ItemStack stack) throws IOException
+ public static int color(ItemStack stack, int pass) throws IOException
{
- if (stack.hasTagCompound())
+ if (pass == 0 && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingot"))
{
- if (stack.getTagCompound().hasKey("ingot"))
+ NBTTagCompound ingotNBT = (NBTTagCompound) stack.getTagCompound().getTag("ingot");
+ ItemStack ingotStack = new ItemStack(0, 0, 0);
+ ingotStack.readFromNBT(ingotNBT);
+ if(ingotStack.getIconIndex().getIconName() != "")
{
- NBTTagCompound ingotNBT = (NBTTagCompound) stack.getTagCompound().getTag("ingot");
- ItemStack ingotStack = new ItemStack(0, 0, 0);
- ingotStack.readFromNBT(ingotNBT);
- if(ingotStack.getIconIndex().getIconName() != "")
- {
- String domain = "";
- if(ingotStack.getIconIndex().getIconName().substring(0, ingotStack.getIconIndex().getIconName().indexOf(":") + 1) != "")
- domain = ingotStack.getIconIndex().getIconName().substring(0, ingotStack.getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim();
- else
- domain = "minecraft";
- String texture = ingotStack.getIconIndex().getIconName().substring(ingotStack.getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png";
- ResourceLocation lava = new ResourceLocation(domain, "textures/items/" + texture);
- ResourceManager rm = Minecraft.getMinecraft().getResourceManager();
- BufferedImage bufferedimage = ImageIO.read(rm.getResource(lava).getInputStream());
- return bufferedimage.getRGB(8, 8);
- }
+ String domain = "";
+ if(ingotStack.getIconIndex().getIconName().substring(0, ingotStack.getIconIndex().getIconName().indexOf(":") + 1) != "")
+ domain = ingotStack.getIconIndex().getIconName().substring(0, ingotStack.getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim();
+ else
+ domain = "minecraft";
+ String texture = ingotStack.getIconIndex().getIconName().substring(ingotStack.getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png";
+ ResourceLocation ingot = null;
+ if(ingotStack.getUnlocalizedName().contains("item")) ingot = new ResourceLocation(domain, "textures/items/" + texture);
+ else ingot = new ResourceLocation(domain, "textures/blocks/" + texture);
+ ResourceManager rm = Minecraft.getMinecraft().getResourceManager();
+ BufferedImage bufferedimage = ImageIO.read(rm.getResource(ingot).getInputStream());
+ return bufferedimage.getRGB(9, 9);
}
}
- return 0;
+ if (pass == 1 && stack.hasTagCompound() && stack.getTagCompound().hasKey("jewel"))
+ {
+ NBTTagCompound ingotNBT = (NBTTagCompound) stack.getTagCompound().getTag("jewel");
+ ItemStack ingotStack = new ItemStack(0, 0, 0);
+ ingotStack.readFromNBT(ingotNBT);
+ if(ingotStack != null && ingotStack != new ItemStack(0, 0, 0) && ingotStack.getIconIndex().getIconName() != "")
+ {
+ String domain = "";
+ if(ingotStack.getIconIndex().getIconName().substring(0, ingotStack.getIconIndex().getIconName().indexOf(":") + 1) != "")
+ domain = ingotStack.getIconIndex().getIconName().substring(0, ingotStack.getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim();
+ else
+ domain = "minecraft";
+ String texture = ingotStack.getIconIndex().getIconName().substring(ingotStack.getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png";
+ ResourceLocation jewel = null;
+ if(ingotStack.getUnlocalizedName().contains("item")) jewel = new ResourceLocation(domain, "textures/items/" + texture);
+ else jewel = new ResourceLocation(domain, "textures/blocks/" + texture);
+ ResourceManager rm = Minecraft.getMinecraft().getResourceManager();
+ BufferedImage bufferedimage = ImageIO.read(rm.getResource(jewel).getInputStream());
+ return bufferedimage.getRGB(9, 4);
+ }
+ }
+ return 16777215;
}
public String getItemDisplayName(ItemStack stack)
@@ -85,34 +137,35 @@ public class ItemRing extends ItemBase
return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
}
- public static void addMetal(ItemStack item, ItemStack metal)
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
- NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
- else
- {
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- NBTTagCompound ingotNBT = new NBTTagCompound();
- metal.writeToNBT(ingotNBT);
- itemStackData.setTag("ingot", ingotNBT);
- }
-
- public static void addEffect(ItemStack item, int potion)
- {
- NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
- else
+ if (stack.hasTagCompound())
{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
+ if(stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z"))
+ {
+ NBTTagCompound x = (NBTTagCompound) stack.getTagCompound().getTag("x");
+ NBTTagCompound y = (NBTTagCompound) stack.getTagCompound().getTag("y");
+ NBTTagCompound z = (NBTTagCompound) stack.getTagCompound().getTag("z");
+ double posX = 0, posY = 0, posZ = 0;
+ posX = x.getDouble("x");
+ posY = y.getDouble("y");
+ posZ = z.getDouble("z");
+ for(int i = 1; i <= 20; i++)
+ world.spawnParticle("largesmoke", player.posX - 0.5D + Math.random(), player.posY - 1.5D + Math.random(), player.posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ player.setPositionAndUpdate(posX, posY, posZ);
+ for(int i = 1; i <= 300; i++)
+ world.spawnParticle("portal", posX - 0.5D + Math.random(), posY + Math.random(), posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ }
+ if(stack.getTagCompound().hasKey("jewel"))
+ {
+ NBTTagCompound jewelNBT = (NBTTagCompound) stack.getTagCompound().getTag("jewel");
+ ItemStack jewel = new ItemStack(0, 0, 0);
+ jewel.readFromNBT(jewelNBT);
+ if(jewel.itemID == Item.enderPearl.itemID && !stack.getTagCompound().hasKey("x") && !stack.getTagCompound().hasKey("y") && !stack.getTagCompound().hasKey("z"))
+ JewelryNBT.addCoordonates(stack, player.posX, player.posY, player.posZ);
+ }
}
- NBTTagCompound potionNBT = new NBTTagCompound();
- potionNBT.setInteger("potion", potion);
- itemStackData.setTag("potion", potionNBT);
+ return stack;
}
/**
@@ -124,20 +177,43 @@ public class ItemRing extends ItemBase
{
if (stack.hasTagCompound())
{
- if (stack.getTagCompound().hasKey("ingot"))
+ if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("ingot"))
{
NBTTagCompound ingotNBT = (NBTTagCompound) stack.getTagCompound().getTag("ingot");
ItemStack ingotStack = new ItemStack(0, 0, 0);
ingotStack.readFromNBT(ingotNBT);
- list.add(EnumChatFormatting.GRAY + ingotStack.getDisplayName());
+ if(ingotStack != null && ingotStack != new ItemStack(0, 0, 0) && ingotStack.getDisplayName() != null)
+ list.add("Ingot: " + EnumChatFormatting.YELLOW + ingotStack.getDisplayName());
+ }
+
+ if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("jewel"))
+ {
+ NBTTagCompound jewelNBT = (NBTTagCompound) stack.getTagCompound().getTag("jewel");
+ ItemStack jewel = new ItemStack(0, 0, 0);
+ jewel.readFromNBT(jewelNBT);
+ if(jewel != null && jewel != new ItemStack(0, 0, 0) && jewel.getDisplayName() != null)
+ list.add("Jewel: " + EnumChatFormatting.BLUE + jewel.getDisplayName());
}
- if (stack.getTagCompound().hasKey("potion"))
+ if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("modifier"))
{
- NBTTagCompound potionNBT = (NBTTagCompound) stack.getTagCompound().getTag("potion");
- int potion = 0;
- potion = potionNBT.getInteger("potion");
- list.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal(new PotionEffect(potion, 4).getEffectName()));
+ NBTTagCompound modifierNBT = (NBTTagCompound) stack.getTagCompound().getTag("modifier");
+ ItemStack modifier = new ItemStack(0, 0, 0);
+ modifier.readFromNBT(modifierNBT);
+ if(modifier != null && modifier != new ItemStack(0, 0, 0) && modifier.getDisplayName() != null)
+ list.add("Modifier: " + EnumChatFormatting.DARK_PURPLE + modifier.getDisplayName());
+ }
+
+ if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("x") && stack.getTagCompound().hasKey("y") && stack.getTagCompound().hasKey("z"))
+ {
+ NBTTagCompound x = (NBTTagCompound) stack.getTagCompound().getTag("x");
+ NBTTagCompound y = (NBTTagCompound) stack.getTagCompound().getTag("y");
+ NBTTagCompound z = (NBTTagCompound) stack.getTagCompound().getTag("z");
+ double posX = 0, posY = 0, posZ = 0;
+ posX = x.getDouble("x");
+ posY = y.getDouble("y");
+ posZ = z.getDouble("z");
+ list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int)posX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int)posY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int)posZ);
}
}
}
@@ -145,17 +221,31 @@ public class ItemRing extends ItemBase
@Override
public void onUpdate(ItemStack stack, World par2World, Entity par3Entity, int par4, boolean par5)
{
+ amplifier = 0;
if (stack.hasTagCompound())
{
- if(stack.getTagCompound().hasKey("potion"))
+ if(stack.getTagCompound().hasKey("jewel"))
+ {
+ NBTTagCompound jewelNBT = (NBTTagCompound) stack.getTagCompound().getTag("jewel");
+ ItemStack jewel = new ItemStack(0, 0, 0);
+ jewel.readFromNBT(jewelNBT);
+ if(jewel.itemID == Item.diamond.itemID) amplifier = 1;
+ if(jewel.itemID == Item.emerald.itemID) amplifier = 2;
+ }
+ if(stack.getTagCompound().hasKey("modifier"))
{
if (par3Entity instanceof EntityPlayer)
{
EntityPlayer entityplayer = (EntityPlayer)par3Entity;
- NBTTagCompound potionNBT = (NBTTagCompound) stack.getTagCompound().getTag("potion");
- int potion = 0;
- potion = potionNBT.getInteger("potion");
- if(potion != 0 && entityplayer != null) entityplayer.addPotionEffect(new PotionEffect(potion, 4));
+ NBTTagCompound modifierNBT = (NBTTagCompound) stack.getTagCompound().getTag("modifier");
+ ItemStack modifier = new ItemStack(0, 0, 0);
+ modifier.readFromNBT(modifierNBT);
+ if(modifier.itemID == Item.blazePowder.itemID && entityplayer != null)
+ entityplayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 4, amplifier));
+ if(modifier.itemID == Item.sugar.itemID && entityplayer != null)
+ entityplayer.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 4, amplifier));
+ if(modifier.itemID == Item.pickaxeIron.itemID && entityplayer != null)
+ entityplayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 4, amplifier));
}
}
}
diff --git a/common/darkknight/jewelrycraft/item/ItemThiefGloves.java b/common/darkknight/jewelrycraft/item/ItemThiefGloves.java
index 705a81c..19f1a1e 100644
--- a/common/darkknight/jewelrycraft/item/ItemThiefGloves.java
+++ b/common/darkknight/jewelrycraft/item/ItemThiefGloves.java
@@ -29,10 +29,11 @@ public class ItemThiefGloves extends ItemBase
super(par1);
this.setCreativeTab(CreativeTabs.tabTools);
this.setMaxStackSize(1);
+ this.setMaxDamage(10);
}
@Override
- public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase)
+ public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase)
{
if (par3EntityLivingBase instanceof EntityVillager)
{
@@ -58,6 +59,7 @@ public class ItemThiefGloves extends ItemBase
else
villager.entityDropItem(s, 0);
par2EntityPlayer.addChatMessage("Villager #" + villager.getProfession() + ": Hmmm... I seem to have lost my " + s.getDisplayName() + "!");
+ stack.damageItem(1, par2EntityPlayer);
}
buyingList.clear();
ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 300, "timeUntilReset", "field_70961_j");
@@ -70,7 +72,7 @@ public class ItemThiefGloves extends ItemBase
}
else
{
- return super.itemInteractionForEntity(par1ItemStack, par2EntityPlayer, par3EntityLivingBase);
+ return super.itemInteractionForEntity(stack, par2EntityPlayer, par3EntityLivingBase);
}
}
diff --git a/common/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java b/common/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java
index e68699b..ec5271b 100644
--- a/common/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java
+++ b/common/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java
@@ -2,17 +2,16 @@ package darkknight.jewelrycraft.renders;
import org.lwjgl.opengl.GL11;
-import darkknight.jewelrycraft.item.ItemRing;
import darkknight.jewelrycraft.model.ModelJewlersCraftingBench;
import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
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.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.entity.item.EntityItem;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@@ -30,7 +29,6 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- Tessellator tessellator = Tessellator.instance;
int block = te.getBlockMetadata();
TileEntityJewelrsCraftingTable jt = (TileEntityJewelrsCraftingTable)te;
@@ -47,152 +45,105 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
modelTable.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- //GL11.glTranslatef(0.05F, 0F, -0.5F);
if (jt != null)
{
- if (jt.hasJewel)
+ if (jt.hasJewelry && jt.jewelry.getIconIndex().getIconName() != "")
{
- if(jt.jewel.getIconIndex().getIconName() != "")
- {
- String domain = "";
- if(jt.jewel.getIconIndex().getIconName().substring(0, jt.jewel.getIconIndex().getIconName().indexOf(":") + 1) != "")
- domain = jt.jewel.getIconIndex().getIconName().substring(0, jt.jewel.getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim();
- else
- domain = "minecraft";
- String texture = jt.jewel.getIconIndex().getIconName().substring(jt.jewel.getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png";
- ResourceLocation lava = new ResourceLocation(domain, "textures/items/" + texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(lava);
- jt.jewel.getIconIndex().getInterpolatedU(0);
- double minu = jt.jewel.getIconIndex().getInterpolatedU(0);
- double minv = jt.jewel.getIconIndex().getInterpolatedV(-64);
- double maxu = jt.jewel.getIconIndex().getInterpolatedU(256);
- double maxv = jt.jewel.getIconIndex().getInterpolatedV(256 - 64);
- GL11.glPushMatrix();
- GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f);
- GL11.glDisable(GL11.GL_LIGHTING);
- if (jt.jewel.hasTagCompound())
- {
- if (jt.jewel.getTagCompound().hasKey("ingot"))
- {
- NBTTagCompound ingotNBT = (NBTTagCompound) jt.jewel.getTagCompound().getTag("ingot");
- ItemStack ingotStack = new ItemStack(0, 0, 0);
- ingotStack.readFromNBT(ingotNBT);
- ItemRing.addMetal(jt.jewel, ingotStack);
- int color = jt.jewel.getItem().getColorFromItemStack(jt.jewel, 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(!jt.jewel.getDisplayName().contains("Ingot")) GL11.glColor4f(red, green, blue, 1F);
- }
- }
- tessellator.startDrawingQuads();
- for(float f=0; f<=1; f+=0.1){
- tessellator.addVertexWithUV(3, 9, -5+f, minu, minv);
- tessellator.addVertexWithUV(-2.2, 9, -5+f, maxu, minv);
- tessellator.addVertexWithUV(-2.2, 14, -5+f, maxu, maxv);
- tessellator.addVertexWithUV(3, 14, -5+f, minu, maxv);
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ EntityItem entityitem = new EntityItem(te.worldObj, 0.0D, 0.0D, 0.0D, jt.jewelry);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
- tessellator.addVertexWithUV(-3, 9, -5+f, minu, minv);
- tessellator.addVertexWithUV(2.2, 9, -5+f, maxu, minv);
- tessellator.addVertexWithUV(2.2, 14, -5+f, maxu, maxv);
- tessellator.addVertexWithUV(-3, 14, -5+f, minu, maxv);
- }
- tessellator.draw();
- GL11.glColor4f(1, 1F, 1F, 1.0F);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(0.05F, -1.6F, 0.5F);
+ GL11.glRotatef(jt.angle, 0F, 1F, 0F);
+ 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;
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
}
+
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
}
- if (jt.hasEndItem)
+ if (jt.hasEndItem && jt.endItem.getIconIndex().getIconName() != "")
{
- if(jt.endItem.getIconIndex().getIconName() != "")
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ EntityItem entityitem = new EntityItem(te.worldObj, 0.0D, 0.0D, 0.0D, jt.endItem);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(0.05F, -1.6F, 0.5F);
+ GL11.glRotatef(jt.angle, 0F, 1F, 0F);
+ if(RenderManager.instance.options.fancyGraphics)
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ else
{
- String domain = "";
- if(jt.endItem.getIconIndex().getIconName().substring(0, jt.endItem.getIconIndex().getIconName().indexOf(":") + 1) != "")
- domain = jt.endItem.getIconIndex().getIconName().substring(0, jt.endItem.getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim();
- else
- domain = "minecraft";
- String texture = jt.endItem.getIconIndex().getIconName().substring(jt.endItem.getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png";
- ResourceLocation lava = new ResourceLocation(domain, "textures/items/" + texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(lava);
- jt.endItem.getIconIndex().getInterpolatedU(0);
- double minu = jt.endItem.getIconIndex().getInterpolatedU(0);
- double minv = jt.endItem.getIconIndex().getInterpolatedV(-64);
- double maxu = jt.endItem.getIconIndex().getInterpolatedU(256);
- double maxv = jt.endItem.getIconIndex().getInterpolatedV(256 - 64);
- GL11.glPushMatrix();
- GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f);
- GL11.glDisable(GL11.GL_LIGHTING);
- if (jt.endItem.hasTagCompound())
- {
- if (jt.endItem.getTagCompound().hasKey("ingot"))
- {
- NBTTagCompound ingotNBT = (NBTTagCompound) jt.endItem.getTagCompound().getTag("ingot");
- ItemStack ingotStack = new ItemStack(0, 0, 0);
- ingotStack.readFromNBT(ingotNBT);
- ItemRing.addMetal(jt.endItem, ingotStack);
- int color = jt.endItem.getItem().getColorFromItemStack(jt.endItem, 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(!jt.endItem.getDisplayName().contains("Ingot")) GL11.glColor4f(red, green, blue, 1F);
- }
- }
- tessellator.startDrawingQuads();
- for(float f=0; f<=1; f+=0.001){
- tessellator.addVertexWithUV(3, 9, -5+f, minu, minv);
- tessellator.addVertexWithUV(-2.2, 9, -5+f, maxu, minv);
- tessellator.addVertexWithUV(-2.2, 14, -5+f, maxu, maxv);
- tessellator.addVertexWithUV(3, 14, -5+f, minu, maxv);
+ GL11.glRotatef(180F, 0F, 1F, 0F);
+ RenderManager.instance.options.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
+ }
- tessellator.addVertexWithUV(-3, 9, -5+f, minu, minv);
- tessellator.addVertexWithUV(2.2, 9, -5+f, maxu, minv);
- tessellator.addVertexWithUV(2.2, 14, -5+f, maxu, maxv);
- tessellator.addVertexWithUV(-3, 14, -5+f, minu, maxv);
- }
- tessellator.draw();
- GL11.glColor4f(1, 1F, 1F, 1.0F);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ if (jt.hasModifier && jt.modifier.getIconIndex().getIconName() != "")
+ {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ EntityItem entityitem = new EntityItem(te.worldObj, 0.0D, 0.0D, 0.0D, jt.modifier);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(0.6F, -1.5F, -0.4F);
+ GL11.glRotatef(jt.angle, 0F, 1F, 0F);
+ 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;
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
}
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
}
- if (jt.hasModifier)
+ if (jt.hasJewel && jt.jewel.getIconIndex().getIconName() != "")
{
- if(jt.modifier.getIconIndex().getIconName() != "")
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ EntityItem entityitem = new EntityItem(te.worldObj, 0.0D, 0.0D, 0.0D, jt.jewel);
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+
+ GL11.glRotatef(180F, 1F, 0F, 0F);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glTranslatef(-0.6F, -1.5F, -0.4F);
+ GL11.glRotatef(jt.angle, 0F, 1F, 0F);
+ if(RenderManager.instance.options.fancyGraphics)
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ else
{
- String domain = "";
- if(jt.modifier.getIconIndex().getIconName().substring(0, jt.modifier.getIconIndex().getIconName().indexOf(":") + 1) != "")
- domain = jt.modifier.getIconIndex().getIconName().substring(0, jt.modifier.getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim();
- else
- domain = "minecraft";
- String texture = jt.modifier.getIconIndex().getIconName().substring(jt.modifier.getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png";
- ResourceLocation lava = new ResourceLocation(domain, "textures/items/" + texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(lava);
- jt.modifier.getIconIndex().getInterpolatedU(0);
- double minu = jt.modifier.getIconIndex().getInterpolatedU(-64);
- double minv = jt.modifier.getIconIndex().getInterpolatedV(0);
- double maxu = jt.modifier.getIconIndex().getInterpolatedU(256-64);
- double maxv = jt.modifier.getIconIndex().getInterpolatedV(256);
- GL11.glPushMatrix();
- GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f);
- GL11.glDisable(GL11.GL_LIGHTING);
- tessellator.startDrawingQuads();
- for(float f=0; f<=1; f+=0.001){
- tessellator.addVertexWithUV(8, 7.5, 3+f, minu, minv);
- tessellator.addVertexWithUV(2.8, 7.5, 3+f, maxu, minv);
- tessellator.addVertexWithUV(2.8, 13, 3+f, maxu, maxv);
- tessellator.addVertexWithUV(8, 13, 3+f, minu, maxv);
-
- tessellator.addVertexWithUV(2, 7.5, 3+f, minu, minv);
- tessellator.addVertexWithUV(7.2, 7.5, 3+f, maxu, minv);
- tessellator.addVertexWithUV(7.2, 13, 3+f, maxu, maxv);
- tessellator.addVertexWithUV(2, 13, 3+f, minu, maxv);
- }
- tessellator.draw();
- GL11.glColor4f(1, 1F, 1F, 1.0F);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
+ GL11.glRotatef(180F, 0F, 1F, 0F);
+ RenderManager.instance.options.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.options.fancyGraphics = false;
}
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
}
}
diff --git a/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java b/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
index aca01aa..c9480ce 100644
--- a/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
+++ b/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
@@ -2,7 +2,6 @@ package darkknight.jewelrycraft.renders;
import org.lwjgl.opengl.GL11;
-import darkknight.jewelrycraft.item.ItemRing;
import darkknight.jewelrycraft.model.ModelMolder;
import darkknight.jewelrycraft.tileentity.TileEntityMolder;
@@ -15,7 +14,6 @@ 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;
@@ -34,37 +32,24 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- Tessellator tessellator = Tessellator.instance;
+ int block = me.getBlockMetadata();
GL11.glPushMatrix();
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ if (block == 0)
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ else if (block == 1){
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
+ }
+ 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);
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);
@@ -79,55 +64,22 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
- if (me.hasJewelBase)
+ if (me.hasJewelBase && me.jewelBase.getIconIndex().getIconName() != "")
{
- 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);
-
-// 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.glDisable(GL11.GL_LIGHTING);
- ItemRing.addMetal(me.jewelBase, me.ringMetal);
- 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();
- }
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ 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();
}
}
GL11.glPopMatrix();
diff --git a/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java b/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
index 2c00726..c878317 100644
--- a/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
+++ b/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
@@ -9,8 +9,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.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@@ -18,20 +22,19 @@ 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";
+
@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);
-
+
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);
+ TileEntitySmelter st = (TileEntitySmelter)te;
int block = te.getBlockMetadata();
-
+
GL11.glPushMatrix();
if (block == 0)
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
@@ -43,42 +46,62 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
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);
-
- 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 maxu = Block.lavaStill.getIcon(3, 0).getInterpolatedU(256);
- double maxv = Block.lavaStill.getIcon(3, 0).getInterpolatedV(16 + ((TileEntitySmelter) te).flow);
+
GL11.glPushMatrix();
- GL11.glScalef(1f / 16f, 1f / 16f, 1f / 16f);
GL11.glDisable(GL11.GL_LIGHTING);
-
- 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);
- tessellator.addVertexWithUV(4, 20, 6, minu, maxv);
- tessellator.draw();
+ EntityItem entityitem = new EntityItem(te.worldObj, 0.0D, 0.0D, 0.0D, new ItemStack(Block.lavaStill));
+ entityitem.getEntityItem().stackSize = 1;
+ entityitem.hoverStart = 0.0F;
+
+ GL11.glTranslatef(-0F, 1.25F, -0.3F);
+ GL11.glScalef(1.25F, 1.0F, 1.47F);
+ 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.glTranslatef(0F, 0.46F, 0.0F);
+ GL11.glScalef(0.8F, 0.1F, 0F);
+ RenderItem.renderInFrame = true;
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+
+ GL11.glTranslatef(0F, -5.6F, 0.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 (st != null)
+ {
+ if (st.hasMetal && st.metal.getIconIndex().getIconName() != "")
+ {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ EntityItem metal = new EntityItem(te.worldObj, 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);
+ RenderItem.renderInFrame = true;
+ for(double d=0; d<=0.05; d+=0.01)
+ RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D - d, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
+ }
+
GL11.glPopMatrix();
GL11.glPopMatrix();
}
-
+
public void adjustLightFixture(World world, int i, int j, int k, Block block)
{
Tessellator tess = Tessellator.instance;
@@ -89,5 +112,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/TileEntityJewelrsCraftingTable.java b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
index 6eb2212..a0e71ef 100644
--- a/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
+++ b/common/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
@@ -1,5 +1,7 @@
package darkknight.jewelrycraft.tileentity;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.util.JewelryNBT;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
@@ -9,20 +11,24 @@ import net.minecraft.tileentity.TileEntity;
public class TileEntityJewelrsCraftingTable extends TileEntity
{
- public boolean hasJewel, hasModifier, hasEndItem, isDirty;
- public ItemStack jewel, modifier, endItem;
+ public boolean hasJewelry, hasModifier, hasEndItem, isDirty, hasJewel;
+ public ItemStack jewelry, modifier, endItem, jewel;
public int timer, effect;
+ public float angle;
public TileEntityJewelrsCraftingTable()
{
- this.jewel = new ItemStack(0, 0, 0);
+ this.jewelry = new ItemStack(0, 0, 0);
this.modifier = new ItemStack(0, 0, 0);
this.endItem = new ItemStack(0, 0, 0);
- this.hasJewel = false;
+ this.jewel = new ItemStack(0, 0, 0);
+ this.hasJewelry = false;
this.hasModifier = false;
this.hasEndItem = false;
+ this.hasJewel = false;
this.timer = 0;
this.effect = 0;
+ this.angle = 0;
this.isDirty = false;
}
@@ -30,37 +36,49 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
- nbt.setBoolean("hasJewel", hasJewel);
+ nbt.setBoolean("hasJewelry", hasJewelry);
nbt.setBoolean("hasModifier", hasModifier);
nbt.setBoolean("hasEndItem", hasEndItem);
+ nbt.setBoolean("hasJewel", hasJewel);
nbt.setInteger("timer", timer);
nbt.setInteger("effect", effect);
+ nbt.setFloat("angle", angle);
+
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound tag1 = new NBTTagCompound();
NBTTagCompound tag2 = new NBTTagCompound();
- this.jewel.writeToNBT(tag);
- nbt.setCompoundTag("jewel", tag);
+ NBTTagCompound tag3 = new NBTTagCompound();
+
+ this.jewelry.writeToNBT(tag);
+ nbt.setCompoundTag("jewelry", tag);
this.modifier.writeToNBT(tag1);
nbt.setCompoundTag("modifier", tag1);
this.endItem.writeToNBT(tag2);
nbt.setCompoundTag("endItem", tag2);
+ this.jewel.writeToNBT(tag3);
+ nbt.setCompoundTag("jewel", tag3);
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.hasJewel = nbt.getBoolean("hasJewel");
+ this.hasJewelry = nbt.getBoolean("hasJewelry");
this.hasModifier = nbt.getBoolean("hasModifier");
this.hasEndItem = nbt.getBoolean("hasEndItem");
+ this.hasJewel = nbt.getBoolean("hasJewel");
+
this.timer = nbt.getInteger("timer");
this.effect = nbt.getInteger("effect");
- this.jewel = new ItemStack(0, 0, 0);
- this.jewel.readFromNBT(nbt.getCompoundTag("jewel"));
+ this.angle = nbt.getFloat("angle");
+ this.jewelry = new ItemStack(0, 0, 0);
+ this.jewelry.readFromNBT(nbt.getCompoundTag("jewelry"));
this.modifier = new ItemStack(0, 0, 0);
this.modifier.readFromNBT(nbt.getCompoundTag("modifier"));
this.endItem = new ItemStack(0, 0, 0);
this.endItem.readFromNBT(nbt.getCompoundTag("endItem"));
+ this.jewel = new ItemStack(0, 0, 0);
+ this.jewel.readFromNBT(nbt.getCompoundTag("jewel"));
}
@Override
@@ -71,12 +89,14 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = true;
}
- if (this.hasJewel && this.hasModifier && !this.hasEndItem)
+ if(angle<360F)angle+=3F;
+ else angle=0F;
+ if (this.hasJewelry && (this.hasModifier || this.hasJewel) && !this.hasEndItem)
{
if (timer > 0)
{
timer--;
- for (int l = 0; l < 2000/(timer + 2); ++l)
+ for (int l = 0; l < ConfigHandler.jewelryCraftingTime/(timer + 2); ++l)
{
if(this.getBlockMetadata() == 0) this.worldObj.spawnParticle("witchMagic", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
if(this.getBlockMetadata() == 1) this.worldObj.spawnParticle("witchMagic", xCoord + 0.8F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
@@ -87,11 +107,15 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
if (timer == 0)
{
this.hasEndItem = true;
- this.endItem = jewel.copy();
- this.hasJewel = false;
- this.jewel = new ItemStack(0, 0, 0);
+ this.endItem = jewelry.copy();
+ if (hasModifier && modifier != new ItemStack(0, 0, 0)) JewelryNBT.addModifier(endItem, modifier);
+ if (hasJewel && jewel != new ItemStack(0, 0, 0)) JewelryNBT.addJewel(endItem, jewel);
+ this.hasJewelry = false;
+ this.jewelry = new ItemStack(0, 0, 0);
this.hasModifier = false;
this.modifier = new ItemStack(0, 0, 0);
+ this.hasJewel = false;
+ this.jewel = new ItemStack(0, 0, 0);
}
}
}
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
index d25d369..58ba82a 100644
--- a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
+++ b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
@@ -7,6 +7,7 @@ import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.util.JewelryNBT;
public class TileEntityMolder extends TileEntity
{
@@ -93,6 +94,8 @@ public class TileEntityMolder extends TileEntity
this.jewelBase = moltenMetal;
else
this.jewelBase = new ItemStack(ItemList.ring);
+ if(mold.getItemDamage() != 0 && jewelBase != new ItemStack(0, 0, 0))
+ JewelryNBT.addMetal(jewelBase, ringMetal);
this.moltenMetal = new ItemStack(0, 0, 0);
this.hasJewelBase = true;
}
diff --git a/common/darkknight/jewelrycraft/util/JewelryNBT.java b/common/darkknight/jewelrycraft/util/JewelryNBT.java
new file mode 100644
index 0000000..b6140b7
--- /dev/null
+++ b/common/darkknight/jewelrycraft/util/JewelryNBT.java
@@ -0,0 +1,73 @@
+package darkknight.jewelrycraft.util;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class JewelryNBT
+{
+
+ public static void addMetal(ItemStack item, ItemStack metal)
+ {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else
+ {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound ingotNBT = new NBTTagCompound();
+ metal.writeToNBT(ingotNBT);
+ itemStackData.setTag("ingot", ingotNBT);
+ }
+
+ public static void addJewel(ItemStack item, ItemStack jewel)
+ {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else
+ {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound jewelNBT = new NBTTagCompound();
+ jewel.writeToNBT(jewelNBT);
+ itemStackData.setTag("jewel", jewelNBT);
+ }
+
+ public static void addModifier(ItemStack item, ItemStack modifier)
+ {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else
+ {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound modifierNBT = new NBTTagCompound();
+ modifier.writeToNBT(modifierNBT);
+ itemStackData.setTag("modifier", modifierNBT);
+ }
+
+ public static void addCoordonates(ItemStack item, double x, double y, double z)
+ {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else
+ {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound coords = new NBTTagCompound();
+ coords.setDouble("x", x);
+ coords.setDouble("y", y);
+ coords.setDouble("z", z);
+ itemStackData.setTag("x", coords);
+ itemStackData.setTag("y", coords);
+ itemStackData.setTag("z", coords);
+ }
+
+}
diff --git a/resources/assets/jewelrycraft/lang/en_US.lang b/resources/assets/jewelrycraft/lang/en_US.lang
index efd1e57..6473cfb 100644
--- a/resources/assets/jewelrycraft/lang/en_US.lang
+++ b/resources/assets/jewelrycraft/lang/en_US.lang
@@ -16,6 +16,7 @@ chatmessage.jewelrycraft.molder.addedmold=Added %s to molder.
chatmessage.jewelrycraft.molder.metaliscooling=Molten metal is cooling...
chatmessage.jewelrycraft.molder.moldisempty=Mold is currently empty.
chatmessage.jewelrycraft.molder.moldismissing=Molder does not contain a mold.
+chatmessage.jewelrycraft.molder.hasmoltenmetal=You can't remove the mold. It contains molten metal!
chatmessage.jewelrycraft.smelter.alreadyhasingot=The Smelter already contains a %s
chatmessage.jewelrycraft.smelter.hasmolteningot=The Smelter contains a molten %s
chatmessage.jewelrycraft.smelter.itemneedstobeingot=The item needs to be an ingot!
@@ -28,7 +29,10 @@ chatmessage.jewelrycraft.smelter.nowsmeltingingot=Smelter is now smelting a %s.
chatmessage.jewelrycraft.smelter.metalismelting=%s is being melted.
chatmessage.jewelrycraft.smelter.empty=The Smelter is empty.
chatmessage.jewelrycraft.table.hasenditem=First take out the crafted jewel before inserting new stuff.
-chatmessage.jewelrycraft.table.missingjewelryandmodifier=You need a ring and a modifier.
+chatmessage.jewelrycraft.table.missingjewelryandmodifierorjewel=You need a ring and a modifier or a jewel.
chatmessage.jewelrycraft.table.missingjewelry=You're missing a piece of jewelry.
-chatmessage.jewelrycraft.table.missingmodifier=You need a modifier.
-chatmessage.jewelrycraft.table.iscrafting=The %s is being modified. \ No newline at end of file
+chatmessage.jewelrycraft.table.missingmodifierorjewel=You need a modifier or a jewel.
+chatmessage.jewelrycraft.table.iscrafting=The %s is being modified.
+chatmessage.jewelrycraft.table.jewelrymodifiedfull=This piece of jewelry is already modified at maxium. You can't modify it anymore!
+chatmessage.jewelrycraft.table.jewelrycontainsmodifier=The piece of jewelry already contains a modifier.
+chatmessage.jewelrycraft.table.jewelrycontainsjewel=The piece of jewelry already contains a jewel. \ No newline at end of file
diff --git a/resources/assets/jewelrycraft/textures/items/jewel.png b/resources/assets/jewelrycraft/textures/items/jewel.png
new file mode 100644
index 0000000..4875772
--- /dev/null
+++ b/resources/assets/jewelrycraft/textures/items/jewel.png
Binary files differ
diff --git a/resources/assets/jewelrycraft/textures/items/ring.png b/resources/assets/jewelrycraft/textures/items/ring.png
index 7253e73..ae59f5a 100644
--- a/resources/assets/jewelrycraft/textures/items/ring.png
+++ b/resources/assets/jewelrycraft/textures/items/ring.png
Binary files differ