summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-03-23 19:01:47 +0200
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-03-23 19:01:47 +0200
commit5fce447142b3c0f4a214ca7eb208d9e5c25e6377 (patch)
tree2b29a935e47c8ba65d753b4161cfc51d053a23e6
parent3e0556ee7aadfbb7695f87063662a9ca0d28175f (diff)
Added necklaces, Altar Block, new stuff, better Shadow Ingot texture
-rw-r--r--common/darkknight/jewelrycraft/CreativeTabNecklaces.java55
-rw-r--r--common/darkknight/jewelrycraft/CreativeTabRings.java74
-rw-r--r--common/darkknight/jewelrycraft/JewelrycraftMod.java3
-rw-r--r--common/darkknight/jewelrycraft/block/BlockJewelAltar.java115
-rw-r--r--common/darkknight/jewelrycraft/block/BlockList.java4
-rw-r--r--common/darkknight/jewelrycraft/block/BlockShadow.java6
-rw-r--r--common/darkknight/jewelrycraft/config/ConfigHandler.java6
-rw-r--r--common/darkknight/jewelrycraft/item/ItemClayMolds.java2
-rw-r--r--common/darkknight/jewelrycraft/item/ItemList.java11
-rw-r--r--common/darkknight/jewelrycraft/item/ItemMolds.java2
-rw-r--r--common/darkknight/jewelrycraft/item/ItemNecklace.java268
-rw-r--r--common/darkknight/jewelrycraft/item/ItemRing.java262
-rw-r--r--common/darkknight/jewelrycraft/lib/Reference.java2
-rw-r--r--common/darkknight/jewelrycraft/recipes/CraftingRecipes.java7
-rw-r--r--common/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java107
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java145
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java4
-rw-r--r--common/darkknight/jewelrycraft/util/JewelryNBT.java367
-rw-r--r--common/darkknight/jewelrycraft/util/JewelrycraftUtil.java9
-rw-r--r--resources/assets/jewelrycraft/Changelog.txt2
-rw-r--r--resources/assets/jewelrycraft/lang/en_US.lang4
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/altar_bottom.pngbin0 -> 391 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/altar_side.pngbin0 -> 3220 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/altar_top.pngbin0 -> 3125 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/oreShadow.png.mcmeta5
-rw-r--r--resources/assets/jewelrycraft/textures/items/ingotShadow.pngbin703 -> 467 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/jewelNecklace.pngbin0 -> 241 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/jewelRing.png (renamed from resources/assets/jewelrycraft/textures/items/jewel.png)bin244 -> 244 bytes
28 files changed, 1224 insertions, 236 deletions
diff --git a/common/darkknight/jewelrycraft/CreativeTabNecklaces.java b/common/darkknight/jewelrycraft/CreativeTabNecklaces.java
new file mode 100644
index 0000000..330b239
--- /dev/null
+++ b/common/darkknight/jewelrycraft/CreativeTabNecklaces.java
@@ -0,0 +1,55 @@
+package darkknight.jewelrycraft;
+import java.util.ArrayList;
+import java.util.List;
+
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class CreativeTabNecklaces extends CreativeTabs
+{
+ public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
+
+ public CreativeTabNecklaces(String par2Str)
+ {
+ super(par2Str);
+ metal.add(new ItemStack(Item.ingotGold));
+ metal.add(new ItemStack(Item.ingotIron));
+ }
+
+ @Override
+ public ItemStack getIconItemStack()
+ {
+ ItemStack ring = new ItemStack(ItemList.necklace);
+ return ring;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public void displayAllReleventItems(List par1List)
+ {
+ int index = 0, index2 = 0;
+ while(index < OreDictionary.getOreNames().length)
+ {
+ while(index2 < OreDictionary.getOres(OreDictionary.getOreNames()[index]).size())
+ {
+ if(OreDictionary.getOres(OreDictionary.getOreNames()[index]).get(index2).getUnlocalizedName().toLowerCase().contains("ingot") && !metal.contains(OreDictionary.getOres(OreDictionary.getOreNames()[index]).get(index2)))
+ metal.add(OreDictionary.getOres(OreDictionary.getOreNames()[index]).get(index2));
+ index2++;
+ }
+ index2 = 0;
+ index++;
+ }
+ for(int i = 0; i < metal.size(); i++)
+ for(int j = 0; j < JewelrycraftUtil.modifiers.size(); j++)
+ for(int k = 0; k < JewelrycraftUtil.jewel.size(); k++)
+ {
+ par1List.add(ItemList.necklace.getModifiedItemStack(metal.get(i), null, JewelrycraftUtil.jewel.get(k)));
+ par1List.add(ItemList.necklace.getModifiedItemStack(metal.get(i), JewelrycraftUtil.modifiers.get(j), JewelrycraftUtil.jewel.get(k)));
+ }
+ }
+
+}
diff --git a/common/darkknight/jewelrycraft/CreativeTabRings.java b/common/darkknight/jewelrycraft/CreativeTabRings.java
index 2236943..7e2119f 100644
--- a/common/darkknight/jewelrycraft/CreativeTabRings.java
+++ b/common/darkknight/jewelrycraft/CreativeTabRings.java
@@ -1,10 +1,8 @@
package darkknight.jewelrycraft;
-
import java.util.ArrayList;
import java.util.List;
import darkknight.jewelrycraft.item.ItemList;
-import darkknight.jewelrycraft.util.JewelryNBT;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import net.minecraft.creativetab.CreativeTabs;
@@ -14,44 +12,44 @@ import net.minecraftforge.oredict.OreDictionary;
public class CreativeTabRings extends CreativeTabs
{
- public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
-
- public CreativeTabRings(String par2Str)
- {
- super(par2Str);
- }
-
- @Override
- public ItemStack getIconItemStack()
- {
- ItemStack ring = new ItemStack(ItemList.ring);
- JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(0));
- JewelryNBT.addModifier(ring, JewelrycraftUtil.modifiers.get(3));
- JewelryNBT.addJewel(ring, JewelrycraftUtil.jewel.get(2));
- return ring;
- }
+ public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
+
+ public CreativeTabRings(String par2Str)
+ {
+ super(par2Str);
+ metal.add(new ItemStack(Item.ingotGold));
+ metal.add(new ItemStack(Item.ingotIron));
+ }
+
+ @Override
+ public ItemStack getIconItemStack()
+ {
+ ItemStack ring = new ItemStack(ItemList.ring);
+ return ring;
+ }
@SuppressWarnings({ "rawtypes", "unchecked" })
public void displayAllReleventItems(List par1List)
- {
- int index = 0, index2 = 0;
- while(index < OreDictionary.getOreNames().length)
- {
- while(index2 < OreDictionary.getOres(OreDictionary.getOreNames()[index]).size())
- {
- if(OreDictionary.getOres(OreDictionary.getOreNames()[index]).get(index2).getUnlocalizedName().toLowerCase().contains("ingot") && !metal.contains(OreDictionary.getOres(OreDictionary.getOreNames()[index]).get(index2)))
- metal.add(OreDictionary.getOres(OreDictionary.getOreNames()[index]).get(index2));
- index2++;
- }
- index2 = 0;
- index++;
- }
- if(!metal.contains(new ItemStack(Item.ingotGold)))metal.add(new ItemStack(Item.ingotGold));
- if(!metal.contains(new ItemStack(Item.ingotIron)))metal.add(new ItemStack(Item.ingotIron));
- for(int i = 0; i < metal.size(); i++)
- for(int j = 0; j < JewelrycraftUtil.modifiers.size(); j++)
- for(int k = 0; k < JewelrycraftUtil.jewel.size(); k++)
- par1List.add(ItemList.ring.getModifiedItemStack(metal.get(i), JewelrycraftUtil.modifiers.get(j),JewelrycraftUtil.jewel.get(k)));
- }
+ {
+ int index = 0, index2 = 0;
+ while(index < OreDictionary.getOreNames().length)
+ {
+ while(index2 < OreDictionary.getOres(OreDictionary.getOreNames()[index]).size())
+ {
+ if(OreDictionary.getOres(OreDictionary.getOreNames()[index]).get(index2).getUnlocalizedName().toLowerCase().contains("ingot") && !metal.contains(OreDictionary.getOres(OreDictionary.getOreNames()[index]).get(index2)))
+ metal.add(OreDictionary.getOres(OreDictionary.getOreNames()[index]).get(index2));
+ index2++;
+ }
+ index2 = 0;
+ index++;
+ }
+ for(int i = 0; i < metal.size(); i++)
+ for(int j = 0; j < JewelrycraftUtil.modifiers.size(); j++)
+ for(int k = 0; k < JewelrycraftUtil.jewel.size(); k++)
+ {
+ par1List.add(ItemList.ring.getModifiedItemStack(metal.get(i), null, JewelrycraftUtil.jewel.get(k)));
+ par1List.add(ItemList.ring.getModifiedItemStack(metal.get(i), JewelrycraftUtil.modifiers.get(j), JewelrycraftUtil.jewel.get(k)));
+ }
+ }
}
diff --git a/common/darkknight/jewelrycraft/JewelrycraftMod.java b/common/darkknight/jewelrycraft/JewelrycraftMod.java
index 5191047..47ac735 100644
--- a/common/darkknight/jewelrycraft/JewelrycraftMod.java
+++ b/common/darkknight/jewelrycraft/JewelrycraftMod.java
@@ -16,6 +16,7 @@ import net.minecraft.network.packet.NetHandler;
import net.minecraft.network.packet.Packet1Login;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.gen.structure.MapGenStructureIO;
+import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
@@ -73,6 +74,7 @@ public class JewelrycraftMod implements IConnectionHandler
}
};
public static CreativeTabs rings = new CreativeTabRings("Rings");
+ public static CreativeTabs necklaces = new CreativeTabNecklaces("Necklaces");
@EventHandler
public void preInit(FMLPreInitializationEvent e)
@@ -83,6 +85,7 @@ public class JewelrycraftMod implements IConnectionHandler
CraftingRecipes.preInit(e);
OreDictionary.registerOre("ingotShadow", new ItemStack(ItemList.shadowIngot));
OreDictionary.registerOre("oreShadow", new ItemStack(BlockList.shadowOre));
+ MinecraftForge.setBlockHarvestLevel(BlockList.shadowOre, 0, "pickaxe", 3);
VillagerRegistry.instance().registerVillagerId(3000);
VillagerRegistry.instance().registerVillageTradeHandler(3000, new JCTrades());
diff --git a/common/darkknight/jewelrycraft/block/BlockJewelAltar.java b/common/darkknight/jewelrycraft/block/BlockJewelAltar.java
new file mode 100644
index 0000000..2fab829
--- /dev/null
+++ b/common/darkknight/jewelrycraft/block/BlockJewelAltar.java
@@ -0,0 +1,115 @@
+package darkknight.jewelrycraft.block;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.tileentity.*;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IconRegister;
+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.Icon;
+import net.minecraft.world.World;
+
+public class BlockJewelAltar extends BlockContainer
+{
+ @SideOnly(Side.CLIENT)
+ private Icon altarSide;
+ @SideOnly(Side.CLIENT)
+ private Icon altarBottom;
+ @SideOnly(Side.CLIENT)
+ private Icon altarTop;
+
+ public BlockJewelAltar(int par1)
+ {
+ super(par1, Material.iron);
+ }
+
+ public static boolean isNormalCube(int par0)
+ {
+ return true;
+ }
+
+ public void registerIcons(IconRegister par1IconRegister)
+ {
+ this.altarSide = par1IconRegister.registerIcon(this.getTextureName() + "_" + "side");
+ this.altarBottom = par1IconRegister.registerIcon(this.getTextureName() + "_" + "bottom");
+ this.altarTop = par1IconRegister.registerIcon(this.getTextureName() + "_" + "top");
+ }
+
+ public Icon getIcon(int par1, int par2)
+ {
+ return par1 == 1 ? this.altarTop : (par1 == 0 ? this.altarBottom : this.altarSide);
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
+ {
+ TileEntityAltar te = (TileEntityAltar) world.getBlockTileEntity(i, j, k);
+ ItemStack item = entityPlayer.inventory.getCurrentItem();
+ if (te != null && !world.isRemote)
+ {
+ if(item != null && item != new ItemStack(0, 0, 0) && (item.itemID == ItemList.ring.itemID || item.itemID == ItemList.necklace.itemID) && !te.hasObject)
+ {
+ te.object = item.copy();
+ item.stackSize = 0;
+ te.playerName = entityPlayer.username;
+ te.isDirty = true;
+ te.hasObject = true;
+ }
+
+ if(te.object != null && te.object != new ItemStack(0, 0, 0) && te.hasObject && entityPlayer.isSneaking())
+ {
+ entityPlayer.inventory.addItemStackToInventory(te.object);
+ te.object = new ItemStack(0, 0, 0);
+ te.playerName = "";
+ te.isDirty = true;
+ te.hasObject = false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
+ {
+ TileEntityAltar te = (TileEntityAltar) world.getBlockTileEntity(i, j, k);
+ if (te != null && !world.isRemote)
+ {
+ if (te.object != null && te.object != new ItemStack(0, 0, 0))
+ {
+ }
+ }
+ }
+
+ public void dropItem(World world, double x, double y, double z, ItemStack stack)
+ {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ public void breakBlock(World world, int i, int j, int k, int par5, int par6)
+ {
+ TileEntityAltar te = (TileEntityAltar) world.getBlockTileEntity(i, j, k);
+
+ if (te != null && te.object != null && te.object != new ItemStack(0, 0, 0))
+ {
+ dropItem(te.worldObj, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.object);
+ world.markTileEntityForDespawn(te);
+ }
+
+ super.breakBlock(world, i, j, k, par5, par6);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world)
+ {
+ return new TileEntityAltar();
+ }
+}
diff --git a/common/darkknight/jewelrycraft/block/BlockList.java b/common/darkknight/jewelrycraft/block/BlockList.java
index 09a8dbc..5f7cbe6 100644
--- a/common/darkknight/jewelrycraft/block/BlockList.java
+++ b/common/darkknight/jewelrycraft/block/BlockList.java
@@ -17,6 +17,7 @@ public class BlockList
public static Block displayer;
public static Block jewelCraftingTable;
public static Block shadowBlock;
+ public static Block jewelAltar;
private static boolean isInitialized = false;
@@ -31,6 +32,7 @@ public class BlockList
displayer = new BlockDisplayer(ConfigHandler.idDisplayer, Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("Jewelrycraft.displayer").setCreativeTab(JewelrycraftMod.jewelrycraft);
jewelCraftingTable = new BlockJewelrsCraftingTable(ConfigHandler.idJewelCraftingTable, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("Jewelrycraft.jewelCraftingTable").setCreativeTab(JewelrycraftMod.jewelrycraft);
shadowBlock = new BlockShadow(ConfigHandler.idShadowBlock).setHardness(5.0F).setResistance(7.0F).setStepSound(Block.soundMetalFootstep).setTextureName("jewelrycraft:blockShadow").setUnlocalizedName("Jewelrycraft.blockShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ jewelAltar = new BlockJewelAltar(ConfigHandler.idAltar).setHardness(5.0F).setResistance(2.0F).setStepSound(Block.soundMetalFootstep).setTextureName("jewelrycraft:altar").setUnlocalizedName("Jewelrycraft.altar").setCreativeTab(JewelrycraftMod.jewelrycraft);
GameRegistry.registerBlock(shadowOre, "shadowOre");
GameRegistry.registerBlock(shadowBlock, "shadowBlock");
@@ -38,12 +40,14 @@ public class BlockList
GameRegistry.registerBlock(molder, "Molder");
GameRegistry.registerBlock(jewelCraftingTable, "jewelCraftingTable");
GameRegistry.registerBlock(displayer, "Displayer");
+ GameRegistry.registerBlock(jewelAltar, "Altar");
GameRegistry.registerTileEntity(TileEntitySmelter.class, "30");
GameRegistry.registerTileEntity(TileEntityMolder.class, "31");
GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, "32");
GameRegistry.registerTileEntity(TileEntityDisplayer.class, "33");
GameRegistry.registerTileEntity(TileEntityBlockShadow.class, "34");
+ GameRegistry.registerTileEntity(TileEntityAltar.class, "35");
isInitialized = true;
}
diff --git a/common/darkknight/jewelrycraft/block/BlockShadow.java b/common/darkknight/jewelrycraft/block/BlockShadow.java
index 9aeb82a..dc058f1 100644
--- a/common/darkknight/jewelrycraft/block/BlockShadow.java
+++ b/common/darkknight/jewelrycraft/block/BlockShadow.java
@@ -43,7 +43,7 @@ public class BlockShadow extends BlockContainer
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
{
- return true;
+ return false;
}
public static boolean isNormalCube(int par0)
@@ -78,9 +78,9 @@ public class BlockShadow extends BlockContainer
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
- public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
+ public boolean shouldSideBeRendered(IBlockAccess iBlockAccess, int par2, int par3, int par4, int par5)
{
- return true;
+ return iBlockAccess.isAirBlock(par2, par3, par4)?true:false;
}
public boolean hasComparatorInputOverride()
diff --git a/common/darkknight/jewelrycraft/config/ConfigHandler.java b/common/darkknight/jewelrycraft/config/ConfigHandler.java
index 24450f9..ca045ba 100644
--- a/common/darkknight/jewelrycraft/config/ConfigHandler.java
+++ b/common/darkknight/jewelrycraft/config/ConfigHandler.java
@@ -11,7 +11,8 @@ public class ConfigHandler
public static int idMolds = 17495;
public static int idRing = 17496;
public static int idClayMolds = 17497;
- public static int idCrystal = 17498;
+ public static int idCrystal = 17498;
+ public static int idNecklace = 17499;
public static int idShadowOre = 1750;
public static int idSmelter = 1751;
@@ -20,6 +21,7 @@ public class ConfigHandler
public static int idMolder = 1754;
public static int idGlow = 1755;
public static int idShadowBlock = 1756;
+ public static int idAltar = 1757;
public static int ingotCoolingTime = 200;
public static int ingotMeltingTime = 1500;
@@ -40,6 +42,7 @@ public class ConfigHandler
idMolds = config.getItem("Molds", idMolds).getInt();
idClayMolds = config.getItem("Clay Molds", idClayMolds).getInt();
idRing = config.getItem("Ring", idRing).getInt();
+ idNecklace = config.getItem("Necklace", idNecklace).getInt();
idCrystal = config.getItem("Crystal", idCrystal).getInt();
idShadowOre = config.getBlock("Shadow Ore", idShadowOre).getInt();
@@ -49,6 +52,7 @@ public class ConfigHandler
idDisplayer = config.getBlock("Displayer", idDisplayer).getInt();
idJewelCraftingTable = config.getBlock("Jeweler's Crafting Table", idJewelCraftingTable).getInt();
idGlow = config.getBlock("Glow", idGlow).getInt();
+ idAltar = config.getBlock("Jewel Altar", idAltar).getInt();
ingotCoolingTime = config.get("timers", "Molder Ingot Cooling Time", ingotCoolingTime).getInt();
ingotMeltingTime = config.get("timers", "Ingot Melting Time", ingotMeltingTime).getInt();
diff --git a/common/darkknight/jewelrycraft/item/ItemClayMolds.java b/common/darkknight/jewelrycraft/item/ItemClayMolds.java
index 184db0d..05a684c 100644
--- a/common/darkknight/jewelrycraft/item/ItemClayMolds.java
+++ b/common/darkknight/jewelrycraft/item/ItemClayMolds.java
@@ -14,7 +14,7 @@ import net.minecraft.util.MathHelper;
public class ItemClayMolds extends Item
{
/** List of molds color names */
- public static final String[] moldsItemNames = new String[] { "clayIngot", "clayRing" };
+ public static final String[] moldsItemNames = new String[] { "clayIngot", "clayRing", "clayNecklace" };
@SideOnly(Side.CLIENT)
private Icon[] moldsIcons;
diff --git a/common/darkknight/jewelrycraft/item/ItemList.java b/common/darkknight/jewelrycraft/item/ItemList.java
index 027f0a6..c45909b 100644
--- a/common/darkknight/jewelrycraft/item/ItemList.java
+++ b/common/darkknight/jewelrycraft/item/ItemList.java
@@ -14,9 +14,10 @@ public class ItemList
public static Item clayMolds;
public static Item crystal;
public static ItemRing ring;
-
+ public static ItemNecklace necklace;
+
private static boolean isInitialized = false;
-
+
public static void preInit(FMLPreInitializationEvent e)
{
if (!isInitialized)
@@ -27,14 +28,16 @@ public class ItemList
clayMolds = new ItemClayMolds(ConfigHandler.idClayMolds - 256).setUnlocalizedName("Jewelrycraft.mold").setTextureName("Mold").setCreativeTab(JewelrycraftMod.jewelrycraft);
ring = (ItemRing) new ItemRing(ConfigHandler.idRing - 256).setUnlocalizedName("Jewelrycraft.ring").setTextureName("jewelrycraft:ring");
crystal = new ItemCrystal(ConfigHandler.idCrystal - 256).setUnlocalizedName("Jewelrycraft.crystal").setTextureName("jewelrycraft:crystal").setCreativeTab(JewelrycraftMod.jewelrycraft);
-
+ necklace = (ItemNecklace) new ItemNecklace(ConfigHandler.idNecklace - 256).setUnlocalizedName("Jewelrycraft.necklace").setTextureName("jewelrycraft:necklace");
+
GameRegistry.registerItem(thiefGloves, "thiefGloves");
GameRegistry.registerItem(shadowIngot, "shadowIngot");
GameRegistry.registerItem(molds, "molds");
GameRegistry.registerItem(clayMolds, "clayMolds");
GameRegistry.registerItem(ring, "ring");
+ GameRegistry.registerItem(necklace, "necklace");
GameRegistry.registerItem(crystal, "crystal");
-
+
isInitialized = true;
}
}
diff --git a/common/darkknight/jewelrycraft/item/ItemMolds.java b/common/darkknight/jewelrycraft/item/ItemMolds.java
index e82d539..a62d193 100644
--- a/common/darkknight/jewelrycraft/item/ItemMolds.java
+++ b/common/darkknight/jewelrycraft/item/ItemMolds.java
@@ -14,7 +14,7 @@ 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", "necklace" };
@SideOnly(Side.CLIENT)
private Icon[] moldsIcons;
diff --git a/common/darkknight/jewelrycraft/item/ItemNecklace.java b/common/darkknight/jewelrycraft/item/ItemNecklace.java
new file mode 100644
index 0000000..7559f53
--- /dev/null
+++ b/common/darkknight/jewelrycraft/item/ItemNecklace.java
@@ -0,0 +1,268 @@
+package darkknight.jewelrycraft.item;
+
+import java.io.IOException;
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.util.JewelryNBT;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.texture.IconRegister;
+import net.minecraft.entity.*;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.*;
+import net.minecraft.potion.*;
+import net.minecraft.tileentity.*;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+
+public class ItemNecklace extends Item
+{
+ public Icon jewel;
+ private double amplifier;
+ int index = 0;
+
+ public ItemNecklace(int par1)
+ {
+ super(par1);
+ this.setMaxStackSize(1);
+ }
+
+ public void registerIcons(IconRegister iconRegister)
+ {
+ itemIcon = iconRegister.registerIcon("jewelrycraft:necklace");
+ jewel = iconRegister.registerIcon("jewelrycraft:jewelNecklace");
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack stack, int pass)
+ {
+ try
+ {
+ return ItemRing.color(stack, pass);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return 16777215;
+ }
+
+ public Icon getIcon(ItemStack stack, int pass)
+ {
+ if(pass == 0) return itemIcon;
+ if(pass == 1 && JewelryNBT.jewel(stack) != null) return jewel;
+ return itemIcon;
+ }
+
+ public String getItemDisplayName(ItemStack stack)
+ {
+ if(JewelryNBT.ingot(stack) != null) return JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() + " " + ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
+ return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
+ }
+
+ @SuppressWarnings({ "rawtypes" })
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
+ {
+ if (!world.isRemote)
+ {
+ List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(player.posX - 1.5D, player.posY, player.posZ - 1.5D, player.posX + 1.5D, player.posY + 2D, player.posZ + 1.5D));
+ if (JewelryNBT.playerPosX(stack) != -1 && JewelryNBT.playerPosY(stack) != -1 && JewelryNBT.playerPosZ(stack) != -1)
+ {
+ double posX = JewelryNBT.playerPosX(stack), posY = JewelryNBT.playerPosY(stack), posZ = JewelryNBT.playerPosZ(stack);
+ if (JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Item.bed)) && JewelryNBT.dimension(stack) != -2 && JewelryNBT.dimName(stack) != null)
+ {
+ int dimension = JewelryNBT.dimension(stack);
+ 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);
+ if (!JewelryNBT.isDimensionX(stack, player.dimension)) player.travelToDimension(dimension);
+ for (int i = 0; i < entities.size(); i++) ((EntityLivingBase)entities.get(i)).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);
+ }
+ else if(JewelryNBT.isDimensionX(stack, player.dimension))
+ {
+ 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);
+ for (int i = 0; i < entities.size(); i++) ((EntityLivingBase)entities.get(i)).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);
+ }
+ else player.addChatMessage("You can't teleport to these coordonates! You need to be in the same dimension they were set!");
+ }
+ else if(JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Item.bed)) && JewelryNBT.dimension(stack) == -2 && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1){
+ JewelryNBT.addCoordonatesAndDimension(stack, player.posX, player.posY, player.posZ, world.provider.dimensionId, world.provider.getDimensionName());
+ JewelryNBT.addFakeEnchantment(stack);
+ }
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl)) && !JewelryNBT.hasTag(stack, "modifier") && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1){
+ JewelryNBT.addCoordonatesAndDimension(stack, player.posX, player.posY, player.posZ, world.provider.dimensionId, world.provider.getDimensionName());
+ JewelryNBT.addFakeEnchantment(stack);
+ }
+
+ if(JewelryNBT.hasTag(stack, "mode"))
+ {
+ String mode = "";
+ if(JewelryNBT.isModeX(stack, "Activated")) mode = "Deactivated";
+ else if(JewelryNBT.isModeX(stack, "Deactivated")) mode = "Activated";
+ if(mode != "")
+ {
+ player.addChatMessage("The Necklace has been " + mode);
+ JewelryNBT.addMode(stack, mode);
+ }
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity)
+ {
+ if (!player.worldObj.isRemote && entity instanceof EntityLivingBase && JewelryNBT.isJewelX(stack, new ItemStack(Item.netherStar)) && JewelryNBT.isModifierX(stack, new ItemStack(Block.chest)) && JewelryNBT.entity(stack, player) == null){
+ JewelryNBT.addEntity(stack, entity);
+ JewelryNBT.addEntityID(stack, entity);
+ entity.setDead();
+ JewelryNBT.addFakeEnchantment(stack);
+ }
+ return true;
+ }
+
+ /**
+ * allows items to add custom lines of information to the mouseover
+ * description
+ */
+ @Override
+ @SuppressWarnings(
+ { "rawtypes", "unchecked" })
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
+ {
+ if (stack.hasTagCompound() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips)
+ {
+ ItemStack ingot = JewelryNBT.ingot(stack);
+ if (ingot != null) list.add("Ingot: " + EnumChatFormatting.YELLOW + ingot.getDisplayName());
+
+ ItemStack jewel = JewelryNBT.jewel(stack);
+ if (jewel != null) list.add("Jewel: " + EnumChatFormatting.BLUE + jewel.getDisplayName());
+
+ ItemStack modifier = JewelryNBT.modifier(stack);
+ if(modifier != null) list.add("Modifier: " + EnumChatFormatting.DARK_PURPLE + modifier.getDisplayName());
+
+ double playerPosX = JewelryNBT.playerPosX(stack), playerPosY = JewelryNBT.playerPosY(stack), playerPosZ = JewelryNBT.playerPosZ(stack);
+ if(playerPosX != -1 && playerPosY != -1 && playerPosZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) playerPosX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) playerPosY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) playerPosZ);
+
+ int posX = JewelryNBT.blockCoordX(stack), posY = JewelryNBT.blockCoordY(stack), posZ = JewelryNBT.blockCoordZ(stack);
+ if(posX != -1 && posY != -1 && posZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) posX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) posY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) posZ);
+
+ String name = JewelryNBT.dimName(stack);
+ if(name != null) list.add("Dimension: " + EnumChatFormatting.DARK_GREEN + name);
+
+ EntityLivingBase entity = JewelryNBT.entity(stack, player);
+ if (entity != null) list.add("Entity: " + EnumChatFormatting.GOLD + entity.getEntityName());
+
+ String modeN = JewelryNBT.modeName(stack);
+ if(modeN != null) list.add("Mode: " + modeN);
+
+ int block = JewelryNBT.blockID(stack);
+ if(block != -1) list.add("Block: " + StatCollector.translateToLocalFormatted(Block.blocksList[block].getUnlocalizedName()));
+
+ int blockmeta = JewelryNBT.blockMetadata(stack);
+ if(blockmeta != -1) list.add("Block Metadata: " + blockmeta);
+
+ TileEntity tile = JewelryNBT.tileEntity(stack);
+ if(tile != null) list.add(EnumChatFormatting.RED + "Contains a tile entity");
+
+ int blockX = JewelryNBT.blockCoordX(stack);
+ if(blockX != -1) list.add("Block Coords X: " + blockX);
+
+ int blockY = JewelryNBT.blockCoordY(stack);
+ if(blockY != -1) list.add("Block Coords Y: " + blockY);
+
+ int blockZ = JewelryNBT.blockCoordZ(stack);
+ if(blockZ != -1) list.add("Block Coords Z: " + blockZ);
+
+ // int colorI = JewelryNBT.ingotColor(stack);
+ // if(colorI != -1) list.add("Ingot Color: " + colorI);
+ //
+ // int colorJ = JewelryNBT.jewelColor(stack);
+ // if(colorJ != -1) list.add("Jewel Color: " + colorJ);
+ }
+ }
+
+ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int i, int j, int k, int side, float par8, float par9, float par10)
+ {
+ amplifier = 0;
+ if (JewelryNBT.isJewelX(stack, new ItemStack(Item.diamond))) amplifier = 1D;
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.emerald))) amplifier = 2D;
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.netherStar))) amplifier = 5D;
+
+ if (!world.isRemote)
+ {
+ onItemRightClick(stack, world, player);
+ if(JewelryNBT.isModifierX(stack, new ItemStack(Item.dyePowder, 1, 15)))
+ for(int x = (int) - amplifier; x <= amplifier; x++)
+ for(int z = (int) - amplifier; z <= amplifier; z++)
+ world.scheduleBlockUpdate(i + x, j, k + z, world.getBlockId(i + x, j, k + z), 7 - (int)amplifier);
+
+ for(int x = (int) - 1; x <= 1; x++)
+ for(int z = (int) - 1; z <= 1; z++)
+ if(JewelryNBT.isModifierX(stack, new ItemStack(Item.pickaxeDiamond)) && JewelryNBT.isJewelX(stack, new ItemStack(Item.netherStar)) && JewelryNBT.isIngotX(stack, new ItemStack(ItemList.shadowIngot)))
+ if((side == 0 || side == 1) && j > 0 && world.getBlockId(i + x, j, k + z) != Block.bedrock.blockID) world.destroyBlock(i + x, j, k + z, true);
+ else if((side == 2 || side == 3) && j + x > 0 && world.getBlockId(i + z, j + x, k) != Block.bedrock.blockID) world.destroyBlock(i + z, j + x, k, true);
+ else if((side == 4 || side == 5) && j + x > 0 && world.getBlockId(i, j + x, k + z) != Block.bedrock.blockID) world.destroyBlock(i, j + x, k + z, true);
+ }
+ return true;
+ }
+
+ @SuppressWarnings({"rawtypes" })
+ @Override
+ public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5)
+ {
+ amplifier = 1D;
+ if (!world.isRemote)
+ {
+ EntityPlayer entityplayer = (EntityPlayer) entity;
+ int posX = (int)Math.floor(entityplayer.posX), posY = (int)Math.floor(entityplayer.posY), posZ = (int)Math.floor(entityplayer.posZ);
+
+ if (JewelryNBT.isJewelX(stack, new ItemStack(Item.diamond))) amplifier = 2D;
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.emerald))) amplifier = 3D;
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.netherStar))) amplifier = 5D;
+
+ if(JewelryNBT.isModifierX(stack, new ItemStack(Item.dyePowder, 1, 15)) && world.getBlockId(posX, posY - 1, posZ) == Block.tilledField.blockID)
+ for(int i = (int) - amplifier; i <= amplifier; i++)
+ for(int j = (int) - amplifier; j <= amplifier; j++)
+ world.setBlockMetadataWithNotify(posX + i, posY - 1, posZ + j, 1, 7);
+
+ List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(entityplayer.posX - amplifier, entityplayer.posY - amplifier, entityplayer.posZ - amplifier, entityplayer.posX + amplifier, entityplayer.posY + 2*amplifier, entityplayer.posZ + amplifier));
+ if(JewelryNBT.isModeX(stack, "Activated"))
+ {
+ for(int i = 0; i < entities.size(); i++)
+ {
+ if (JewelryNBT.isModifierX(stack, new ItemStack(Item.blazePowder))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.fireResistance.id, 4, 0, true));
+ else if (JewelryNBT.isModifierX(stack, new ItemStack(Item.sugar))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 4, 0, true));
+ else if (JewelryNBT.isModifierX(stack, new ItemStack(Item.pickaxeIron)) && !JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.digSpeed.id, 4, 0, true));
+ else if (JewelryNBT.isModifierX(stack, new ItemStack(Item.feather)))
+ {
+ ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.jump.id, 4, 0, true));
+ entityplayer.fallDistance = 0;
+ }
+ else if (JewelryNBT.isModifierX(stack, new ItemStack(Item.potion, 1, 8270))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.invisibility.id, 4, 0, true));
+ }
+ }
+ }
+ }
+
+ public ItemStack getModifiedItemStack(ItemStack ingot, ItemStack modifier, ItemStack jewel)
+ {
+ ItemStack itemstack = new ItemStack(this);
+ JewelryNBT.addMetal(itemstack, ingot);
+ JewelryNBT.addModifier(itemstack, modifier);
+ JewelryNBT.addJewel(itemstack, jewel);
+ if(JewelryNBT.isModifierEffectType(itemstack) && !(JewelryNBT.isJewelX(itemstack, new ItemStack(Item.enderPearl)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Item.pickaxeIron)))) JewelryNBT.addMode(itemstack, "Activated");
+ if(JewelryNBT.isJewelX(itemstack, new ItemStack(Item.netherStar)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Item.book)))
+ JewelryNBT.addMode(itemstack, "Disenchant");
+ return itemstack;
+ }
+}
diff --git a/common/darkknight/jewelrycraft/item/ItemRing.java b/common/darkknight/jewelrycraft/item/ItemRing.java
index bb09d69..368cde3 100644
--- a/common/darkknight/jewelrycraft/item/ItemRing.java
+++ b/common/darkknight/jewelrycraft/item/ItemRing.java
@@ -17,26 +17,20 @@ import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.util.JewelryNBT;
import net.minecraft.block.Block;
+import net.minecraft.block.BlockSkull;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.resources.ResourceManager;
-import net.minecraft.enchantment.Enchantment;
-import net.minecraft.enchantment.EnchantmentHelper;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.enchantment.*;
+import net.minecraft.entity.*;
+import net.minecraft.entity.monster.EntityIronGolem;
+import net.minecraft.entity.monster.EntitySnowman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryEnderChest;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.potion.Potion;
-import net.minecraft.potion.PotionEffect;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.tileentity.TileEntityChest;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.Icon;
-import net.minecraft.util.MathHelper;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.StatCollector;
+import net.minecraft.item.*;
+import net.minecraft.potion.*;
+import net.minecraft.tileentity.*;
+import net.minecraft.util.*;
import net.minecraft.world.World;
public class ItemRing extends Item
@@ -54,7 +48,7 @@ public class ItemRing extends Item
public void registerIcons(IconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:ring");
- jewel = iconRegister.registerIcon("jewelrycraft:jewel");
+ jewel = iconRegister.registerIcon("jewelrycraft:jewelRing");
}
@Override
@@ -88,57 +82,74 @@ public class ItemRing extends Item
{
String domain = "", texture;
ResourceManager rm = Minecraft.getMinecraft().getResourceManager();
- int x=0, y=0, ok = 0;
- if (pass == 0 && JewelryNBT.ingot(stack) != null)
+ BufferedImage icon;
+ int x=0, y=0, ok = 0, red, green, blue;
+ if (pass == 0 && JewelryNBT.ingot(stack) != null && JewelryNBT.ingotColor(stack) == 16777215)
{
- if (JewelryNBT.ingot(stack).getIconIndex().getIconName().substring(0, JewelryNBT.ingot(stack).getIconIndex().getIconName().indexOf(":") + 1) != "") domain = JewelryNBT.ingot(stack).getIconIndex().getIconName().substring(0, JewelryNBT.ingot(stack).getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim();
+ String ingotIconName = JewelryNBT.ingot(stack).getIconIndex().getIconName();
+
+ if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim();
else domain = "minecraft";
- texture = JewelryNBT.ingot(stack).getIconIndex().getIconName().substring(JewelryNBT.ingot(stack).getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png";
+
+ texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png";
ResourceLocation ingot = null;
+
if (JewelryNBT.ingot(stack).getUnlocalizedName().contains("item")) ingot = new ResourceLocation(domain, "textures/items/" + texture);
else ingot = new ResourceLocation(domain, "textures/blocks/" + texture);
- BufferedImage bufferedimage = ImageIO.read(rm.getResource(ingot).getInputStream());
- while(ok == 0){
- int red = (bufferedimage.getRGB(x, y) >> 16) & 0xFF;
- int green = (bufferedimage.getRGB(x, y) >> 8) & 0xFF;
- int blue = bufferedimage.getRGB(x, y) & 0xFF;
- if((red <= 80 && green <=80 && blue <= 80) || (red >= 180 && green >= 180 && blue >= 180)){
- if(x<bufferedimage.getTileWidth()-1) x++;
- if(x>=bufferedimage.getTileWidth()-1 && y<bufferedimage.getTileWidth()-1){
+
+ icon = ImageIO.read(rm.getResource(ingot).getInputStream());
+ while(ok == 0)
+ {
+ red = (icon.getRGB(x, y) >> 16) & 0xFF;
+ green = (icon.getRGB(x, y) >> 8) & 0xFF;
+ blue = icon.getRGB(x, y) & 0xFF;
+ if((red <= 80 && green <=80 && blue <= 80) || (red >= 180 && green >= 180 && blue >= 180))
+ {
+ if(x<icon.getTileWidth()-1) x++;
+ if(x>=icon.getTileWidth()-1 && y<icon.getTileWidth()-1)
+ {
x=0;
y++;
}
- if(x == bufferedimage.getTileWidth()-1 && y==bufferedimage.getTileWidth()-1)ok=1;
+ if(x == icon.getTileWidth()-1 && y==icon.getTileWidth()-1) ok=1;
}
else ok=1;
}
- JewelryNBT.addIngotColor(stack, bufferedimage.getRGB(x, y));
+ JewelryNBT.addIngotColor(stack, icon.getRGB(x, y));
}
- else if (pass == 1 && JewelryNBT.jewel(stack) != null)
+ else if (pass == 1 && JewelryNBT.jewel(stack) != null && JewelryNBT.jewelColor(stack) == 16777215)
{
x = 0; y = 0; ok=0;
- if (JewelryNBT.jewel(stack).getIconIndex().getIconName().substring(0, JewelryNBT.jewel(stack).getIconIndex().getIconName().indexOf(":") + 1) != "") domain = JewelryNBT.jewel(stack).getIconIndex().getIconName().substring(0, JewelryNBT.jewel(stack).getIconIndex().getIconName().indexOf(":") + 1).replace(":", " ").trim();
+ String jewelIconName = JewelryNBT.jewel(stack).getIconIndex().getIconName();
+
+ if (jewelIconName.substring(0, jewelIconName.indexOf(":") + 1) != "") domain = jewelIconName.substring(0, jewelIconName.indexOf(":") + 1).replace(":", " ").trim();
else domain = "minecraft";
- texture = JewelryNBT.jewel(stack).getIconIndex().getIconName().substring(JewelryNBT.jewel(stack).getIconIndex().getIconName().lastIndexOf(":") + 1) + ".png";
+
+ texture = jewelIconName.substring(jewelIconName.lastIndexOf(":") + 1) + ".png";
ResourceLocation jewelLoc = null;
+
if (JewelryNBT.jewel(stack).getUnlocalizedName().contains("item")) jewelLoc = new ResourceLocation(domain, "textures/items/" + texture);
else jewelLoc = new ResourceLocation(domain, "textures/blocks/" + texture);
- BufferedImage bufferedimage = ImageIO.read(rm.getResource(jewelLoc).getInputStream());
- while(ok == 0){
- int red = (bufferedimage.getRGB(x, y) >> 16) & 0xFF;
- int green = (bufferedimage.getRGB(x, y) >> 8) & 0xFF;
- int blue = bufferedimage.getRGB(x, y) & 0xFF;
- if((red <= 80 && green <=80 && blue <= 80) || (red >= 180 && green >= 180 && blue >= 180)){
- if(x<bufferedimage.getTileWidth()-1) x++;
- if(x>=bufferedimage.getTileWidth()-1 && y<bufferedimage.getTileWidth()-1){
+
+ icon = ImageIO.read(rm.getResource(jewelLoc).getInputStream());
+ while(ok == 0)
+ {
+ red = (icon.getRGB(x, y) >> 16) & 0xFF;
+ green = (icon.getRGB(x, y) >> 8) & 0xFF;
+ blue = icon.getRGB(x, y) & 0xFF;
+ if((red <= 80 && green <=80 && blue <= 80) || (red >= 180 && green >= 180 && blue >= 180))
+ {
+ if(x<icon.getTileWidth()-1) x++;
+ if(x>=icon.getTileWidth()-1 && y<icon.getTileWidth()-1)
+ {
x=0;
y++;
}
- if(x == bufferedimage.getTileWidth()-1 && y==bufferedimage.getTileWidth()-1)ok=1;
+ if(x == icon.getTileWidth()-1 && y==icon.getTileWidth()-1) ok=1;
}
else ok=1;
}
- if(JewelryNBT.jewel(stack).getItem().getColorFromItemStack(JewelryNBT.jewel(stack), 1) == 16777215) JewelryNBT.addJewelColor(stack, bufferedimage.getRGB(x, y));
+ if(JewelryNBT.jewel(stack).getItem().getColorFromItemStack(JewelryNBT.jewel(stack), 1) == 16777215) JewelryNBT.addJewelColor(stack, icon.getRGB(x, y));
else JewelryNBT.addJewelColor(stack, JewelryNBT.jewel(stack).getItem().getColorFromItemStack(JewelryNBT.jewel(stack), 1));
}
if(pass == 0 && JewelryNBT.ingot(stack) != null) return JewelryNBT.ingotColor(stack);
@@ -157,7 +168,8 @@ public class ItemRing extends Item
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (!world.isRemote){
- if (JewelryNBT.playerPosX(stack) != -1 && JewelryNBT.playerPosY(stack) != -1 && JewelryNBT.playerPosZ(stack) != -1){
+ if (JewelryNBT.playerPosX(stack) != -1 && JewelryNBT.playerPosY(stack) != -1 && JewelryNBT.playerPosZ(stack) != -1)
+ {
double posX = JewelryNBT.playerPosX(stack), posY = JewelryNBT.playerPosY(stack), posZ = JewelryNBT.playerPosZ(stack);
if (JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Item.bed)) && JewelryNBT.dimension(stack) != -2 && JewelryNBT.dimName(stack) != null)
{
@@ -196,7 +208,7 @@ public class ItemRing extends Item
else if(i != -1 && j != -1 && k != -1) player.addChatMessage("Chest out of range! You need to be " + ((int)player.getDistance(i + 0.5F, j + 0.5F, k + 0.5F) - 127) + " blocks closer.");
else player.addChatMessage("You need to link the ring with a chest first, before using it!");
}
- else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl)) && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1){
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl)) && !JewelryNBT.hasTag(stack, "modifier") && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1){
JewelryNBT.addCoordonatesAndDimension(stack, player.posX, player.posY, player.posZ, world.provider.dimensionId, world.provider.getDimensionName());
JewelryNBT.addFakeEnchantment(stack);
}
@@ -220,7 +232,6 @@ public class ItemRing extends Item
JewelryNBT.addMode(stack, mode);
}
}
- else if(JewelryNBT.hasTag(stack, "modifier") && JewelryNBT.isModifierEffectType(stack)) JewelryNBT.addMode(stack, "Activated");
}
return stack;
}
@@ -246,7 +257,7 @@ public class ItemRing extends Item
{ "rawtypes", "unchecked" })
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
- if (stack.hasTagCompound() && stack.getDisplayName() != "Wedding Ring")
+ if (stack.hasTagCompound() && stack.getDisplayName() != "Wedding Ring" && Minecraft.getMinecraft().gameSettings.advancedItemTooltips)
{
ItemStack ingot = JewelryNBT.ingot(stack);
if (ingot != null) list.add("Ingot: " + EnumChatFormatting.YELLOW + ingot.getDisplayName());
@@ -271,20 +282,44 @@ public class ItemRing extends Item
String modeN = JewelryNBT.modeName(stack);
if(modeN != null) list.add("Mode: " + modeN);
-
-// int colorI = JewelryNBT.ingotColor(stack);
-// if(colorI != -1) list.add("Ingot Color: " + colorI);
-//
-// int colorJ = JewelryNBT.jewelColor(stack);
-// if(colorJ != -1) list.add("Jewel Color: " + colorJ);
+
+ int block = JewelryNBT.blockID(stack);
+ if(block != -1) list.add("Block: " + StatCollector.translateToLocalFormatted(Block.blocksList[block].getUnlocalizedName()));
+
+ int blockmeta = JewelryNBT.blockMetadata(stack);
+ if(blockmeta != -1) list.add("Block Metadata: " + blockmeta);
+
+ TileEntity tile = JewelryNBT.tileEntity(stack);
+ if(tile != null) list.add(EnumChatFormatting.RED + "Contains a tile entity");
+
+ int blockX = JewelryNBT.blockCoordX(stack);
+ if(blockX != -1) list.add("Block Coords X: " + blockX);
+
+ int blockY = JewelryNBT.blockCoordY(stack);
+ if(blockY != -1) list.add("Block Coords Y: " + blockY);
+
+ int blockZ = JewelryNBT.blockCoordZ(stack);
+ if(blockZ != -1) list.add("Block Coords Z: " + blockZ);
+
+ // int colorI = JewelryNBT.ingotColor(stack);
+ // if(colorI != -1) list.add("Ingot Color: " + colorI);
+ //
+ // int colorJ = JewelryNBT.jewelColor(stack);
+ // if(colorJ != -1) list.add("Jewel Color: " + colorJ);
}
}
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int i, int j, int k, int side, float par8, float par9, float par10)
{
+ amplifier = 0;
+ if (JewelryNBT.isJewelX(stack, new ItemStack(Item.diamond))) amplifier = 1;
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.emerald))) amplifier = 2;
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.netherStar))) amplifier = 7;
+
if (!world.isRemote)
{
EntityLivingBase entity = JewelryNBT.entity(stack, player);
+ boolean used = false;
if(entity != null && entity instanceof EntityLivingBase){
entity.setLocationAndAngles(i + 0.5D, j + 1D, k + 0.5D, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
world.spawnEntityInWorld(entity);
@@ -292,6 +327,40 @@ public class ItemRing extends Item
}
if (JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Block.chest)) && world.getBlockId(i, j, k) == Block.chest.blockID) JewelryNBT.addBlockCoordonates(stack, i, j, k);
onItemRightClick(stack, world, player);
+ if(JewelryNBT.isModifierX(stack, new ItemStack(Item.dyePowder, 1, 15))) world.scheduleBlockUpdate(i, j, k, world.getBlockId(i, j, k), 7 - amplifier);
+ if(JewelryNBT.isModifierX(stack, new ItemStack(Item.pickaxeDiamond)) && JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl)))
+ {
+ if(JewelryNBT.hasTag(stack, "blockID") && !used)
+ {
+ int shiftX = 0, shiftY = 0, shiftZ = 0;
+ if(side == 0) shiftY = -1;
+ else if(side == 1) shiftY = 1;
+ else if(side == 2) shiftZ = -1;
+ else if(side == 3) shiftZ = 1;
+ else if(side == 4) shiftX = -1;
+ else if(side == 5) shiftX = 1;
+ world.setBlock(i + shiftX, j + shiftY, k + shiftZ, JewelryNBT.blockID(stack));
+ world.setBlockMetadataWithNotify(i + shiftX, j + shiftY, k + shiftZ, JewelryNBT.blockMetadata(stack), 2);
+ if(JewelryNBT.hasTag(stack, "tile")) world.setBlockTileEntity(i + shiftX, j + shiftY, k + shiftZ, JewelryNBT.tileEntity(stack));
+ if(JewelryNBT.tileEntity(stack) instanceof TileEntitySkull) ((BlockSkull)Block.skull).makeWither(world, i + shiftX, j + shiftY, k + shiftZ, (TileEntitySkull)JewelryNBT.tileEntity(stack));
+ if(JewelryNBT.blockID(stack) == Block.pumpkin.blockID || JewelryNBT.blockID(stack) == Block.pumpkinLantern.blockID) createGolems(world, i + shiftX, j + shiftY, k + shiftZ);
+ JewelryNBT.removeBlock(stack);
+ used = true;
+ }
+
+ if(!JewelryNBT.hasTag(stack, "tile") && world.getBlockTileEntity(i, j, k) != null && !used){
+ JewelryNBT.addTileEntityBlock(stack, world, i, j, k);
+ world.removeBlockTileEntity(i, j, k);
+ world.setBlock(i, j, k, 0);
+ }
+ else if(!JewelryNBT.hasTag(stack, "blockID") && !used){
+ JewelryNBT.addBlock(stack, world.getBlockId(i, j, k), world.getBlockMetadata(i, j, k));
+ JewelryNBT.addBlockCoordonates(stack, i, j, k);
+ world.setBlock(i, j, k, 0);
+ }
+ }
+ if(JewelryNBT.isModifierX(stack, new ItemStack(Item.pickaxeDiamond)) && JewelryNBT.isJewelX(stack, new ItemStack(Item.netherStar)) && JewelryNBT.isIngotX(stack, new ItemStack(ItemList.shadowIngot)) && j > 0 && world.getBlockId(i, j, k) != Block.bedrock.blockID)
+ world.destroyBlock(i, j, k, true);
}
return true;
}
@@ -317,27 +386,26 @@ public class ItemRing extends Item
if(cooldown > 0) cooldown--;
if (!world.isRemote){
EntityPlayer entityplayer = (EntityPlayer) entity;
+ int posX = (int)Math.floor(entityplayer.posX), posY = (int)Math.floor(entityplayer.posY), posZ = (int)Math.floor(entityplayer.posZ);
+
if (JewelryNBT.isJewelX(stack, new ItemStack(Item.diamond))) amplifier = 1;
else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.emerald))) amplifier = 2;
else if (JewelryNBT.isJewelX(stack, new ItemStack(Item.netherStar))) amplifier = 7;
+ if(JewelryNBT.isModifierX(stack, new ItemStack(Item.dyePowder, 1, 15)) && world.getBlockId(posX, posY - 1, posZ) == Block.tilledField.blockID)
+ world.setBlockMetadataWithNotify(posX, posY - 1, posZ, 1, 2);
+
if(JewelryNBT.isModeX(stack, "Activated"))
{
if (JewelryNBT.isModifierX(stack, new ItemStack(Item.blazePowder)) && entityplayer != null)
- {
entityplayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 4, amplifier, true));
- entityplayer.addPotionEffect(new PotionEffect(Potion.weakness.id, 4, amplifier, true));
- }
else if (JewelryNBT.isModifierX(stack, new ItemStack(Item.sugar)) && entityplayer != null)
{
entityplayer.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 4, amplifier, true));
entityplayer.addExhaustion(0.05f*amplifier);
}
- else if (JewelryNBT.isModifierX(stack, new ItemStack(Item.pickaxeIron)) && entityplayer != null)
- {
+ else if (JewelryNBT.isModifierX(stack, new ItemStack(Item.pickaxeIron)) && entityplayer != null && !JewelryNBT.isJewelX(stack, new ItemStack(Item.enderPearl)))
entityplayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 4, amplifier, true));
- entityplayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 4, -2*amplifier, true));
- }
else if (JewelryNBT.isModifierX(stack, new ItemStack(Item.feather)) && entityplayer != null)
{
entityplayer.addPotionEffect(new PotionEffect(Potion.jump.id, 4, amplifier, true));
@@ -440,9 +508,81 @@ public class ItemRing extends Item
JewelryNBT.addMetal(itemstack, ingot);
JewelryNBT.addModifier(itemstack, modifier);
JewelryNBT.addJewel(itemstack, jewel);
- if(JewelryNBT.isModifierEffectType(itemstack)) JewelryNBT.addMode(itemstack, "Activated");
+ if(JewelryNBT.isModifierEffectType(itemstack) && !(JewelryNBT.isJewelX(itemstack, new ItemStack(Item.enderPearl)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Item.pickaxeIron)))) JewelryNBT.addMode(itemstack, "Activated");
if(JewelryNBT.isJewelX(itemstack, new ItemStack(Item.netherStar)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Item.book)))
JewelryNBT.addMode(itemstack, "Disenchant");
return itemstack;
}
+
+ public void createGolems(World world, int i, int j, int k)
+ {
+ if (world.getBlockId(i, j - 1, k) == Block.blockSnow.blockID && world.getBlockId(i, j - 2, k) == Block.blockSnow.blockID)
+ {
+ if (!world.isRemote)
+ {
+ world.setBlock(i, j, k, 0, 0, 2);
+ world.setBlock(i, j - 1, k, 0, 0, 2);
+ world.setBlock(i, j - 2, k, 0, 0, 2);
+ EntitySnowman entitysnowman = new EntitySnowman(world);
+ entitysnowman.setLocationAndAngles((double)i + 0.5D, (double)j - 1.95D, (double)k + 0.5D, 0.0F, 0.0F);
+ world.spawnEntityInWorld(entitysnowman);
+ world.notifyBlockChange(i, j, k, 0);
+ world.notifyBlockChange(i, j - 1, k, 0);
+ world.notifyBlockChange(i, j - 2, k, 0);
+ }
+
+ for (int l = 0; l < 120; ++l)
+ {
+ world.spawnParticle("snowshovel", (double)i + world.rand.nextDouble(), (double)(j - 2) + world.rand.nextDouble() * 2.5D, (double)k + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
+ }
+ }
+ else if (world.getBlockId(i, j - 1, k) == Block.blockIron.blockID && world.getBlockId(i, j - 2, k) == Block.blockIron.blockID)
+ {
+ boolean flag = world.getBlockId(i - 1, j - 1, k) == Block.blockIron.blockID && world.getBlockId(i + 1, j - 1, k) == Block.blockIron.blockID;
+ boolean flag1 = world.getBlockId(i, j - 1, k - 1) == Block.blockIron.blockID && world.getBlockId(i, j - 1, k + 1) == Block.blockIron.blockID;
+
+ if (flag || flag1)
+ {
+ world.setBlock(i, j, k, 0, 0, 2);
+ world.setBlock(i, j - 1, k, 0, 0, 2);
+ world.setBlock(i, j - 2, k, 0, 0, 2);
+
+ if (flag)
+ {
+ world.setBlock(i - 1, j - 1, k, 0, 0, 2);
+ world.setBlock(i + 1, j - 1, k, 0, 0, 2);
+ }
+ else
+ {
+ world.setBlock(i, j - 1, k - 1, 0, 0, 2);
+ world.setBlock(i, j - 1, k + 1, 0, 0, 2);
+ }
+
+ EntityIronGolem entityirongolem = new EntityIronGolem(world);
+ entityirongolem.setPlayerCreated(true);
+ entityirongolem.setLocationAndAngles((double)i + 0.5D, (double)j - 1.95D, (double)k + 0.5D, 0.0F, 0.0F);
+ world.spawnEntityInWorld(entityirongolem);
+
+ for (int i1 = 0; i1 < 120; ++i1)
+ {
+ world.spawnParticle("snowballpoof", (double)i + world.rand.nextDouble(), (double)(j - 2) + world.rand.nextDouble() * 3.9D, (double)k + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
+ }
+
+ world.notifyBlockChange(i, j, k, 0);
+ world.notifyBlockChange(i, j - 1, k, 0);
+ world.notifyBlockChange(i, j - 2, k, 0);
+
+ if (flag)
+ {
+ world.notifyBlockChange(i - 1, j - 1, k, 0);
+ world.notifyBlockChange(i + 1, j - 1, k, 0);
+ }
+ else
+ {
+ world.notifyBlockChange(i, j - 1, k - 1, 0);
+ world.notifyBlockChange(i, j - 1, k + 1, 0);
+ }
+ }
+ }
+ }
}
diff --git a/common/darkknight/jewelrycraft/lib/Reference.java b/common/darkknight/jewelrycraft/lib/Reference.java
index 38d22f6..84914af 100644
--- a/common/darkknight/jewelrycraft/lib/Reference.java
+++ b/common/darkknight/jewelrycraft/lib/Reference.java
@@ -4,6 +4,6 @@ public class Reference
{
public static final String MODID = "Jewelrycraft";
public static final String MODNAME = "Jewelrycraft";
- public static final String VERSION = "1.2.0";
+ public static final String VERSION = "1.3.0";
public static final String PACKET_CHANNEL = "Jewelrycraft";
}
diff --git a/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java b/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java
index 6e396eb..d8e4da2 100644
--- a/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java
+++ b/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java
@@ -21,6 +21,7 @@ public class CraftingRecipes
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", 'x', Item.clay);
GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 1), " x ", "x x", " x ", 'x', Item.clay);
+ GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 2), "x x", "x x", " x ", 'x', Item.clay);
GameRegistry.addRecipe(new ItemStack(ItemList.crystal, 1, 15), " x ", "x x", " x ", 'x', Block.glass);
for(int i=0; i < 15; i++)
{
@@ -34,11 +35,13 @@ public class CraftingRecipes
GameRegistry.addRecipe(new ItemStack(BlockList.jewelCraftingTable), "xxx", "y y", "y y", 'x', Block.planks, 'y', Block.cobblestone);
GameRegistry.addRecipe(new ItemStack(BlockList.displayer, 2), " x ", "xxx", "yyy", 'x', Item.ingotIron, 'y', Block.blockEmerald);
GameRegistry.addRecipe(new ItemStack(BlockList.shadowBlock, 1), "xxx", "xxx", "xxx", 'x', ItemList.shadowIngot);
+ GameRegistry.addRecipe(new ItemStack(BlockList.jewelAltar, 1), "sws", "bwb", "bbb", 's', Block.whiteStone, 'w', new ItemStack(Block.cloth, 1, 5), 'b', Block.netherBrick);
//Smelting
GameRegistry.addSmelting(BlockList.shadowOre.blockID, new ItemStack(ItemList.shadowIngot), 1.5f);
- FurnaceRecipes.smelting().addSmelting(ItemList.clayMolds.itemID, 0, new ItemStack(ItemList.molds, 1, 0), 0.85F);
- FurnaceRecipes.smelting().addSmelting(ItemList.clayMolds.itemID, 1, new ItemStack(ItemList.molds, 1, 1), 0.85F);
+ FurnaceRecipes.smelting().addSmelting(ItemList.clayMolds.itemID, 0, new ItemStack(ItemList.molds, 1, 0), 0.2F);
+ FurnaceRecipes.smelting().addSmelting(ItemList.clayMolds.itemID, 1, new ItemStack(ItemList.molds, 1, 1), 0.2F);
+ FurnaceRecipes.smelting().addSmelting(ItemList.clayMolds.itemID, 2, new ItemStack(ItemList.molds, 1, 2), 0.2F);
isInitialized = true;
}
diff --git a/common/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java b/common/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
index 48f24b4..daa3147 100644
--- a/common/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
+++ b/common/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
@@ -103,7 +103,7 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
{
FontRenderer fontrenderer = RenderManager.instance.getFontRenderer();
float var14 = 0.01266667F * 1.5F;
-// float var17 = 0.015F;
+ float var17 = 0.015F;
GL11.glRotatef(180F, 0F, 0F, 1F);
if(metadata == 0) GL11.glRotatef(0F, 0F, 1F, 0F);
else if(metadata == 1) GL11.glRotatef(270F, 0F, 1F, 0F);
@@ -113,29 +113,118 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
GL11.glScalef(-0.015F, -var14, 0.015F);
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
- GL11.glDepthMask(true);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
int j = fontrenderer.getStringWidth(par2Str) / 2;
tessellator.startDrawingQuads();
- tessellator.setColorRGBA_F(0.2F, 0.2F, 0.2F, 0.8F);
+ tessellator.setColorRGBA_F(0.0F, 0.2F, 0.2F, 0.9F);
tessellator.addVertex((double)(-33.333 - 0), -1D, 0.1D);
tessellator.addVertex((double)(-33.333 - 0), 8D, 0.1D);
tessellator.addVertex((double)(33.333 + 0), 8D, 0.1D);
tessellator.addVertex((double)(33.333 + 0), -1D, 0.1D);
tessellator.draw();
-// if ((fontrenderer.getStringWidth(par2Str)/2) > 20) var17 = 0.9F / fontrenderer.getStringWidth(par2Str);
-// else var17 = var14;
-// GL11.glScalef(var17*70F, 1F, 0F);
- GL11.glEnable(GL11.GL_TEXTURE_2D);
+ if ((fontrenderer.getStringWidth(par2Str)/2) > 20) var17 = 0.9F / fontrenderer.getStringWidth(par2Str);
+ else var17 = var14;
int red = (color >> 16) & 0xFF;
int green = (color >> 8) & 0xFF;
int blue = color & 0xFF;
GL11.glTranslatef((float)x + 1f, (float)y + 1f, (float)z);
- fontrenderer.drawString(par2Str, -j, 0, 65536 * (red/2) + 256 * (green/2) + blue/2);
- GL11.glTranslatef((float)x - 1f, (float)y - 1f, (float)z - 1F);
+ GL11.glPushMatrix();
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glScalef(var17*70F, 1F, 0F);
+ fontrenderer.drawString(par2Str.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 65536 * (red/2) + 256 * (green/2) + blue/2);
+ GL11.glPopMatrix();
+ GL11.glTranslatef((float)x - 1f, (float)y - 1f, (float)z - 1F);
+ GL11.glScalef(var17*70F, 1F, 0F);
fontrenderer.drawString(par2Str, -j, 0, color);
GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
+
+ public void replaceEnumEnchValues(String str, int color)
+ {
+ if(str.contains("§0"))
+ {
+ color = Color.BLACK.getRGB();
+ str.replace("§0", "");
+ }
+ if(str.contains("§1"))
+ {
+ color = 85;
+ str.replace("§1", "");
+ }
+ if(str.contains("§2"))
+ {
+ color = 17920;
+ str.replace("§2", "");
+ }
+ if(str.contains("§3"))
+ {
+ color = 1336183;
+ str.replace("§3", "");
+ }
+ if(str.contains("§4"))
+ {
+ color = 4587520;
+ str.replace("§4", "");
+ }
+ if(str.contains("§5"))
+ {
+ color = 5701759;
+ str.replace("§5", "");
+ }
+ if(str.contains("§6"))
+ {
+ color = 16762880;
+ str.replace("§6", "");
+ }
+ if(str.contains("§7"))
+ {
+ color = Color.GRAY.getRGB();
+ str.replace("§7", "");
+ }
+ if(str.contains("§8"))
+ {
+ color = Color.DARK_GRAY.getRGB();
+ str.replace("§8", "");
+ }
+ if(str.contains("§9"))
+ {
+ color = Color.BLUE.getRGB();
+ str.replace("§9", "");
+ }
+ if(str.contains("§a"))
+ {
+ color = Color.GREEN.getRGB();
+ str.replace("§a", "");
+ }
+ if(str.contains("§b"))
+ {
+ color = Color.CYAN.getRGB();
+ str.replace("§b", "");
+ }
+ if(str.contains("§c"))
+ {
+ color = Color.RED.getRGB();
+ str.replace("§c", "");
+ }
+ if(str.contains("§d"))
+ {
+ color = 11665663;
+ str.replace("§d", "");
+ }
+ if(str.contains("§e"))
+ {
+ color = Color.YELLOW.getRGB();
+ str.replace("§e", "");
+ }
+ if(str.contains("§f"))
+ {
+ color = Color.WHITE.getRGB();
+ str.replace("§f", "");
+ }
+ }
}
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java b/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
new file mode 100644
index 0000000..a0c0a3e
--- /dev/null
+++ b/common/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
@@ -0,0 +1,145 @@
+package darkknight.jewelrycraft.tileentity;
+
+import java.util.List;
+
+import darkknight.jewelrycraft.util.JewelryNBT;
+import net.minecraft.block.Block;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.INetworkManager;
+import net.minecraft.network.packet.Packet;
+import net.minecraft.network.packet.Packet132TileEntityData;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+
+public class TileEntityAltar extends TileEntity
+{
+ public ItemStack object;
+ public boolean isDirty, hasObject;
+ public String playerName;
+
+ public TileEntityAltar()
+ {
+ this.hasObject = false;
+ this.object = new ItemStack(0, 0, 0);
+ this.isDirty = false;
+ this.playerName = "";
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ NBTTagCompound tag = new NBTTagCompound();
+ this.object.writeToNBT(tag);
+ nbt.setCompoundTag("object", tag);
+ nbt.setBoolean("hasObject", hasObject);
+ nbt.setString("playerName", playerName);
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ this.object = new ItemStack(0, 0, 0);
+ this.object.readFromNBT(nbt.getCompoundTag("object"));
+ this.hasObject = nbt.getBoolean("hasObject");
+ this.playerName = nbt.getString("playerName");
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+
+ if(isDirty)
+ {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ isDirty = true;
+ }
+ if(hasObject && playerName != "")
+ {
+ //int playerPosX = (int)player.posX, playerPosY = (int)player.posY, playerPosZ = (int)player.posZ;
+ List entitiesR = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1D, zCoord, xCoord + 0.5D, yCoord + 2D, zCoord + 0.5D));
+ List entitiesN = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5D, yCoord + 1D, zCoord - 0.5D, xCoord + 1.5D, yCoord + 2D, zCoord + 1.5D));
+ if(object.getUnlocalizedName().contains("ring"))
+ {
+ if (JewelryNBT.isJewelX(object, new ItemStack(Item.enderPearl)) && JewelryNBT.dimension(object) != -2 && JewelryNBT.playerPosX(object) != -1 && JewelryNBT.playerPosY(object) != -1 && JewelryNBT.playerPosZ(object) != -1)
+ {
+ double posX = JewelryNBT.playerPosX(object), posY = JewelryNBT.playerPosY(object), posZ = JewelryNBT.playerPosZ(object);
+ int dimension = JewelryNBT.dimension(object);
+ for(int i = 0; i < entitiesR.size(); i++)
+ {
+ EntityLivingBase entity = (EntityLivingBase) entitiesR.get(i);
+ if (!JewelryNBT.isDimensionX(object, entity.dimension) && JewelryNBT.isModifierX(object, new ItemStack(Item.bed))){
+ entity.travelToDimension(dimension);
+ entity.setPositionAndUpdate(posX, posY, posZ);
+ }
+ else if(JewelryNBT.isDimensionX(object, entity.dimension)) entity.setPositionAndUpdate(posX, posY, posZ);
+ }
+ }
+ if (JewelryNBT.isModifierX(object, new ItemStack(Item.dyePowder, 1, 15)))
+ {
+ for(int i=-1; i<=1; i++)
+ for(int j=-1; j<=1; j++)
+ for(int k=-1; k<=1; k++)
+ {
+ //if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.dirt.blockID && (worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == 0 || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.crops.blockID) || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.potato.blockID) worldObj.setBlock(xCoord + i, yCoord + j, zCoord + k, Block.tilledField.blockID);
+ if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.tilledField.blockID) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
+ if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) != Block.tilledField.blockID) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k), 5);
+ //JewelrycraftUtil.applyBonemeal(object, worldObj, xCoord + i, yCoord + j, zCoord + k, player);
+ }
+ }
+ }
+ else if(object.getUnlocalizedName().contains("necklace"))
+ {
+ if (JewelryNBT.isJewelX(object, new ItemStack(Item.enderPearl)) && JewelryNBT.dimension(object) != -2 && JewelryNBT.playerPosX(object) != -1 && JewelryNBT.playerPosY(object) != -1 && JewelryNBT.playerPosZ(object) != -1)
+ {
+ double posX = JewelryNBT.playerPosX(object), posY = JewelryNBT.playerPosY(object), posZ = JewelryNBT.playerPosZ(object);
+ int dimension = JewelryNBT.dimension(object);
+ for(int i = 0; i < entitiesN.size(); i++)
+ {
+ EntityLivingBase entity = (EntityLivingBase) entitiesN.get(i);
+ if (!JewelryNBT.isDimensionX(object, entity.dimension) && JewelryNBT.isModifierX(object, new ItemStack(Item.bed))){
+ entity.travelToDimension(dimension);
+ entity.setPositionAndUpdate(posX, posY, posZ);
+ }
+ else if(JewelryNBT.isDimensionX(object, entity.dimension)) entity.setPositionAndUpdate(posX, posY, posZ);
+ }
+ }
+ if (JewelryNBT.isModifierX(object, new ItemStack(Item.dyePowder, 1, 15)))
+ {
+ for(int i=-3; i<=3; i++)
+ for(int j=-1; j<=1; j++)
+ for(int k=-3; k<=3; k++)
+ {
+ //if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.dirt.blockID && (worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == 0 || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.crops.blockID) || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.potato.blockID) worldObj.setBlock(xCoord + i, yCoord + j, zCoord + k, Block.tilledField.blockID);
+ if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.tilledField.blockID) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
+ if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) != Block.tilledField.blockID) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k), 5);
+ //JewelrycraftUtil.applyBonemeal(object, worldObj, xCoord + i, yCoord + j, zCoord + k, player);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public Packet getDescriptionPacket()
+ {
+ Packet132TileEntityData packet = (Packet132TileEntityData) super.getDescriptionPacket();
+ NBTTagCompound dataTag = packet != null ? packet.data : new NBTTagCompound();
+ writeToNBT(dataTag);
+ return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, dataTag);
+ }
+
+ @Override
+ public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
+ {
+ super.onDataPacket(net, pkt);
+ NBTTagCompound tag = pkt != null ? pkt.data : new NBTTagCompound();
+ readFromNBT(tag);
+ }
+}
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
index 9018b0b..05e6e34 100644
--- a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
+++ b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
@@ -92,8 +92,10 @@ public class TileEntityMolder extends TileEntity
this.hasMoltenMetal = false;
if (mold.getItemDamage() == 0)
this.jewelBase = moltenMetal;
- else
+ else if (mold.getItemDamage() == 1)
this.jewelBase = new ItemStack(ItemList.ring);
+ else
+ this.jewelBase = new ItemStack(ItemList.necklace);
if(mold.getItemDamage() != 0 && jewelBase != new ItemStack(0, 0, 0))
JewelryNBT.addMetal(jewelBase, ringMetal);
this.moltenMetal = new ItemStack(0, 0, 0);
diff --git a/common/darkknight/jewelrycraft/util/JewelryNBT.java b/common/darkknight/jewelrycraft/util/JewelryNBT.java
index 263b6b6..d7d396d 100644
--- a/common/darkknight/jewelrycraft/util/JewelryNBT.java
+++ b/common/darkknight/jewelrycraft/util/JewelryNBT.java
@@ -1,5 +1,7 @@
package darkknight.jewelrycraft.util;
+import java.util.List;
+
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -7,10 +9,17 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
public class JewelryNBT
{
-
+ //TODO NBT Tag Adding
+ /**
+ *
+ * @param item The item you want to add the NBT data on
+ * @param metal The metal you want to add on the item
+ */
public static void addMetal(ItemStack item, ItemStack metal)
{
NBTTagCompound itemStackData;
@@ -26,34 +35,50 @@ public class JewelryNBT
itemStackData.setTag("ingot", ingotNBT);
}
+ /**
+ *
+ * @param item The item you want to add the NBT data on
+ * @param jewel The jewel you want to add on the item
+ */
public static void addJewel(ItemStack item, ItemStack jewel)
{
- NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
- else
+ if(jewel != null)
{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
+ 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);
}
- NBTTagCompound jewelNBT = new NBTTagCompound();
- jewel.writeToNBT(jewelNBT);
- itemStackData.setTag("jewel", jewelNBT);
}
+ /**
+ *
+ * @param item The item you want to add the NBT data on
+ * @param modifier The modifier you want to add on the item
+ */
public static void addModifier(ItemStack item, ItemStack modifier)
{
- NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
- else
+ if(modifier != null)
{
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
+ 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);
}
- NBTTagCompound modifierNBT = new NBTTagCompound();
- modifier.writeToNBT(modifierNBT);
- itemStackData.setTag("modifier", modifierNBT);
}
public static void addEntity(ItemStack item, EntityLivingBase entity)
@@ -106,6 +131,49 @@ public class JewelryNBT
itemStackData.setTag("z", coords);
}
+ public static void addTileEntityBlock(ItemStack item, World world, int x, int y, int z)
+ {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else
+ {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound tileNBT = new NBTTagCompound();
+ NBTTagCompound block = new NBTTagCompound();
+ world.getBlockTileEntity(x, y, z).writeToNBT(tileNBT);
+ itemStackData.setTag("tile", tileNBT);
+ block.setInteger("blockID", world.getBlockId(x, y, z));
+ block.setInteger("metadata", world.getBlockMetadata(x, y, z));
+ block.setInteger("blockX", x);
+ block.setInteger("blockY", y);
+ block.setInteger("blockZ", z);
+ itemStackData.setTag("metadata", block);
+ itemStackData.setTag("blockID", block);
+ itemStackData.setTag("blockX", block);
+ itemStackData.setTag("blockY", block);
+ itemStackData.setTag("blockZ", block);
+ }
+
+ public static void addBlock(ItemStack item, int block, int metadata)
+ {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else
+ {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound blockNBT = new NBTTagCompound();
+ blockNBT.setInteger("blockID", block);
+ itemStackData.setTag("blockID", blockNBT);
+ blockNBT.setInteger("metadata", metadata);
+ itemStackData.setTag("metadata", blockNBT);
+ }
+
public static void addBlockCoordonates(ItemStack item, int x, int y, int z)
{
NBTTagCompound itemStackData;
@@ -162,8 +230,8 @@ public class JewelryNBT
mode.setString("mode", modeN);
itemStackData.setTag("mode", mode);
}
-
- public static void removeNBT(ItemStack item, String tag)
+
+ public static void addFakeEnchantment(ItemStack item)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound())
@@ -173,10 +241,10 @@ public class JewelryNBT
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
- itemStackData.removeTag(tag);
+ itemStackData.setTag("ench", new NBTTagList("ench"));
}
-
- public static boolean hasTag(ItemStack item, String tag)
+
+ public static void addIngotColor(ItemStack item, int color)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound())
@@ -186,10 +254,56 @@ public class JewelryNBT
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
- if(itemStackData.hasKey(tag)) return true;
- return false;
+ NBTTagCompound colors = new NBTTagCompound();
+ colors.setInteger("ingotColor", color);
+ itemStackData.setTag("ingotColor", colors);
}
-
+
+ public static void addJewelColor(ItemStack item, int color)
+ {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else
+ {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound colors = new NBTTagCompound();
+ colors.setInteger("jewelColor", color);
+ itemStackData.setTag("jewelColor", colors);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static void addEntities(ItemStack item, List list)
+ {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else
+ {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ NBTTagCompound entityNBT = new NBTTagCompound();
+ for(int i=0; i < list.size(); i++) ((EntityLivingBase) list.get(i)).writeToNBT(entityNBT);
+ itemStackData.setTag("entities", entityNBT);
+ }
+
+ //TODO NBT Tag Removing
+ public static void removeNBT(ItemStack item, String tag)
+ {
+ NBTTagCompound itemStackData;
+ if (item.hasTagCompound())
+ itemStackData = item.getTagCompound();
+ else
+ {
+ itemStackData = new NBTTagCompound();
+ item.setTagCompound(itemStackData);
+ }
+ itemStackData.removeTag(tag);
+ }
+
public static void removeEntity(ItemStack item)
{
JewelryNBT.removeNBT(item, "entityID");
@@ -197,7 +311,18 @@ public class JewelryNBT
JewelryNBT.removeNBT(item, "ench");
}
- public static void addFakeEnchantment(ItemStack item)
+ public static void removeBlock(ItemStack item)
+ {
+ JewelryNBT.removeNBT(item, "blockID");
+ JewelryNBT.removeNBT(item, "metadata");
+ JewelryNBT.removeNBT(item, "tile");
+ JewelryNBT.removeNBT(item, "blockX");
+ JewelryNBT.removeNBT(item, "blockY");
+ JewelryNBT.removeNBT(item, "blockZ");
+ }
+
+ //TODO NTB Tag Checking
+ public static boolean hasTag(ItemStack item, String tag)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound())
@@ -207,9 +332,62 @@ public class JewelryNBT
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
- itemStackData.setTag("ench", new NBTTagList("ench"));
+ if(itemStackData.hasKey(tag)) return true;
+ return false;
+ }
+
+ public static boolean isJewelX(ItemStack stack, ItemStack jewel)
+ {
+ if(jewel(stack) != null && jewel(stack).itemID == jewel.itemID && jewel(stack).getItemDamage() == jewel.getItemDamage()) return true;
+ return false;
+ }
+
+ public static boolean isModifierX(ItemStack stack, ItemStack modifier)
+ {
+ if(modifier(stack) != null && modifier(stack).itemID == modifier.itemID && modifier(stack).getItemDamage() == modifier.getItemDamage()) return true;
+ return false;
}
+ public static boolean isModifierEffectType(ItemStack stack)
+ {
+ if(modifier(stack) != null && (isModifierX(stack, new ItemStack(Item.blazePowder)) || isModifierX(stack, new ItemStack(Item.sugar))
+ || isModifierX(stack, new ItemStack(Item.pickaxeIron)) || isModifierX(stack, new ItemStack(Item.feather))
+ || isModifierX(stack, new ItemStack(Item.potion, 1, 8270)))) return true;
+ return false;
+ }
+
+ public static boolean isIngotX(ItemStack stack, ItemStack ingot)
+ {
+ if(ingot(stack) != null && ingot(stack).itemID == ingot.itemID && ingot(stack).getItemDamage() == ingot.getItemDamage()) return true;
+ return false;
+ }
+
+ public static boolean isModeX(ItemStack stack, String modeN)
+ {
+ if(modeName(stack) != null && modeName(stack).equals(modeN)) return true;
+ return false;
+ }
+
+ public static boolean isEntityX(ItemStack stack, EntityPlayer player, EntityLivingBase entity)
+ {
+ if(entity != null && entity instanceof EntityLivingBase && entity(stack, player) != null && entity(stack, player).equals(entity)) return true;
+ return false;
+ }
+
+ public static boolean isDimNameX(ItemStack stack, String dimName)
+ {
+ if(ingot(stack) != null && dimName(stack).equals(dimName)) return true;
+ return false;
+ }
+
+ public static boolean isDimensionX(ItemStack stack, int dimension)
+ {
+ if(dimension(stack) != -2 && dimension(stack) == dimension) return true;
+ return false;
+ }
+
+ //TODO Return components based on NBT
+
public static ItemStack jewel(ItemStack stack)
{
if(stack != null && stack != new ItemStack(0, 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("jewel"))
@@ -222,12 +400,6 @@ public class JewelryNBT
return null;
}
- public static boolean isJewelX(ItemStack stack, ItemStack jewel)
- {
- if(jewel(stack) != null && jewel(stack).itemID == jewel.itemID && jewel(stack).getItemDamage() == jewel.getItemDamage()) return true;
- return false;
- }
-
public static ItemStack modifier(ItemStack stack)
{
if(stack != null && stack != new ItemStack(0, 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("modifier"))
@@ -240,20 +412,6 @@ public class JewelryNBT
return null;
}
- public static boolean isModifierX(ItemStack stack, ItemStack modifier)
- {
- if(modifier(stack) != null && modifier(stack).itemID == modifier.itemID && modifier(stack).getItemDamage() == modifier.getItemDamage()) return true;
- return false;
- }
-
- public static boolean isModifierEffectType(ItemStack stack)
- {
- if(modifier(stack) != null && (isModifierX(stack, new ItemStack(Item.blazePowder)) || isModifierX(stack, new ItemStack(Item.sugar))
- || isModifierX(stack, new ItemStack(Item.pickaxeIron)) || isModifierX(stack, new ItemStack(Item.feather))
- || isModifierX(stack, new ItemStack(Item.potion, 1, 8270)))) return true;
- return false;
- }
-
public static ItemStack ingot(ItemStack stack)
{
if(stack != null && stack != new ItemStack(0, 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingot"))
@@ -266,18 +424,6 @@ public class JewelryNBT
return null;
}
- public static boolean isIngotX(ItemStack stack, ItemStack ingot)
- {
- if(ingot(stack) != null && ingot(stack).itemID == ingot.itemID && ingot(stack).getItemDamage() == ingot.getItemDamage()) return true;
- return false;
- }
-
- public static boolean isModeX(ItemStack stack, String modeN)
- {
- if(modeName(stack) != null && modeName(stack).equals(modeN)) return true;
- return false;
- }
-
public static EntityLivingBase entity(ItemStack stack, EntityPlayer player)
{
if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("entityID") && stack.getTagCompound().hasKey("entity"))
@@ -297,10 +443,20 @@ public class JewelryNBT
return null;
}
- public static boolean isEntityX(ItemStack stack, EntityPlayer player, EntityLivingBase entity)
+ public static TileEntity tileEntity(ItemStack stack)
{
- if(entity != null && entity instanceof EntityLivingBase && entity(stack, player) != null && entity(stack, player).equals(entity)) return true;
- return false;
+ if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("tile"))
+ {
+ NBTTagCompound tileNBT = (NBTTagCompound) stack.getTagCompound().getTag("tile");
+ TileEntity tile = (TileEntity) TileEntity.createAndLoadEntity(tileNBT);
+ if(tile != null && tile instanceof TileEntity)
+ {
+ tile.readFromNBT(tileNBT);
+ return tile;
+ }
+ else return null;
+ }
+ return null;
}
public static String dimName(ItemStack stack)
@@ -325,12 +481,6 @@ public class JewelryNBT
return null;
}
- public static boolean isDimNameX(ItemStack stack, String dimName)
- {
- if(ingot(stack) != null && dimName(stack).equals(dimName)) return true;
- return false;
- }
-
public static int dimension(ItemStack stack)
{
if(stack != null && stack != new ItemStack(0, 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("dimension"))
@@ -342,12 +492,6 @@ public class JewelryNBT
return -2;
}
- public static boolean isDimensionX(ItemStack stack, int dimension)
- {
- if(dimension(stack) != -2 && dimension(stack) == dimension) return true;
- return false;
- }
-
public static int blockCoordX(ItemStack stack)
{
if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("blockX"))
@@ -381,6 +525,28 @@ public class JewelryNBT
return -1;
}
+ public static int blockID(ItemStack stack)
+ {
+ if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("blockID"))
+ {
+ NBTTagCompound blockID = (NBTTagCompound) stack.getTagCompound().getTag("blockID");
+ int blockId = blockID.getInteger("blockID");
+ return blockId;
+ }
+ return -1;
+ }
+
+ public static int blockMetadata(ItemStack stack)
+ {
+ if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("metadata"))
+ {
+ NBTTagCompound metadataNBT = (NBTTagCompound) stack.getTagCompound().getTag("metadata");
+ int metadata = metadataNBT.getInteger("metadata");
+ return metadata;
+ }
+ return -1;
+ }
+
public static double playerPosX(ItemStack stack)
{
if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("x"))
@@ -414,21 +580,6 @@ public class JewelryNBT
return -1;
}
- public static void addIngotColor(ItemStack item, int color)
- {
- NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
- else
- {
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- NBTTagCompound colors = new NBTTagCompound();
- colors.setInteger("ingotColor", color);
- itemStackData.setTag("ingotColor", colors);
- }
-
public static int ingotColor(ItemStack stack)
{
if(stack != null && stack != new ItemStack(0, 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingotColor"))
@@ -440,21 +591,6 @@ public class JewelryNBT
return 16777215;
}
- public static void addJewelColor(ItemStack item, int color)
- {
- NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
- else
- {
- itemStackData = new NBTTagCompound();
- item.setTagCompound(itemStackData);
- }
- NBTTagCompound colors = new NBTTagCompound();
- colors.setInteger("jewelColor", color);
- itemStackData.setTag("jewelColor", colors);
- }
-
public static int jewelColor(ItemStack stack)
{
if(stack != null && stack != new ItemStack(0, 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("jewelColor"))
@@ -465,4 +601,23 @@ public class JewelryNBT
}
return 16777215;
}
+
+ @SuppressWarnings({ "rawtypes", "unchecked", "null" })
+ public static List entities(ItemStack stack, EntityPlayer player)
+ {
+ if (stack != null && stack != new ItemStack(0, 0, 0) && stack.getTagCompound().hasKey("entities"))
+ {
+ NBTTagCompound enID = (NBTTagCompound) stack.getTagCompound().getTag("entitiesID");
+ List list = null;
+ int[] entityID;
+ EntityLivingBase entity;
+ entityID = enID.getIntArray("entitiesID");
+ for(int i = 0; i < entityID.length; i++){
+ entity = (EntityLivingBase) EntityList.createEntityByID(entityID[i], player.worldObj);
+ list.add(entity);
+ }
+ return list;
+ }
+ return null;
+ }
}
diff --git a/common/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/common/darkknight/jewelrycraft/util/JewelrycraftUtil.java
index 4247175..4fabc21 100644
--- a/common/darkknight/jewelrycraft/util/JewelrycraftUtil.java
+++ b/common/darkknight/jewelrycraft/util/JewelrycraftUtil.java
@@ -3,6 +3,7 @@ package darkknight.jewelrycraft.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
@@ -18,6 +19,7 @@ public class JewelrycraftUtil
public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
public static ArrayList<String> jamcraftPlayers = new ArrayList<String>();
public static HashMap<ItemStack, ItemStack> combinations = new HashMap<ItemStack, ItemStack>();
+ public static Random rand = new Random();
public static void addStuff()
{
@@ -25,10 +27,14 @@ public class JewelrycraftUtil
modifiers.add(new ItemStack(Block.chest));
modifiers.add(new ItemStack(Block.torchWood));
modifiers.add(new ItemStack(Item.book));
+ modifiers.add(new ItemStack(Item.dyePowder, 1, 15));
+ modifiers.add(new ItemStack(Item.bone));
modifiers.add(new ItemStack(Item.sugar));
modifiers.add(new ItemStack(Item.feather));
modifiers.add(new ItemStack(Item.bed));
modifiers.add(new ItemStack(Item.pickaxeIron));
+ modifiers.add(new ItemStack(Item.redstone));
+ modifiers.add(new ItemStack(Item.pickaxeDiamond));
modifiers.add(new ItemStack(Item.blazePowder));
modifiers.add(new ItemStack(Item.eyeOfEnder));
modifiers.add(new ItemStack(Item.potion, 1, 8270));
@@ -36,9 +42,7 @@ public class JewelrycraftUtil
//Jewels
for(int i=0; i <= 16; i++)
jewel.add(new ItemStack(ItemList.crystal, 1, i));
- jewel.add(new ItemStack(Item.redstone));
jewel.add(new ItemStack(Block.blockRedstone));
- jewel.add(new ItemStack(Item.dyePowder, 1, 4));
jewel.add(new ItemStack(Block.blockLapis));
jewel.add(new ItemStack(Block.obsidian));
jewel.add(new ItemStack(Item.diamond));
@@ -48,6 +52,7 @@ public class JewelrycraftUtil
//Jewelry
jewelry.add(new ItemStack(ItemList.ring));
+ jewelry.add(new ItemStack(ItemList.necklace));
}
public static void addSpecialCombinations()
diff --git a/resources/assets/jewelrycraft/Changelog.txt b/resources/assets/jewelrycraft/Changelog.txt
index c295992..3035388 100644
--- a/resources/assets/jewelrycraft/Changelog.txt
+++ b/resources/assets/jewelrycraft/Changelog.txt
@@ -11,6 +11,8 @@
- Removed animation from the Shadow Ore
- Made Shadow Ore more common
- Balanced Villager trades
+- Fixed Displayer text rendering in front of everything
+- Added the Jewel Altar
TODO
- Make it so you can smelt ores in the smelter
diff --git a/resources/assets/jewelrycraft/lang/en_US.lang b/resources/assets/jewelrycraft/lang/en_US.lang
index 4209988..41bffe7 100644
--- a/resources/assets/jewelrycraft/lang/en_US.lang
+++ b/resources/assets/jewelrycraft/lang/en_US.lang
@@ -7,6 +7,7 @@ item.Jewelrycraft.mold.clayIngot.name=Clay Ingot Mold
item.Jewelrycraft.mold.clayRing.name=Clay Ring Mold
item.Jewelrycraft.mold.clayNecklace.name=Clay Necklace Mold
item.Jewelrycraft.ring.name=Ring
+item.Jewelrycraft.necklace.name=Necklace
item.Jewelrycraft.crystal.name=Crystal
tile.Jewelrycraft.oreShadow.name=Shadow Ore
tile.Jewelrycraft.blockShadow.name=Shadow Block
@@ -15,6 +16,7 @@ tile.Jewelrycraft.smelter.name=Smelter
tile.Jewelrycraft.molder.name=Molder
tile.Jewelrycraft.displayer.name=Storage Displayer
tile.Jewelrycraft.jewelCraftingTable.name=Jeweler's Crafting Table
+tile.Jewelrycraft.altar.name=Jewel Altar
itemGroup.JewelryCraft=Jewelrycraft
itemGroup.Rings=Jewelrycraft Rings
chatmessage.Jewelrycraft.molder.addedmold=Added %s to molder.
@@ -34,7 +36,7 @@ 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.missingjewelryandmodifierorjewel=You need a ring and a modifier or a jewel.
+chatmessage.Jewelrycraft.table.missingjewelryandmodifierorjewel=You need a jewelry piece and a modifier or a jewel.
chatmessage.Jewelrycraft.table.missingjewelry=You're missing a piece of jewelry.
chatmessage.Jewelrycraft.table.missingmodifierorjewel=You need a modifier or a jewel.
chatmessage.Jewelrycraft.table.iscrafting=The %s is being modified.
diff --git a/resources/assets/jewelrycraft/textures/blocks/altar_bottom.png b/resources/assets/jewelrycraft/textures/blocks/altar_bottom.png
new file mode 100644
index 0000000..7ca4c6a
--- /dev/null
+++ b/resources/assets/jewelrycraft/textures/blocks/altar_bottom.png
Binary files differ
diff --git a/resources/assets/jewelrycraft/textures/blocks/altar_side.png b/resources/assets/jewelrycraft/textures/blocks/altar_side.png
new file mode 100644
index 0000000..3a69977
--- /dev/null
+++ b/resources/assets/jewelrycraft/textures/blocks/altar_side.png
Binary files differ
diff --git a/resources/assets/jewelrycraft/textures/blocks/altar_top.png b/resources/assets/jewelrycraft/textures/blocks/altar_top.png
new file mode 100644
index 0000000..39210c3
--- /dev/null
+++ b/resources/assets/jewelrycraft/textures/blocks/altar_top.png
Binary files differ
diff --git a/resources/assets/jewelrycraft/textures/blocks/oreShadow.png.mcmeta b/resources/assets/jewelrycraft/textures/blocks/oreShadow.png.mcmeta
deleted file mode 100644
index bf4c01e..0000000
--- a/resources/assets/jewelrycraft/textures/blocks/oreShadow.png.mcmeta
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "animation": {
- "frametime": 1
- }
-} \ No newline at end of file
diff --git a/resources/assets/jewelrycraft/textures/items/ingotShadow.png b/resources/assets/jewelrycraft/textures/items/ingotShadow.png
index 82b57c7..e3b3aed 100644
--- a/resources/assets/jewelrycraft/textures/items/ingotShadow.png
+++ b/resources/assets/jewelrycraft/textures/items/ingotShadow.png
Binary files differ
diff --git a/resources/assets/jewelrycraft/textures/items/jewelNecklace.png b/resources/assets/jewelrycraft/textures/items/jewelNecklace.png
new file mode 100644
index 0000000..41244d4
--- /dev/null
+++ b/resources/assets/jewelrycraft/textures/items/jewelNecklace.png
Binary files differ
diff --git a/resources/assets/jewelrycraft/textures/items/jewel.png b/resources/assets/jewelrycraft/textures/items/jewelRing.png
index 4875772..4875772 100644
--- a/resources/assets/jewelrycraft/textures/items/jewel.png
+++ b/resources/assets/jewelrycraft/textures/items/jewelRing.png
Binary files differ