summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
commit420faddca46e70e3a70def168fb4e452ef193b0d (patch)
tree247e334012e4bf9e4fa6d42718bf601ce6bd42d9 /java
parent3f4c717de5ebc9b942d65ae45ac87c43bdf8a31b (diff)
Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :)
Diffstat (limited to 'java')
-rw-r--r--java/com/pau101/util/BezierUtils.java98
-rw-r--r--java/com/pau101/util/CubicBezier.java28
-rw-r--r--java/darkknight/jewelrycraft/CommonProxy.java15
-rw-r--r--java/darkknight/jewelrycraft/CreativeTabLiquids.java32
-rw-r--r--java/darkknight/jewelrycraft/JewelrycraftMod.java87
-rw-r--r--java/darkknight/jewelrycraft/block/BlockDisplayer.java239
-rw-r--r--java/darkknight/jewelrycraft/block/BlockGlow.java39
-rw-r--r--java/darkknight/jewelrycraft/block/BlockHandPedestal.java117
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJCOre.java6
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJewelAltar.java101
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java166
-rw-r--r--java/darkknight/jewelrycraft/block/BlockList.java14
-rw-r--r--java/darkknight/jewelrycraft/block/BlockMolder.java117
-rw-r--r--java/darkknight/jewelrycraft/block/BlockMoltenMetal.java236
-rw-r--r--java/darkknight/jewelrycraft/block/BlockShadow.java120
-rw-r--r--java/darkknight/jewelrycraft/block/BlockShadowEye.java61
-rw-r--r--java/darkknight/jewelrycraft/block/BlockShadowHand.java74
-rw-r--r--java/darkknight/jewelrycraft/block/BlockSmelter.java138
-rw-r--r--java/darkknight/jewelrycraft/client/ClientProxy.java39
-rw-r--r--java/darkknight/jewelrycraft/client/GuiGuide.java143
-rw-r--r--java/darkknight/jewelrycraft/client/GuiJewelry.java41
-rw-r--r--java/darkknight/jewelrycraft/client/GuiRingChest.java27
-rw-r--r--java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java124
-rw-r--r--java/darkknight/jewelrycraft/config/ConfigHandler.java17
-rw-r--r--java/darkknight/jewelrycraft/container/ContainerGuide.java10
-rw-r--r--java/darkknight/jewelrycraft/container/ContainerJewelryTab.java96
-rw-r--r--java/darkknight/jewelrycraft/container/ContainerRingChest.java59
-rw-r--r--java/darkknight/jewelrycraft/container/GuiHandler.java41
-rw-r--r--java/darkknight/jewelrycraft/container/GuiRectangle.java48
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTab.java53
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabBlocks.java128
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java46
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabItems.java164
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabModifiers.java49
-rw-r--r--java/darkknight/jewelrycraft/container/JewelryInventory.java111
-rw-r--r--java/darkknight/jewelrycraft/container/Page.java232
-rw-r--r--java/darkknight/jewelrycraft/container/SlotBracelet.java52
-rw-r--r--java/darkknight/jewelrycraft/container/SlotEarrings.java52
-rw-r--r--java/darkknight/jewelrycraft/container/SlotNecklace.java52
-rw-r--r--java/darkknight/jewelrycraft/container/SlotRing.java19
-rw-r--r--java/darkknight/jewelrycraft/container/SlotRingChest.java21
-rw-r--r--java/darkknight/jewelrycraft/curses/Curse.java85
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseBlind.java25
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java23
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseGreed.java30
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseList.java24
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseRottenHeart.java25
-rw-r--r--java/darkknight/jewelrycraft/damage/DamageSourceList.java27
-rw-r--r--java/darkknight/jewelrycraft/effects/EffectBlazePowder.java86
-rw-r--r--java/darkknight/jewelrycraft/effects/EffectEnderEye.java53
-rw-r--r--java/darkknight/jewelrycraft/effects/EffectFeather.java69
-rw-r--r--java/darkknight/jewelrycraft/effects/EffectsList.java22
-rw-r--r--java/darkknight/jewelrycraft/effects/ModifierEffects.java82
-rw-r--r--java/darkknight/jewelrycraft/entities/EntityHalfHeart.java45
-rw-r--r--java/darkknight/jewelrycraft/entities/EntityHeart.java107
-rw-r--r--java/darkknight/jewelrycraft/entities/renders/HeartRender.java44
-rw-r--r--java/darkknight/jewelrycraft/events/BucketHandler.java48
-rw-r--r--java/darkknight/jewelrycraft/events/EntityEventHandler.java387
-rw-r--r--java/darkknight/jewelrycraft/events/KeyBindings.java10
-rw-r--r--java/darkknight/jewelrycraft/events/PlayerRenderHandler.java20
-rw-r--r--java/darkknight/jewelrycraft/events/ScreenHandler.java112
-rw-r--r--java/darkknight/jewelrycraft/item/ItemBaseJewelry.java239
-rw-r--r--java/darkknight/jewelrycraft/item/ItemBracelet.java19
-rw-r--r--java/darkknight/jewelrycraft/item/ItemClayMolds.java62
-rw-r--r--java/darkknight/jewelrycraft/item/ItemCrystal.java75
-rw-r--r--java/darkknight/jewelrycraft/item/ItemEarrings.java19
-rw-r--r--java/darkknight/jewelrycraft/item/ItemGuide.java16
-rw-r--r--java/darkknight/jewelrycraft/item/ItemList.java27
-rw-r--r--java/darkknight/jewelrycraft/item/ItemMolds.java62
-rw-r--r--java/darkknight/jewelrycraft/item/ItemMoltenMetal.java97
-rw-r--r--java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java293
-rw-r--r--java/darkknight/jewelrycraft/item/ItemNecklace.java19
-rw-r--r--java/darkknight/jewelrycraft/item/ItemRing.java20
-rw-r--r--java/darkknight/jewelrycraft/item/ItemThiefGloves.java135
-rw-r--r--java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java71
-rw-r--r--java/darkknight/jewelrycraft/model/ModelDisplayer.java32
-rw-r--r--java/darkknight/jewelrycraft/model/ModelHalfHeart.java497
-rw-r--r--java/darkknight/jewelrycraft/model/ModelHandPedestal.java254
-rw-r--r--java/darkknight/jewelrycraft/model/ModelHeart.java539
-rw-r--r--java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java29
-rw-r--r--java/darkknight/jewelrycraft/model/ModelMask.java1134
-rw-r--r--java/darkknight/jewelrycraft/model/ModelMolder.java29
-rw-r--r--java/darkknight/jewelrycraft/model/ModelShadowEye.java112
-rw-r--r--java/darkknight/jewelrycraft/model/ModelShadowHand.java170
-rw-r--r--java/darkknight/jewelrycraft/model/ModelSmelter.java29
-rw-r--r--java/darkknight/jewelrycraft/network/PacketClearColorCache.java26
-rw-r--r--java/darkknight/jewelrycraft/network/PacketHandler.java4
-rw-r--r--java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java29
-rw-r--r--java/darkknight/jewelrycraft/network/PacketRequestLiquidData.java42
-rw-r--r--java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java31
-rw-r--r--java/darkknight/jewelrycraft/network/PacketSendLiquidData.java40
-rw-r--r--java/darkknight/jewelrycraft/network/PacketSendPlayerInfo.java31
-rw-r--r--java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java67
-rw-r--r--java/darkknight/jewelrycraft/particles/EntityShadowsFX.java75
-rw-r--r--java/darkknight/jewelrycraft/recipes/CraftingRecipes.java39
-rw-r--r--java/darkknight/jewelrycraft/renders/TileEntityHandPedestalRender.java97
-rw-r--r--java/darkknight/jewelrycraft/renders/TileEntityShadowHandRender.java90
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java145
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java42
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java83
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java164
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java153
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java116
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java175
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java77
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java167
-rw-r--r--java/darkknight/jewelrycraft/tileentity/renders/ItemRender.java (renamed from java/darkknight/jewelrycraft/renders/ItemRender.java)33
-rw-r--r--java/darkknight/jewelrycraft/tileentity/renders/MaskRender.java63
-rw-r--r--java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java (renamed from java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java)174
-rw-r--r--java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java47
-rw-r--r--java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java (renamed from java/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java)76
-rw-r--r--java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java (renamed from java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java)90
-rw-r--r--java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java (renamed from java/darkknight/jewelrycraft/renders/TileEntityShadowEyeRender.java)49
-rw-r--r--java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java20
-rw-r--r--java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java (renamed from java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java)72
-rw-r--r--java/darkknight/jewelrycraft/util/BlockUtils.java115
-rw-r--r--java/darkknight/jewelrycraft/util/JewelryNBT.java379
-rw-r--r--java/darkknight/jewelrycraft/util/JewelrycraftUtil.java191
-rw-r--r--java/darkknight/jewelrycraft/util/PlayerUtils.java32
-rw-r--r--java/darkknight/jewelrycraft/worldGen/Generation.java39
-rw-r--r--java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java512
-rw-r--r--java/darkknight/jewelrycraft/worldGen/village/JCTrades.java58
-rw-r--r--java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java27
123 files changed, 8397 insertions, 3888 deletions
diff --git a/java/com/pau101/util/BezierUtils.java b/java/com/pau101/util/BezierUtils.java
new file mode 100644
index 0000000..eb52917
--- /dev/null
+++ b/java/com/pau101/util/BezierUtils.java
@@ -0,0 +1,98 @@
+package com.pau101.util;
+
+/**
+ * @author Paul Fulham (pau101)
+ */
+public final class BezierUtils
+{
+ private BezierUtils()
+ {}
+
+ /**
+ * Compute the value of all nth degree Bernstein polynomials.
+ *
+ * @param curveDegree : degree of curve
+ * @param t : curve parameter on interval [0,1]
+ * @param scalars : curveDegree + 1 Bernstein values.
+ */
+ public static void allBernstein(int curveDegree, float t, float scalars[])
+ {
+ int j, k;
+ float nt = 1 - t;
+ float saved;
+ scalars[0] = 1;
+ for(j = 1; j <= curveDegree; j++){
+ saved = 0;
+ for(k = 0; k < j; k++){
+ float temp = scalars[k];
+ scalars[k] = saved + nt * temp;
+ saved = t * temp;
+ }
+ scalars[j] = saved;
+ }
+ }
+
+ /**
+ * Compute point of nth degree Bezier curve.
+ *
+ * @param controlPoints : curveDegree + 1 control points
+ * @param curveDegree : degree of curve
+ * @param t : curve parameter on interval [0,1]
+ * @param point : resulting point
+ */
+ public static void pointOnBezierCurve(float controlPoints[][], int curveDegree, float t, float point[])
+ {
+ float scalars[] = new float[curveDegree + 1];
+ int k;
+ allBernstein(curveDegree, t, scalars);
+ point[0] = point[1] = point[2] = 0;
+ for(k = 0; k <= curveDegree; k++){
+ point[0] += scalars[k] * controlPoints[k][0];
+ point[1] += scalars[k] * controlPoints[k][1];
+ point[2] += scalars[k] * controlPoints[k][2];
+ }
+ }
+
+ /**
+ * Compute an approximate length of a Bezier curve given the control points.
+ *
+ * @param controlPoints : control points of a Bezier curve
+ * @return the approximate length
+ */
+ public static float approximateLength(float controlPoints[][])
+ {
+ float length = 0;
+ for(int i = 0; i < controlPoints.length - 1; i++){
+ float xDif = controlPoints[i + 1][0] - controlPoints[i][0];
+ float yDif = controlPoints[i + 1][1] - controlPoints[i][1];
+ float zDif = controlPoints[i + 1][2] - controlPoints[i][2];
+ length += Math.sqrt(xDif * xDif + yDif * yDif + zDif * zDif);
+ }
+ return length;
+ }
+
+ public static int tesselationSegementsForLength(float length, float scale)
+ {
+ float noLessThan = 10 * scale;
+ float segs = length * scale / 30F;
+ return (int)Math.ceil(Math.sqrt(segs * segs * 0.6 + noLessThan * noLessThan));
+ }
+
+ public static float[][] curve(float controlPoints[][])
+ {
+ return curve(controlPoints, 1);
+ }
+
+ public static float[][] curve(float controlPoints[][], float scale)
+ {
+ int count = tesselationSegementsForLength(approximateLength(controlPoints), scale);
+ float[][] points = new float[count][3];
+ for(int i = 0; i < count; i++){
+ float t = i / (float)(count - 1);
+ float[] point = new float[3];
+ pointOnBezierCurve(controlPoints, controlPoints.length - 1, t, point);
+ points[i] = point;
+ }
+ return points;
+ }
+} \ No newline at end of file
diff --git a/java/com/pau101/util/CubicBezier.java b/java/com/pau101/util/CubicBezier.java
new file mode 100644
index 0000000..aab2a98
--- /dev/null
+++ b/java/com/pau101/util/CubicBezier.java
@@ -0,0 +1,28 @@
+package com.pau101.util;
+
+/**
+ * @author Paul Fulham (pau101)
+ */
+public class CubicBezier
+{
+ private float[][] controlPoints;
+
+ public CubicBezier(float a1, float b1, float a2, float b2)
+ {
+ controlPoints = new float[4][];
+ controlPoints[0] = new float[]{0, 0};
+ controlPoints[1] = new float[]{a1, b1};
+ controlPoints[2] = new float[]{a2, b2};
+ controlPoints[3] = new float[]{1, 1};
+ }
+
+ public float eval(float t)
+ {
+ float[] scalars = new float[4];
+ BezierUtils.allBernstein(3, t, scalars);
+ float p = 0;
+ for(int i = 0; i < 4; i++)
+ p += scalars[i] * controlPoints[i][1];
+ return p;
+ }
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/CommonProxy.java b/java/darkknight/jewelrycraft/CommonProxy.java
index 2b9b8dc..03f7c90 100644
--- a/java/darkknight/jewelrycraft/CommonProxy.java
+++ b/java/darkknight/jewelrycraft/CommonProxy.java
@@ -1,14 +1,13 @@
package darkknight.jewelrycraft;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.world.World;
-import cpw.mods.fml.common.network.IGuiHandler;
-import darkknight.jewelrycraft.client.GuiJewelry;
-import darkknight.jewelrycraft.container.ContainerJewelryTab;
-
+/**
+ * The Class CommonProxy.
+ */
public class CommonProxy
{
+ /**
+ * Register renderers.
+ */
public void registerRenderers()
- {
- }
+ {}
} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/CreativeTabLiquids.java b/java/darkknight/jewelrycraft/CreativeTabLiquids.java
index b1f56dd..bdf57b7 100644
--- a/java/darkknight/jewelrycraft/CreativeTabLiquids.java
+++ b/java/darkknight/jewelrycraft/CreativeTabLiquids.java
@@ -1,38 +1,42 @@
package darkknight.jewelrycraft;
-import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-
-import darkknight.jewelrycraft.item.ItemList;
-import darkknight.jewelrycraft.util.JewelryNBT;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-
import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.oredict.OreDictionary;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+/**
+ * The Class CreativeTabLiquids.
+ */
public class CreativeTabLiquids extends CreativeTabs
{
+ /**
+ * Instantiates a new creative tab liquids.
+ *
+ * @param par2Str the par2 str
+ */
public CreativeTabLiquids(String par2Str)
{
super(par2Str);
}
+ /**
+ * @return the Item for the icon
+ */
@Override
public Item getTabIconItem()
{
return ItemList.bucket;
}
- @SuppressWarnings(
- { "rawtypes", "unchecked" })
+ /**
+ * @param par1List List of items to display
+ */
+ @Override
public void displayAllReleventItems(List par1List)
{
- for (int i = 0; i < JewelrycraftUtil.metal.size(); i++)
+ for(int i = 0; i < JewelrycraftUtil.metal.size(); i++)
par1List.add(ItemList.bucket.getModifiedItemStack(JewelrycraftUtil.metal.get(i)));
}
-
}
diff --git a/java/darkknight/jewelrycraft/JewelrycraftMod.java b/java/darkknight/jewelrycraft/JewelrycraftMod.java
index a7c0746..ef8a0e3 100644
--- a/java/darkknight/jewelrycraft/JewelrycraftMod.java
+++ b/java/darkknight/jewelrycraft/JewelrycraftMod.java
@@ -3,7 +3,6 @@
* It's an awesome mod
* I love me! :D
*/
-
package darkknight.jewelrycraft;
import java.io.File;
@@ -11,12 +10,13 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
-
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.ResourceLocation;
import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
@@ -24,25 +24,31 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
-import cpw.mods.fml.common.Mod.Metadata;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
+import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
import cpw.mods.fml.relauncher.Side;
import darkknight.jewelrycraft.block.BlockList;
+import darkknight.jewelrycraft.commands.JewelrycraftCommands;
import darkknight.jewelrycraft.config.ConfigHandler;
-import darkknight.jewelrycraft.container.ContainerJewelryTab;
import darkknight.jewelrycraft.container.GuiHandler;
-import darkknight.jewelrycraft.container.JewelryInventory;
+import darkknight.jewelrycraft.curses.CurseList;
+import darkknight.jewelrycraft.damage.DamageSourceList;
+import darkknight.jewelrycraft.effects.EffectsList;
+import darkknight.jewelrycraft.entities.EntityHalfHeart;
+import darkknight.jewelrycraft.entities.EntityHeart;
import darkknight.jewelrycraft.events.BucketHandler;
import darkknight.jewelrycraft.events.EntityEventHandler;
import darkknight.jewelrycraft.events.KeyBindings;
+import darkknight.jewelrycraft.events.PlayerRenderHandler;
import darkknight.jewelrycraft.events.ScreenHandler;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.lib.Reference;
@@ -59,22 +65,16 @@ import darkknight.jewelrycraft.worldGen.village.ComponentJewelry;
import darkknight.jewelrycraft.worldGen.village.JCTrades;
import darkknight.jewelrycraft.worldGen.village.VillageJewelryHandler;
-@Mod(modid = Reference.MODID, name = Reference.MODNAME, version = Reference.VERSION)
+@Mod (modid = Reference.MODID, name = Reference.MODNAME, version = Reference.VERSION)
public class JewelrycraftMod
{
- @Instance(Reference.MODID)
+ @Instance (Reference.MODID)
public static JewelrycraftMod instance;
-
- @Metadata(Reference.MODID)
- public static ModMetadata metadata;
-
- @SidedProxy(clientSide = "darkknight.jewelrycraft.client.ClientProxy", serverSide = "darkknight.jewelrycraft.CommonProxy")
+ @SidedProxy (clientSide = "darkknight.jewelrycraft.client.ClientProxy", serverSide = "darkknight.jewelrycraft.CommonProxy")
public static CommonProxy proxy;
-
public static final Logger logger = Logger.getLogger("Jewelrycraft");
public static File dir;
- public static CreativeTabs jewelrycraft = new CreativeTabs("JewelryCraft")
- {
+ public static CreativeTabs jewelrycraft = new CreativeTabs("JewelryCraft"){
@Override
public Item getTabIconItem()
{
@@ -85,11 +85,15 @@ public class JewelrycraftMod
public static NBTTagCompound saveData = new NBTTagCompound();
public static NBTTagCompound clientData = new NBTTagCompound();
public static File liquidsConf;
-
public static SimpleNetworkWrapper netWrapper;
public static boolean fancyRender;
- public static JewelryInventory jewelry = new JewelryInventory();
+ /**
+ * Pre initialization of mod stuff.
+ *
+ * @param e FMLPreInitializationEvent
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@EventHandler
public void preInit(FMLPreInitializationEvent e) throws IOException
{
@@ -97,34 +101,34 @@ public class JewelrycraftMod
BlockList.preInit(e);
ItemList.preInit(e);
CraftingRecipes.preInit(e);
+ CurseList.preInit(e);
OreDictionary.registerOre("ingotShadow", new ItemStack(ItemList.shadowIngot));
OreDictionary.registerOre("oreShadow", new ItemStack(BlockList.shadowOre));
-
VillagerRegistry.instance().registerVillagerId(3000);
VillagerRegistry.instance().registerVillageTradeHandler(3000, new JCTrades());
VillagerRegistry.instance().registerVillageCreationHandler(new VillageJewelryHandler());
- try
- {
+ try{
MapGenStructureIO.func_143031_a(ComponentJewelry.class, "Jewelrycraft:Jewelry");
}
- catch (Throwable e2)
- {
+ catch(Throwable e2){
logger.severe("Error registering Jewelrycraft Structures with Vanilla Minecraft: this is expected in versions earlier than 1.7.10");
}
MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
- if (FMLCommonHandler.instance().getSide() == Side.CLIENT) MinecraftForge.EVENT_BUS.register(new ScreenHandler(Minecraft.getMinecraft()));
+ if (FMLCommonHandler.instance().getSide() == Side.CLIENT) MinecraftForge.EVENT_BUS.register(new PlayerRenderHandler());
+ ResourceLocation jeweleryTexture = new ResourceLocation("jewelrycraft", "textures/gui/curses.png");
+ if (FMLCommonHandler.instance().getSide() == Side.CLIENT) MinecraftForge.EVENT_BUS.register(new ScreenHandler(Minecraft.getMinecraft(), jeweleryTexture));
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
BucketHandler.INSTANCE.buckets.put(BlockList.moltenMetal, ItemList.bucket);
ModMetadata metadata = e.getModMetadata();
-
List<String> authorList = new ArrayList<String>();
+
authorList.add("DarkKnight (or sor1n)");
authorList.add("bspkrs");
authorList.add("domi1819");
+
dir = e.getModConfigurationDirectory();
proxy.registerRenderers();
-
netWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
netWrapper.registerMessage(PacketRequestLiquidData.class, PacketRequestLiquidData.class, 0, Side.SERVER);
netWrapper.registerMessage(PacketSendLiquidData.class, PacketSendLiquidData.class, 1, Side.CLIENT);
@@ -132,12 +136,29 @@ public class JewelrycraftMod
netWrapper.registerMessage(PacketKeyPressEvent.class, PacketKeyPressEvent.class, 3, Side.SERVER);
netWrapper.registerMessage(PacketRequestPlayerInfo.class, PacketRequestPlayerInfo.class, 4, Side.SERVER);
netWrapper.registerMessage(PacketSendPlayerInfo.class, PacketSendPlayerInfo.class, 5, Side.CLIENT);
-
metadata.autogenerated = false;
metadata.authorList = authorList;
metadata.url = "https://github.com/sor1n/Jewelrycraft";
+
+ createEntity(EntityHeart.class, "Heart", 0x000000, 0xFF0000, true);
+ createEntity(EntityHalfHeart.class, "Half-Heart", 0x000000, 0xFF0000, true);
+
+// EntityRegistry.addSpawn(EntityMob.class, 5, 2, 3, EnumCreatureType.creature, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.birchForest, BiomeGenBase.birchForestHills, BiomeGenBase.plains, BiomeGenBase.beach, BiomeGenBase.coldBeach, BiomeGenBase.frozenRiver);
+ }
+
+ public void createEntity(Class<? extends Entity> entity, String entityName, int solidColor, int spotColor, boolean hasSpawnEgg)
+ {
+ int randomID = EntityRegistry.findGlobalUniqueEntityId();
+ if(hasSpawnEgg) EntityRegistry.registerGlobalEntityID(entity, entityName, randomID, solidColor, spotColor);
+ else EntityRegistry.registerGlobalEntityID(entity, entityName, randomID);
+ EntityRegistry.registerModEntity(entity, entityName, randomID, this, 40, 3, true);
}
+ /**
+ * Initializes the world generation and key bindings.
+ *
+ * @param e FMLInitializationEvent
+ */
@EventHandler
public void init(FMLInitializationEvent e)
{
@@ -146,11 +167,25 @@ public class JewelrycraftMod
new GuiHandler();
}
+ /**
+ * Post initialization of metals, modifiers and others.
+ *
+ * @param e FMLPostInitializationEvent
+ */
@EventHandler
public void postInit(FMLPostInitializationEvent e)
{
JewelrycraftUtil.addMetals();
JewelrycraftUtil.addStuff();
JewelrycraftUtil.jamcrafters();
+ EffectsList.postInit(e);
+ DamageSourceList.postInit(e);
+ }
+
+ @Mod.EventHandler
+ public void serverLoad(FMLServerStartingEvent event)
+ {
+ event.registerServerCommand(new JewelrycraftCommands());
}
+
}
diff --git a/java/darkknight/jewelrycraft/block/BlockDisplayer.java b/java/darkknight/jewelrycraft/block/BlockDisplayer.java
index 3bb8fbb..50c7c13 100644
--- a/java/darkknight/jewelrycraft/block/BlockDisplayer.java
+++ b/java/darkknight/jewelrycraft/block/BlockDisplayer.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.block;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -21,164 +20,175 @@ public class BlockDisplayer extends BlockContainer
{
Random rand = new Random();
+ /**
+ * @param par2Material
+ */
protected BlockDisplayer(Material par2Material)
{
super(par2Material);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityDisplayer();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
- TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k);
+ TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null)
- {
- if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote)
- {
- if (!te.hasObject)
- {
+ if (te != null){
+ if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote){
+ if (!te.hasObject){
te.object = item.copy();
te.quantity += item.stackSize;
te.object.stackSize = 1;
te.hasObject = true;
if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
te.isDirty = true;
+ }else if (te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
+ te.isDirty = true;
+ }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
+ te.isDirty = true;
}
- else if (te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage())
- {
- if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound()))
- {
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
- te.isDirty = true;
- }
- else if (!te.object.hasTagCompound() && !item.hasTagCompound())
- {
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, item.stackSize);
- te.isDirty = true;
- }
+ }else if (item == null || item == new ItemStack(Item.getItemById(0), 0, 0)) if (!entityPlayer.capabilities.isCreativeMode) for(int inv = 0; inv < entityPlayer.inventory.getSizeInventory(); inv++){
+ item = entityPlayer.inventory.getStackInSlot(inv);
+ if (item != null && te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage()) if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound())){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
+ te.isDirty = true;
+ te.markDirty();
+ }else if (!te.object.hasTagCompound() && !item.hasTagCompound()){
+ te.quantity += item.stackSize;
+ if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
+ te.isDirty = true;
}
}
- else if (item == null || item == new ItemStack(Item.getItemById(0), 0, 0))
- {
- if (!entityPlayer.capabilities.isCreativeMode)
- {
- for (int inv = 0; inv < entityPlayer.inventory.getSizeInventory(); inv++)
- {
- item = entityPlayer.inventory.getStackInSlot(inv);
- if (item != null && te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage())
- {
- if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound()))
- {
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
- te.isDirty = true;
- te.markDirty();
- }
- else if (!te.object.hasTagCompound() && !item.hasTagCompound())
- {
- te.quantity += item.stackSize;
- if (!entityPlayer.capabilities.isCreativeMode) entityPlayer.inventory.decrStackSize(inv, item.stackSize);
- te.isDirty = true;
- }
- }
- }
- }
- else if(entityPlayer.capabilities.isCreativeMode && te.hasObject && te.object.getItem() != null)
- {
- te.quantity += 64;
- te.isDirty = true;
- }
+ else if (entityPlayer.capabilities.isCreativeMode && te.hasObject && te.object.getItem() != null){
+ te.quantity += 64;
+ te.isDirty = true;
}
- te.isDirty = true;
+ te.isDirty = true;
}
return true;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k);
- if (te != null && !world.isRemote)
- {
- if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && player.inventory.addItemStackToInventory(te.object))
- {
- if (!player.isSneaking())
- {
- if (te.quantity > te.object.getMaxStackSize())
- {
- te.object.stackSize = te.object.getMaxStackSize() - 1;
- player.inventory.addItemStackToInventory(te.object);
- te.object.stackSize = 1;
- te.quantity -= te.object.getMaxStackSize();
- te.isDirty = true;
- }
- else
- {
- te.object.stackSize = te.quantity - 1;
- player.inventory.addItemStackToInventory(te.object);
- te.hasObject = false;
- te.object = new ItemStack(Item.getItemById(0), 0, 0);
- te.quantity = 0;
- te.isDirty = true;
- }
- te.isDirty = true;
- }
- else
- {
- if (te.quantity >= 2)
- {
- player.inventory.addItemStackToInventory(te.object);
- te.object.stackSize = 1;
- te.quantity--;
- te.isDirty = true;
- }
- else
- {
- player.inventory.addItemStackToInventory(te.object);
- te.object.stackSize = 1;
- te.hasObject = false;
- te.object = new ItemStack(Item.getItemById(0), 0, 0);
- te.quantity = 0;
- te.isDirty = true;
- }
- te.isDirty = true;
- }
+ TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
+ if (te != null && !world.isRemote) if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && player.inventory.addItemStackToInventory(te.object)) if (!player.isSneaking()){
+ if (te.quantity > te.object.getMaxStackSize()){
+ te.object.stackSize = te.object.getMaxStackSize() - 1;
+ player.inventory.addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.quantity -= te.object.getMaxStackSize();
+ te.isDirty = true;
+ }else{
+ te.object.stackSize = te.quantity - 1;
+ player.inventory.addItemStackToInventory(te.object);
+ te.hasObject = false;
+ te.object = new ItemStack(Item.getItemById(0), 0, 0);
+ te.quantity = 0;
+ te.isDirty = true;
}
+ te.isDirty = true;
+ }else{
+ if (te.quantity >= 2){
+ player.inventory.addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.quantity--;
+ te.isDirty = true;
+ }else{
+ player.inventory.addItemStackToInventory(te.object);
+ te.object.stackSize = 1;
+ te.hasObject = false;
+ te.object = new ItemStack(Item.getItemById(0), 0, 0);
+ te.quantity = 0;
+ te.isDirty = true;
+ }
+ te.isDirty = true;
}
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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);
@@ -188,20 +198,34 @@ public class BlockDisplayer extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
- TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k);
-
- if (te != null && te.hasObject)
- {
+ TileEntityDisplayer te = (TileEntityDisplayer)world.getTileEntity(i, j, k);
+ if (te != null && te.hasObject){
te.object.stackSize = te.quantity;
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.object);
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, block, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -209,9 +233,12 @@ public class BlockDisplayer extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param icon
+ */
@Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("jewelrycraft:displayer");
+ blockIcon = icon.registerIcon("jewelrycraft:displayer");
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockGlow.java b/java/darkknight/jewelrycraft/block/BlockGlow.java
deleted file mode 100644
index 39f7b26..0000000
--- a/java/darkknight/jewelrycraft/block/BlockGlow.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package darkknight.jewelrycraft.block;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.world.World;
-
-public class BlockGlow extends Block
-{
- protected BlockGlow()
- {
- super(Material.air);
- }
-
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i)
- {
- return null;
- }
-
- public boolean isCollidable()
- {
- return false;
- }
-
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- public int getRenderType()
- {
- return -1;
- }
-}
diff --git a/java/darkknight/jewelrycraft/block/BlockHandPedestal.java b/java/darkknight/jewelrycraft/block/BlockHandPedestal.java
index 95fecfc..6fe5b7f 100644
--- a/java/darkknight/jewelrycraft/block/BlockHandPedestal.java
+++ b/java/darkknight/jewelrycraft/block/BlockHandPedestal.java
@@ -1,7 +1,5 @@
package darkknight.jewelrycraft.block;
-import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -9,7 +7,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
@@ -19,106 +16,156 @@ import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
public class BlockHandPedestal extends BlockContainer
{
- Random rand = new Random();
- protected BlockHandPedestal(Material par2Material)
+ /**
+ * @param material
+ */
+ protected BlockHandPedestal(Material material)
{
- super(par2Material);
- this.setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
+ super(material);
+ setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityHandPedestal();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
- TileEntityHandPedestal te = (TileEntityHandPedestal) world.getTileEntity(i, j, k);
+ TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null)
- {
- if (!te.hasObject && item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote)
- {
- te.object = item.copy();
- te.object.stackSize = 1;
- te.hasObject = true;
+ if (te != null){
+ if (!world.isRemote && te.getHeldItemStack() == null && item != null){
+ te.setHeldItemStack(item.copy());
+ te.closeHand();
if (!entityPlayer.capabilities.isCreativeMode) item.stackSize--;
- te.isDirty = true;
te.markDirty();
+ }else if (entityPlayer.isSneaking()) if (entityPlayer.inventory.addItemStackToInventory(te.getHeldItemStack())){
+ te.removeHeldItemStack();
+ te.openHand();
}
- else if(entityPlayer.isSneaking())
- {
- if(entityPlayer.inventory.addItemStackToInventory(te.object))
- {
- te.hasObject = false;
- te.object = new ItemStack(Item.getItemById(0), 0, 0);
- }
- }
- te.isDirty = true;
te.markDirty();
}
return true;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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 entityitem = new EntityItem(world, x + 0.5, y + 1.5, z + 0.5, stack);
entityitem.motionX = 0;
entityitem.motionZ = 0;
entityitem.motionY = 0.11000000298023224D;
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
- TileEntityHandPedestal te = (TileEntityHandPedestal) world.getTileEntity(i, j, k);
-
- if (te != null && te.hasObject)
- {
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
+ TileEntityHandPedestal te = (TileEntityHandPedestal)world.getTileEntity(i, j, k);
+ if (te != null && te.getHeldItemStack() != null){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, block, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8.0F / 360.0F + 0.5D) & 7;
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 8 / 360 + 0.5) & 7;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param icon
+ */
@Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("minecraft:stonebrick");
+ blockIcon = icon.registerIcon("minecraft:stonebrick");
}
-}
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/block/BlockJCOre.java b/java/darkknight/jewelrycraft/block/BlockJCOre.java
index e6bb31c..6fafe66 100644
--- a/java/darkknight/jewelrycraft/block/BlockJCOre.java
+++ b/java/darkknight/jewelrycraft/block/BlockJCOre.java
@@ -2,11 +2,13 @@ package darkknight.jewelrycraft.block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.world.World;
public class BlockJCOre extends Block
{
+
+ /**
+ *
+ */
protected BlockJCOre()
{
super(Material.rock);
diff --git a/java/darkknight/jewelrycraft/block/BlockJewelAltar.java b/java/darkknight/jewelrycraft/block/BlockJewelAltar.java
index 4e53832..e0a43bc 100644
--- a/java/darkknight/jewelrycraft/block/BlockJewelAltar.java
+++ b/java/darkknight/jewelrycraft/block/BlockJewelAltar.java
@@ -18,44 +18,71 @@ import darkknight.jewelrycraft.tileentity.TileEntityAltar;
public class BlockJewelAltar extends BlockContainer
{
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
private IIcon altarSide;
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
private IIcon altarBottom;
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
private IIcon altarTop;
+ /**
+ *
+ */
public BlockJewelAltar()
{
super(Material.iron);
}
+ /**
+ * @param par0
+ * @return
+ */
public static boolean isNormalCube(int par0)
{
return true;
}
+ /**
+ * @param par1IconRegister
+ */
+ @Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
- this.altarSide = par1IconRegister.registerIcon(this.getTextureName() + "_" + "side");
- this.altarBottom = par1IconRegister.registerIcon(this.getTextureName() + "_" + "bottom");
- this.altarTop = par1IconRegister.registerIcon(this.getTextureName() + "_" + "top");
+ altarSide = par1IconRegister.registerIcon(getTextureName() + "_" + "side");
+ altarBottom = par1IconRegister.registerIcon(getTextureName() + "_" + "bottom");
+ altarTop = par1IconRegister.registerIcon(getTextureName() + "_" + "top");
}
+ /**
+ * @param par1
+ * @param par2
+ * @return
+ */
+ @Override
public IIcon getIcon(int par1, int par2)
{
- return par1 == 1 ? this.altarTop : (par1 == 0 ? this.altarBottom : this.altarSide);
+ return par1 == 1 ? altarTop : par1 == 0 ? altarBottom : altarSide;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@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.getTileEntity(i, j, k);
+ TileEntityAltar te = (TileEntityAltar)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && !world.isRemote)
- {
- if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && (item.getItem() == ItemList.ring || item.getItem() == ItemList.necklace) && !te.hasObject)
- {
+ if (te != null && !world.isRemote){
+ if (item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && (item.getItem() == ItemList.ring || item.getItem() == ItemList.necklace) && !te.hasObject){
te.object = item.copy();
item.stackSize = 0;
te.playerName = entityPlayer.getDisplayName();
@@ -63,9 +90,7 @@ public class BlockJewelAltar extends BlockContainer
te.markDirty();
te.hasObject = true;
}
-
- if (te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.hasObject && entityPlayer.isSneaking())
- {
+ if (te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.hasObject && entityPlayer.isSneaking()){
entityPlayer.inventory.addItemStackToInventory(te.object);
te.object = new ItemStack(Item.getItemById(0), 0, 0);
te.playerName = "";
@@ -77,18 +102,27 @@ public class BlockJewelAltar extends BlockContainer
return true;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntityAltar te = (TileEntityAltar) world.getTileEntity(i, j, k);
- if (te != null && !world.isRemote)
- {
- if (te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0))
- {
- }
- }
+ TileEntityAltar te = (TileEntityAltar)world.getTileEntity(i, j, k);
+ if (te != null && !world.isRemote) if (te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0)){}
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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);
@@ -98,19 +132,30 @@ public class BlockJewelAltar extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
- TileEntityAltar te = (TileEntityAltar) world.getTileEntity(i, j, k);
-
- if (te != null && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0))
- {
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
+ TileEntityAltar te = (TileEntityAltar)world.getTileEntity(i, j, k);
+ if (te != null && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0)){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.object);
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, block, par6);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
diff --git a/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
index f9dfc67..fae445e 100644
--- a/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
+++ b/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.block;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -25,49 +24,68 @@ public class BlockJewelrsCraftingTable extends BlockContainer
{
Random rand = new Random();
+ /**
+ * @param par2Material
+ */
protected BlockJewelrsCraftingTable(Material par2Material)
{
super(par2Material);
- this.setBlockBounds(0.0F, 0F, 0.0F, 1.0F, 0.8F, 1.0F);
+ setBlockBounds(0.0F, 0F, 0.0F, 1.0F, 0.8F, 1.0F);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityJewelrsCraftingTable();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
+ TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && !world.isRemote)
- {
+ if (te != null && !world.isRemote){
if (te.hasEndItem && item != null) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.hasenditem")));
- if (!te.hasEndItem && !te.hasJewelry && item != null && JewelrycraftUtil.isJewelry(item))
- {
+ if (!te.hasEndItem && !te.hasJewelry && item != null && JewelrycraftUtil.isJewelry(item)){
te.jewelry = item.copy();
te.hasJewelry = true;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
te.isDirty = true;
}
- if (!te.hasEndItem && !te.hasGem && item != null && JewelrycraftUtil.isGem(item))
- {
+ if (!te.hasEndItem && !te.hasGem && item != null && JewelrycraftUtil.isGem(item)){
te.gem = item.copy();
te.gem.stackSize = 1;
te.hasGem = true;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
te.isDirty = true;
}
- if (!te.hasEndItem && te.hasJewelry && te.hasGem && !te.crafting)
- {
+ if (!te.hasEndItem && te.hasJewelry && te.hasGem && !te.crafting){
te.carving = ConfigHandler.jewelryCraftingTime;
te.angle = 0;
te.crafting = true;
@@ -77,6 +95,13 @@ public class BlockJewelrsCraftingTable extends BlockContainer
return true;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
public void dropItem(World world, double x, double y, double z, ItemStack stack)
{
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack);
@@ -86,19 +111,35 @@ public class BlockJewelrsCraftingTable extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param par5
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
{
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
- if (te != null)
- {
- if (te.hasJewelry) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy());
- if (te.hasGem) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.gem.copy());
- if (te.hasEndItem) dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy());
+ TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable)world.getTileEntity(i, j, k);
+ if (te != null){
+ if (te.hasJewelry) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.jewelry.copy());
+ if (te.hasGem) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.gem.copy());
+ if (te.hasEndItem) dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.endItem.copy());
world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, par5, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -106,71 +147,84 @@ public class BlockJewelrsCraftingTable extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
- if (te != null && !world.isRemote)
- {
- if (player.isSneaking())
- {
- if (te.hasJewelry)
- {
- dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy());
- te.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- te.hasJewelry = false;
- te.carving = -1;
- te.crafting = false;
- te.angle = 0F;
- te.isDirty = true;
- }
- if (te.hasGem)
- {
- dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.gem.copy());
- te.gem = new ItemStack(Item.getItemById(0), 0, 0);
- te.hasGem = false;
- te.carving = -1;
- te.crafting = false;
- te.angle = 0F;
- te.isDirty = true;
- }
+ TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable)world.getTileEntity(i, j, k);
+ if (te != null && !world.isRemote) if (player.isSneaking()){
+ if (te.hasJewelry){
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.jewelry.copy());
+ te.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ te.hasJewelry = false;
+ te.carving = -1;
+ te.crafting = false;
+ te.angle = 0F;
+ te.isDirty = true;
}
- else
- {
- if (te.hasEndItem)
- {
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy());
- te.endItem = new ItemStack(Item.getItemById(0), 0, 0);
- te.hasEndItem = false;
- te.isDirty = true;
- }
- else if (te.hasJewelry && te.hasGem && te.carving > 0 && te.jewelry != null) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.table.iscrafting", te.jewelry.getDisplayName()) + " (" + ((ConfigHandler.jewelryCraftingTime - te.carving) * 100 / ConfigHandler.jewelryCraftingTime) + "%)"));
- else if (!te.hasGem) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missinggem")));
- else if (!te.hasJewelry) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missingjewelry")));
+ if (te.hasGem){
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.gem.copy());
+ te.gem = new ItemStack(Item.getItemById(0), 0, 0);
+ te.hasGem = false;
+ te.carving = -1;
+ te.crafting = false;
+ te.angle = 0F;
+ te.isDirty = true;
}
- }
+ }else if (te.hasEndItem){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.endItem.copy());
+ te.endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ te.hasEndItem = false;
+ te.isDirty = true;
+ }else if (te.hasJewelry && te.hasGem && te.carving > 0 && te.jewelry != null) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.table.iscrafting", te.jewelry.getDisplayName()) + " (" + (ConfigHandler.jewelryCraftingTime - te.carving) * 100 / ConfigHandler.jewelryCraftingTime + "%)"));
+ else if (!te.hasGem) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missinggem")));
+ else if (!te.hasJewelry) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missingjewelry")));
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param icon
+ */
+ @Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("jewelrycraft:jewelrsCraftingTable");
+ blockIcon = icon.registerIcon("jewelrycraft:jewelrsCraftingTable");
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockList.java b/java/darkknight/jewelrycraft/block/BlockList.java
index b244a19..80a984c 100644
--- a/java/darkknight/jewelrycraft/block/BlockList.java
+++ b/java/darkknight/jewelrycraft/block/BlockList.java
@@ -19,18 +19,18 @@ import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
public class BlockList
{
- public static Block shadowOre, glow, smelter, molder, displayer, jewelCraftingTable, shadowBlock, shadowEye, jewelAltar, handPedestal, shadowHand;
+ public static Block shadowOre, smelter, molder, displayer, jewelCraftingTable, shadowBlock, shadowEye, jewelAltar, handPedestal, shadowHand;
public static BlockMoltenMetal moltenMetal;
public static Fluid moltenMetalFluid;
-
private static boolean isInitialized = false;
+ /**
+ * @param e
+ */
public static void preInit(FMLPreInitializationEvent e)
{
- if (!isInitialized)
- {
+ if (!isInitialized){
shadowOre = new BlockJCOre().setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypePiston).setBlockTextureName("jewelrycraft:oreShadow").setBlockName("Jewelrycraft.oreShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
- glow = new BlockGlow().setBlockName("Jewelrycraft.glow").setLightLevel(1F);
smelter = new BlockSmelter().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.smelter").setCreativeTab(JewelrycraftMod.jewelrycraft);
molder = new BlockMolder(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.molder").setCreativeTab(JewelrycraftMod.jewelrycraft);
displayer = new BlockDisplayer(Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypeMetal).setBlockName("Jewelrycraft.displayer").setCreativeTab(JewelrycraftMod.jewelrycraft);
@@ -40,7 +40,6 @@ public class BlockList
shadowEye = new BlockShadowEye().setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.shadowEye").setCreativeTab(JewelrycraftMod.jewelrycraft);
handPedestal = new BlockHandPedestal(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.handPedestal").setCreativeTab(JewelrycraftMod.jewelrycraft);
shadowHand = new BlockShadowHand(Material.rock).setStepSound(Block.soundTypePiston).setBlockName("Jewelrycraft.shadowHand").setCreativeTab(JewelrycraftMod.jewelrycraft).setBlockUnbreakable();
-
GameRegistry.registerBlock(shadowOre, "shadowOre");
GameRegistry.registerBlock(shadowBlock, "shadowBlock");
GameRegistry.registerBlock(smelter, "Smelter");
@@ -51,7 +50,6 @@ public class BlockList
GameRegistry.registerBlock(shadowEye, "Shadow Eye");
GameRegistry.registerBlock(handPedestal, "Stone Bricks Pedestal");
GameRegistry.registerBlock(shadowHand, "Shadow Hand");
-
GameRegistry.registerTileEntity(TileEntitySmelter.class, "jewelrycraft:smelter");
GameRegistry.registerTileEntity(TileEntityMolder.class, "jewelrycraft:molder");
GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, "jewelrycraft:table");
@@ -61,12 +59,10 @@ public class BlockList
GameRegistry.registerTileEntity(TileEntityShadowEye.class, "jewelrycraft:shadowEye");
GameRegistry.registerTileEntity(TileEntityHandPedestal.class, "jewelrycraft:handPedestal");
GameRegistry.registerTileEntity(TileEntityShadowHand.class, "jewelrycraft:shadowHand");
-
moltenMetalFluid = new Fluid("metal.molten").setLuminosity(15).setDensity(3000).setTemperature(2000).setViscosity(6000);
if (!FluidRegistry.registerFluid(moltenMetalFluid)) moltenMetalFluid = FluidRegistry.getFluid("metal.molten");
moltenMetal = new BlockMoltenMetal(moltenMetalFluid, Material.lava);
GameRegistry.registerBlock(moltenMetal, "moltenMetalLiquid");
-
isInitialized = true;
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockMolder.java b/java/darkknight/jewelrycraft/block/BlockMolder.java
index 8b7d47d..ce5e58b 100644
--- a/java/darkknight/jewelrycraft/block/BlockMolder.java
+++ b/java/darkknight/jewelrycraft/block/BlockMolder.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.block;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -25,51 +24,77 @@ public class BlockMolder extends BlockContainer
{
Random rand = new Random();
+ /**
+ * @param par2Material
+ */
protected BlockMolder(Material par2Material)
{
super(par2Material);
- this.setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F);
+ setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityMolder();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
- TileEntityMolder te = (TileEntityMolder) world.getTileEntity(i, j, k);
+ TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && !world.isRemote)
- {
- if (item != null && !te.hasMold && item.getItem() == ItemList.molds)
- {
+ if (te != null && !world.isRemote){
+ if (item != null && !te.hasMold && item.getItem() == ItemList.molds){
te.mold = item.copy();
te.hasMold = true;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.molder.addedmold", te.mold.getDisplayName())));
te.isDirty = true;
}
- if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal)
- {
- dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.mold.copy());
+ if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal){
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
te.mold = new ItemStack(Item.getItemById(0), 0, 0);
te.hasMold = false;
te.isDirty = true;
- }
- else if (te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.hasmoltenmetal")));
+ }else if (te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.hasmoltenmetal")));
}
return true;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
public void dropItem(World world, double x, double y, double z, ItemStack stack)
{
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
@@ -79,20 +104,34 @@ public class BlockMolder extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param par5
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
{
- TileEntityMolder te = (TileEntityMolder) world.getTileEntity(i, j, k);
-
- if (te != null)
- {
- if (te.hasJewelBase) dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelBase.copy());
- if (te.hasMold) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.mold.copy());
+ TileEntityMolder te = (TileEntityMolder)world.getTileEntity(i, j, k);
+ if (te != null){
+ if (te.hasJewelBase) dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.jewelBase.copy());
+ if (te.hasMold) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.mold.copy());
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, par5, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -100,45 +139,67 @@ public class BlockMolder extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntityMolder me = (TileEntityMolder) world.getTileEntity(i, j, k);
- if (me != null && !world.isRemote)
- {
- if (me.hasJewelBase)
- {
- dropItem(me.getWorldObj(), (double) me.xCoord, (double) me.yCoord, (double) me.zCoord, me.jewelBase.copy());
+ TileEntityMolder me = (TileEntityMolder)world.getTileEntity(i, j, k);
+ if (me != null && !world.isRemote){
+ if (me.hasJewelBase){
+ dropItem(me.getWorldObj(), me.xCoord, me.yCoord, me.zCoord, me.jewelBase.copy());
me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
me.hasJewelBase = false;
- }
- else if (me.hasMoltenMetal && me.cooling >= 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.metaliscooling") + " (" + ((ConfigHandler.ingotCoolingTime - me.cooling) * 100 / ConfigHandler.ingotCoolingTime) + "%)"));
+ }else if (me.hasMoltenMetal && me.cooling >= 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.metaliscooling") + " (" + (ConfigHandler.ingotCoolingTime - me.cooling) * 100 / ConfigHandler.ingotCoolingTime + "%)"));
else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldisempty")));
else if (me.mold.getItem() != ItemList.molds) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldismissing")));
me.isDirty = true;
}
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param icon
+ */
+ @Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("jewelrycraft:molder");
+ blockIcon = icon.registerIcon("jewelrycraft:molder");
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java b/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
index da3c5c1..ee67aff 100644
--- a/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
+++ b/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
@@ -1,29 +1,14 @@
package darkknight.jewelrycraft.block;
-import java.awt.image.BufferedImage;
import java.io.IOException;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
import java.util.Random;
-
-import javax.imageio.ImageIO;
-
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.client.renderer.texture.TextureManager;
-import net.minecraft.client.resources.IResourceManager;
import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic;
@@ -33,39 +18,56 @@ import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.network.PacketRequestLiquidData;
import darkknight.jewelrycraft.network.PacketSendLiquidData;
-import darkknight.jewelrycraft.util.JewelryNBT;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class BlockMoltenMetal extends BlockFluidClassic
{
-
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
protected IIcon stillIcon;
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
protected IIcon flowingIcon;
+ /**
+ * @param fluid
+ * @param material
+ */
public BlockMoltenMetal(Fluid fluid, Material material)
{
super(fluid, material);
setBlockName("Jewelrycraft.moltenMetal");
- this.setQuantaPerBlock(5);
- this.setRenderPass(1);
+ setQuantaPerBlock(5);
+ setRenderPass(1);
setLightLevel(15f);
}
+ /**
+ * @param side
+ * @param meta
+ * @return
+ */
@Override
public IIcon getIcon(int side, int meta)
{
- return (side == 0 || side == 1) ? stillIcon : flowingIcon;
+ return side == 0 || side == 1 ? stillIcon : flowingIcon;
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param register
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public void registerBlockIcons(IIconRegister register)
{
stillIcon = register.registerIcon("jewelrycraft:moltenMetalStill");
flowingIcon = register.registerIcon("jewelrycraft:moltenMetalFlow");
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
@Override
public boolean canDisplace(IBlockAccess world, int x, int y, int z)
{
@@ -73,6 +75,13 @@ public class BlockMoltenMetal extends BlockFluidClassic
return super.canDisplace(world, x, y, z);
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
@Override
public boolean displaceIfPossible(World world, int x, int y, int z)
{
@@ -80,87 +89,77 @@ public class BlockMoltenMetal extends BlockFluidClassic
return super.displaceIfPossible(world, x, y, z);
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
@Override
protected boolean canFlowInto(IBlockAccess world, int x, int y, int z)
{
if (world.getBlock(x, y, z).isAir(world, x, y, z)) return true;
-
Block block = world.getBlock(x, y, z);
- if (block == this) { return false; }
-
- if (displacements.containsKey(block)) { return displacements.get(block); }
-
+ if (block == this) return false;
+ if (displacements.containsKey(block)) return displacements.get(block);
Material material = block.getMaterial();
- if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal) { return false; }
-
+ if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal) return false;
int density = getDensity(world, x, y, z);
- if (density == Integer.MAX_VALUE) { return true; }
-
- if (this.density > density)
- {
- return true;
- }
- else
- {
- return false;
- }
+ if (density == Integer.MAX_VALUE) return true;
+ if (this.density > density) return true;
+ else return false;
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @return
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int i, int j, int k)
{
- try
- {
+ try{
return color(world, i, j, k, false, null);
}
- catch (IOException e)
- {
+ catch(IOException e){
e.printStackTrace();
}
return 0;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param rand
+ */
@Override
public void updateTick(World world, int x, int y, int z, Random rand)
{
int quantaRemaining = quantaPerBlock - world.getBlockMetadata(x, y, z);
int expQuanta = -101;
-
// check adjacent block levels if non-source
- if (quantaRemaining < quantaPerBlock)
- {
+ if (quantaRemaining < quantaPerBlock){
int y2 = y - densityDir;
-
- if ((world.getBlock(x, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
- (world.getBlock(x - 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
- (world.getBlock(x + 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
- (world.getBlock(x, y2, z - 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
- (world.getBlock(x, y2, z + 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))))
- {
- expQuanta = quantaPerBlock - 1;
- }
- else
- {
+ if (world.getBlock(x, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId))) || world.getBlock(x - 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId))) || world.getBlock(x + 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId))) || world.getBlock(x, y2, z - 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId))) || world.getBlock(x, y2, z + 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) expQuanta = quantaPerBlock - 1;
+ else{
int maxQuanta = -100;
- if(JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta);
- if(JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta);
- if(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta);
- if(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta);
-
+ if (JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta);
+ if (JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta);
+ if (JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta);
+ if (JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta);
expQuanta = maxQuanta - 1;
}
-
// decay calculation
- if (expQuanta != quantaRemaining)
- {
+ if (expQuanta != quantaRemaining){
quantaRemaining = expQuanta;
-
- if (expQuanta <= 0)
- {
- world.setBlock(x, y, z, Blocks.air);
- }
- else
- {
+ if (expQuanta <= 0) world.setBlock(x, y, z, Blocks.air);
+ else{
world.setBlockMetadataWithNotify(x, y, z, quantaPerBlock - expQuanta, 3);
world.scheduleBlockUpdate(x, y, z, this, tickRate);
world.notifyBlocksOfNeighborChange(x, y, z, this);
@@ -169,61 +168,51 @@ public class BlockMoltenMetal extends BlockFluidClassic
}
// This is a "source" block, set meta to zero, and send a server only
// update
- else if (quantaRemaining >= quantaPerBlock)
- {
- world.setBlockMetadataWithNotify(x, y, z, 0, 2);
- }
-
+ else if (quantaRemaining >= quantaPerBlock) world.setBlockMetadataWithNotify(x, y, z, 0, 2);
String originData = JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId));
-
// Flow vertically if possible
- if (canDisplace(world, x, y + densityDir, z))
- {
+ if (canDisplace(world, x, y + densityDir, z)){
JewelrycraftMod.saveData.setString(stringFromLocation(x, y + densityDir, z, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x, y + densityDir, z, 1, originData);
return;
}
-
// Flow outward if possible
int flowMeta = quantaPerBlock - quantaRemaining + 1;
- if (flowMeta >= quantaPerBlock) { return; }
-
- if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z))
- {
- if (world.getBlock(x, y - densityDir, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y - densityDir, z, world.provider.dimensionId))))
- {
- flowMeta = 1;
- }
+ if (flowMeta >= quantaPerBlock) return;
+ if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z)){
+ if (world.getBlock(x, y - densityDir, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y - densityDir, z, world.provider.dimensionId)))) flowMeta = 1;
boolean flowTo[] = getOptimalFlowDirections(world, x, y, z);
-
- if (flowTo[0])
- {
+ if (flowTo[0]){
if (JewelrycraftMod.saveData.getTag(stringFromLocation(x - 1, y, z, world.provider.dimensionId)) == null || world.getBlock(x - 1, y, z).isAir(world, x - 1, y, z)) JewelrycraftMod.saveData.setString(stringFromLocation(x - 1, y, z, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x - 1, y, z, flowMeta, originData);
}
- if (flowTo[1])
- {
+ if (flowTo[1]){
if (JewelrycraftMod.saveData.getTag(stringFromLocation(x + 1, y, z, world.provider.dimensionId)) == null || world.getBlock(x + 1, y, z).isAir(world, x + 1, y, z)) JewelrycraftMod.saveData.setString(stringFromLocation(x + 1, y, z, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x + 1, y, z, flowMeta, originData);
}
- if (flowTo[2])
- {
+ if (flowTo[2]){
if (JewelrycraftMod.saveData.getTag(stringFromLocation(x, y, z - 1, world.provider.dimensionId)) == null || world.getBlock(x, y, z - 1).isAir(world, x, y, z - 1)) JewelrycraftMod.saveData.setString(stringFromLocation(x, y, z - 1, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x, y, z - 1, flowMeta, originData);
}
- if (flowTo[3])
- {
+ if (flowTo[3]){
if (JewelrycraftMod.saveData.getTag(stringFromLocation(x, y, z + 1, world.provider.dimensionId)) == null || world.getBlock(x, y, z + 1).isAir(world, x, y, z + 1)) JewelrycraftMod.saveData.setString(stringFromLocation(x, y, z + 1, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
flowIntoBlock(world, x, y, z + 1, flowMeta, originData);
}
}
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param meta
+ * @param originData
+ */
public void flowIntoBlock(World world, int x, int y, int z, int meta, String originData)
{
if (meta < 0 || world.isRemote) return;
- if (displaceIfPossible(world, x, y, z))
- {
+ if (displaceIfPossible(world, x, y, z)){
world.setBlock(x, y, z, this, meta, 3);
JewelrycraftMod.saveData.setString(stringFromLocation(x, y, z, world.provider.dimensionId), originData);
String[] data = originData.split(":");
@@ -231,30 +220,34 @@ public class BlockMoltenMetal extends BlockFluidClassic
}
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param forcecolor
+ * @param itemC
+ * @return
+ * @throws IOException
+ */
+ @SideOnly (Side.CLIENT)
public static int color(IBlockAccess world, int i, int j, int k, boolean forcecolor, Item itemC) throws IOException
{
String ingotData = JewelrycraftMod.clientData.getString(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k) + " " + Minecraft.getMinecraft().theWorld.provider.dimensionId);
- if (ingotData == "")
- {
+ if (ingotData == ""){
JewelrycraftMod.netWrapper.sendToServer(new PacketRequestLiquidData(Minecraft.getMinecraft().theWorld.provider.dimensionId, i, j, k));
return 0xFFFFFF;
- }
- else
- {
+ }else{
String[] splitData = ingotData.split(":");
- if (splitData.length == 3)
- {
- int itemID, itemDamage, color;
- try
- {
- itemID = Integer.parseInt(splitData[0]);
- itemDamage = Integer.parseInt(splitData[1]);
+ if (splitData.length == 3){
+ int color;
+ try{
+ Integer.parseInt(splitData[0]);
+ Integer.parseInt(splitData[1]);
color = Integer.parseInt(splitData[2]);
return color;
}
- catch (Exception e)
- {
+ catch(Exception e){
e.printStackTrace();
}
}
@@ -262,6 +255,13 @@ public class BlockMoltenMetal extends BlockFluidClassic
return 16777215;
}
+ /**
+ * @param x
+ * @param y
+ * @param z
+ * @param dimID
+ * @return
+ */
public static String stringFromLocation(int x, int y, int z, int dimID)
{
return x + " " + y + " " + z + " " + dimID;
diff --git a/java/darkknight/jewelrycraft/block/BlockShadow.java b/java/darkknight/jewelrycraft/block/BlockShadow.java
index 4e8acf5..b175fe6 100644
--- a/java/darkknight/jewelrycraft/block/BlockShadow.java
+++ b/java/darkknight/jewelrycraft/block/BlockShadow.java
@@ -1,114 +1,192 @@
package darkknight.jewelrycraft.block;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow;
public class BlockShadow extends BlockContainer
{
private IIcon[] iconArray;
- private static final String __OBFID = "CL_00000312";
+ /**
+ *
+ */
public BlockShadow()
{
super(Material.iron);
- this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
+ /**
+ * @return
+ */
+ @Override
public int getRenderBlockPass()
{
return 1;
}
+ /**
+ * @param worldObj
+ * @param x
+ * @param y
+ * @param z
+ * @param beaconX
+ * @param beaconY
+ * @param beaconZ
+ * @return
+ */
public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
{
return true;
}
+ /**
+ * @return
+ */
+ @Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
+ @Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param side
+ * @return
+ */
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
{
return false;
}
+ /**
+ * @param par0
+ * @return
+ */
public static boolean isNormalCube(int par0)
{
return true;
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityBlockShadow();
}
+ /**
+ * @param par1IconRegister
+ */
+ @Override
public void registerBlockIcons(IIconRegister par1IconRegister)
{
- this.iconArray = new IIcon[16];
-
- for (int i = 0; i < this.iconArray.length; ++i)
- {
- this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + (15 - i));
- }
+ iconArray = new IIcon[16];
+ for(int i = 0; i < iconArray.length; ++i)
+ iconArray[i] = par1IconRegister.registerIcon(getTextureName() + (15 - i));
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ @Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
if (world.getBlockMetadata(x, y, z) == 15) return null;
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
+ /**
+ * @param par1IBlockAccess
+ * @param par2
+ * @param par3
+ * @param par4
+ */
+ @Override
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
- this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
+ setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
+ /**
+ * @param p_149646_1_
+ * @param p_149646_2_
+ * @param p_149646_3_
+ * @param p_149646_4_
+ * @param p_149646_5_
+ * @return
+ */
+ @Override
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
{
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
-
- if (this == BlockList.shadowBlock)
- {
- if (block == this) { return false; }
- }
-
+ if (this == BlockList.shadowBlock) if (block == this) return false;
return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
}
+ /**
+ * @return
+ */
+ @Override
public boolean hasComparatorInputOverride()
{
return true;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param meta
+ * @return
+ */
+ @Override
public int getComparatorInputOverride(World world, int x, int y, int z, int meta)
{
return world.getBlockMetadata(x, y, z);
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param side
+ * @param meta
+ * @return
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public IIcon getIcon(int side, int meta)
{
- return this.iconArray[meta];
+ return iconArray[meta];
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockShadowEye.java b/java/darkknight/jewelrycraft/block/BlockShadowEye.java
index 94ece2a..1db2099 100644
--- a/java/darkknight/jewelrycraft/block/BlockShadowEye.java
+++ b/java/darkknight/jewelrycraft/block/BlockShadowEye.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.block;
import java.util.Random;
-
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -18,41 +17,78 @@ public class BlockShadowEye extends BlockContainer
{
Random rand = new Random();
+ /**
+ *
+ */
protected BlockShadowEye()
{
super(Material.rock);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityShadowEye();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityPlayer
+ * @param par6
+ * @param par7
+ * @param par8
+ * @param par9
+ * @return
+ */
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
@@ -61,11 +97,25 @@ public class BlockShadowEye extends BlockContainer
return true;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param player
+ */
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
- {
- }
+ {}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -73,9 +123,12 @@ public class BlockShadowEye extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param icon
+ */
@Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("minecraft:stonebrick");
+ blockIcon = icon.registerIcon("minecraft:stonebrick");
}
}
diff --git a/java/darkknight/jewelrycraft/block/BlockShadowHand.java b/java/darkknight/jewelrycraft/block/BlockShadowHand.java
index 2af6d02..45a260f 100644
--- a/java/darkknight/jewelrycraft/block/BlockShadowHand.java
+++ b/java/darkknight/jewelrycraft/block/BlockShadowHand.java
@@ -1,7 +1,5 @@
package darkknight.jewelrycraft.block;
-import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -17,44 +15,75 @@ import darkknight.jewelrycraft.tileentity.TileEntityShadowHand;
public class BlockShadowHand extends BlockContainer
{
- Random rand = new Random();
- protected BlockShadowHand(Material par2Material)
+ /**
+ * @param material
+ */
+ protected BlockShadowHand(Material material)
{
- super(par2Material);
- this.setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
+ super(material);
+ setBlockBounds(0.2F, 0F, 0.2F, 0.8F, 1.0F, 0.8F);
}
+ /**
+ * @param world
+ * @param var2
+ * @return
+ */
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityShadowHand();
}
+ /**
+ * @return
+ */
@Override
public boolean renderAsNormalBlock()
{
return false;
}
+ /**
+ * @param iblockaccess
+ * @param i
+ * @param j
+ * @param k
+ * @param l
+ * @return
+ */
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
+ /**
+ * @return
+ */
@Override
public boolean isOpaqueCube()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getRenderType()
{
return -1;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
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);
@@ -64,19 +93,33 @@ public class BlockShadowHand extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ * @param par6
+ */
+ @Override
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
- TileEntityShadowHand te = (TileEntityShadowHand) world.getTileEntity(i, j, k);
-
- if (te != null && te.hasObject)
- {
- dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
+ TileEntityShadowHand te = (TileEntityShadowHand)world.getTileEntity(i, j, k);
+ if (te != null && te.getHeldItemStack() != null){
+ dropItem(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, te.getHeldItemStack());
world.removeTileEntity(i, j, k);
}
-
super.breakBlock(world, i, j, k, block, par6);
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param entityLiving
+ * @param par6ItemStack
+ */
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
@@ -84,9 +127,12 @@ public class BlockShadowHand extends BlockContainer
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
+ /**
+ * @param icon
+ */
@Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("minecraft:coal_block");
+ blockIcon = icon.registerIcon("minecraft:coal_block");
}
-}
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/block/BlockSmelter.java b/java/darkknight/jewelrycraft/block/BlockSmelter.java
index a4d379b..6d51a52 100644
--- a/java/darkknight/jewelrycraft/block/BlockSmelter.java
+++ b/java/darkknight/jewelrycraft/block/BlockSmelter.java
@@ -2,7 +2,6 @@ package darkknight.jewelrycraft.block;
import java.io.IOException;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -51,6 +50,15 @@ public class BlockSmelter extends BlockContainer
return false;
}
+ /**
+ * Spawns an item in the world at the specified location
+ *
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ */
public void dropItem(World world, double x, double y, double z, ItemStack stack)
{
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.3D, z + 0.5D, stack);
@@ -61,33 +69,29 @@ public class BlockSmelter extends BlockContainer
world.spawnEntityInWorld(entityitem);
}
+ @Override
public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
{
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
- if (te != null)
- {
- if (te.hasMetal) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.metal.copy());
- if (te.hasMoltenMetal && te.moltenMetal != null && Item.getIdFromItem(te.moltenMetal.getItem()) > 0)
- {
+ TileEntitySmelter te = (TileEntitySmelter)world.getTileEntity(i, j, k);
+ if (te != null){
+ if (te.hasMetal) dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.metal.copy());
+ if (te.hasMoltenMetal && te.moltenMetal != null && Item.getIdFromItem(te.moltenMetal.getItem()) > 0){
ItemStack metal = te.moltenMetal;
ItemStack item = te.moltenMetal;
if (Item.getIdFromItem(metal.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(metal.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(metal.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(metal.getItem()) == Block.getIdFromBlock(Blocks.carpet)) metal.setItemDamage(15 - metal.getItemDamage());
int color = 16777215;
JewelryNBT.addMetal(item, metal);
- try
- {
+ try{
color = ItemMoltenMetalBucket.color(item, 1);
System.out.println(color);
}
- catch (IOException e)
- {
+ catch(IOException e){
e.printStackTrace();
}
JewelrycraftMod.saveData.setString(i + " " + j + " " + k + " " + world.provider.dimensionId, Item.getIdFromItem(metal.getItem()) + ":" + metal.getItemDamage() + ":" + color);
JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, i, j, k, Item.getIdFromItem(metal.getItem()), metal.getItemDamage(), color));
-
world.setBlock(i, j, k, BlockList.moltenMetal, 0, 3);
- int quant = (int) (te.quantity * 10);
+ int quant = (int)(te.quantity * 10);
if (quant == 1) world.setBlockMetadataWithNotify(i, j, k, 4, 3);
if (quant == 2) world.setBlockMetadataWithNotify(i, j, k, 4, 3);
if (quant == 3) world.setBlockMetadataWithNotify(i, j, k, 3, 3);
@@ -106,10 +110,9 @@ public class BlockSmelter extends BlockContainer
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
+ TileEntitySmelter te = (TileEntitySmelter)world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && te.hasMoltenMetal && te.quantity >= 0.9f && !te.pouring && item != null && item.getItem() == Items.bucket)
- {
+ if (te != null && te.hasMoltenMetal && te.quantity >= 0.9f && !te.pouring && item != null && item.getItem() == Items.bucket){
te.quantity = 0f;
te.hasMoltenMetal = false;
ItemStack metalBucket = new ItemStack(ItemList.bucket, 1);
@@ -121,48 +124,41 @@ public class BlockSmelter extends BlockContainer
te.isDirty = true;
return true;
}
- if (te != null && !world.isRemote)
- {
- if (te.hasMetal && entityPlayer.isSneaking())
- {
- dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.metal.copy());
+ if (te != null && !world.isRemote){
+ if (te.hasMetal && entityPlayer.isSneaking()){
+ dropItem(world, te.xCoord, te.yCoord, te.zCoord, te.metal.copy());
te.hasMetal = false;
te.melting = -1;
te.isDirty = true;
}
- if (item != null && item.getItem() != null && !(item.getItem() instanceof ItemMoltenMetalBucket))
- {
+ if (item != null && item.getItem() != null && !(item.getItem() instanceof ItemMoltenMetalBucket)){
int index = -1;
- for (int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++)
- if (entityPlayer.getDisplayName().equals(JewelrycraftUtil.jamcraftPlayers.get(a))) index = a;
- boolean canPlace = (item != null && (JewelrycraftUtil.isMetal(item) || JewelrycraftUtil.isOre(item) || index >= 0));
+ for(int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++)
+ if (entityPlayer.getUniqueID().toString().equals(JewelrycraftUtil.jamcraftPlayers.get(a))) index = a;
+ if(entityPlayer.capabilities.isCreativeMode) index = 1;
+ boolean canPlace = item != null && (JewelrycraftUtil.isMetal(item) || JewelrycraftUtil.isOre(item) || index >= 0);
boolean isOre = false, oreCoincidesWithMetal = false, itemCoincidesWithMetal = false, itemCoincidesWithMoltenMetal = false, overflow = false;
isOre = JewelrycraftUtil.isOre(item);
if (te.metal != null && te.metal.getItem() != null) itemCoincidesWithMetal = item.getItem().equals(te.metal.getItem()) && item.getItemDamage() == te.metal.getItemDamage();
- if (te.moltenMetal != null && te.moltenMetal.getItem() != null)
- {
+ if (te.moltenMetal != null && te.moltenMetal.getItem() != null){
itemCoincidesWithMoltenMetal = item.getItem().equals(te.moltenMetal.getItem()) && item.getItemDamage() == te.moltenMetal.getItemDamage();
if (isOre) oreCoincidesWithMetal = te.moltenMetal.getItem().equals(JewelrycraftUtil.getIngotFromOre(item.getItem()).getItem()) && te.moltenMetal.getItemDamage() == JewelrycraftUtil.getIngotFromOre(item.getItem()).getItemDamage();
}
- overflow = isOre ? (te.metal.stackSize * 0.2f + te.quantity < 0.8f) : (te.metal.stackSize * 0.1f + te.quantity < 0.9f);
+ overflow = isOre ? te.metal.stackSize * 0.2f + te.quantity < 0.8f : te.metal.stackSize * 0.1f + te.quantity < 0.9f;
boolean isValid = te.hasMoltenMetal ? itemCoincidesWithMoltenMetal : true;
- if (te.quantity < 0.9f && !te.pouring && canPlace && isValid)
- {
- boolean check = isOre ? (oreCoincidesWithMetal && te.quantity < 0.8f) : itemCoincidesWithMoltenMetal;
+ if (te.quantity < 0.9f && !te.pouring && canPlace && isValid){
+ boolean check = isOre ? oreCoincidesWithMetal && te.quantity < 0.8f : itemCoincidesWithMoltenMetal;
boolean check2 = isOre ? oreCoincidesWithMetal : itemCoincidesWithMetal;
- if ((!te.hasMetal && !te.hasMoltenMetal) || (!te.hasMetal && te.hasMoltenMetal && check))
- {
+ if (!te.hasMetal && !te.hasMoltenMetal || !te.hasMetal && te.hasMoltenMetal && check){
entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.nowsmeltingingot", item.getDisplayName())));
te.metal = item.copy();
-// if (Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.carpet)) te.metal.setItemDamage(15 - te.metal.getItemDamage());
+ // if (Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(te.metal.getItem()) == Block.getIdFromBlock(Blocks.carpet)) te.metal.setItemDamage(15 - te.metal.getItemDamage());
te.metal.stackSize = 1;
te.hasMetal = true;
te.melting = ConfigHandler.ingotMeltingTime;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
te.isDirty = true;
- }
- else if ((te.hasMetal && te.hasMoltenMetal && check2 && overflow) || (te.hasMetal && !te.hasMoltenMetal && itemCoincidesWithMetal && overflow))
- {
+ }else if (te.hasMetal && te.hasMoltenMetal && check2 && overflow || te.hasMetal && !te.hasMoltenMetal && itemCoincidesWithMetal && overflow){
entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("Smelting extra " + (isOre ? "ores" : "ingots") + " (" + (te.metal.stackSize + 1) + ")")));
te.metal.stackSize++;
te.hasMetal = true;
@@ -171,26 +167,21 @@ public class BlockSmelter extends BlockContainer
te.isDirty = true;
}
te.isDirty = true;
- }
- else if (item != null && (te.hasMetal || te.hasMoltenMetal) && !itemCoincidesWithMoltenMetal && te.quantity < 0.9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("Item does not match contents!")));
+ }else if (item != null && (te.hasMetal || te.hasMoltenMetal) && !itemCoincidesWithMoltenMetal && te.quantity < 0.9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("Item does not match contents!")));
else if (item != null && !item.getUnlocalizedName().toLowerCase().contains("ingot") && te.quantity < 0.9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.itemrenamedtoingot")));
else if (item != null && te.quantity >= 0.9f) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("Smelter is at full capacity.")));
- }
- else if (item != null && item.getItem() != null && item.getItem() instanceof ItemMoltenMetalBucket && !te.hasMoltenMetal && !te.hasMetal)
- {
+ }else if (item != null && item.getItem() != null && item.getItem() instanceof ItemMoltenMetalBucket && !te.hasMoltenMetal && !te.hasMetal){
te.hasMoltenMetal = true;
ItemStack ingot = JewelryNBT.ingot(item);
if (Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.carpet)) ingot.setItemDamage(15 - ingot.getItemDamage());
te.moltenMetal = ingot;
te.quantity = 0.9f;
te.isDirty = true;
- if (!entityPlayer.capabilities.isCreativeMode)
- {
+ if (!entityPlayer.capabilities.isCreativeMode){
--item.stackSize;
dropItem(world, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, new ItemStack(Items.bucket));
}
- }
- else if (item == null && te.hasMoltenMetal && te.moltenMetal.getItem() != null) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.hasmolteningot", te.moltenMetal.getDisplayName())));
+ }else if (item == null && te.hasMoltenMetal && te.moltenMetal.getItem() != null) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.hasmolteningot", te.moltenMetal.getDisplayName())));
world.setTileEntity(i, j, k, te);
}
return true;
@@ -199,30 +190,33 @@ public class BlockSmelter extends BlockContainer
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
+ TileEntitySmelter te = (TileEntitySmelter)world.getTileEntity(i, j, k);
TileEntityMolder me = null;
- if (world.getBlockMetadata(i, j, k) == 0 && world.getTileEntity(i, j, k - 1) != null && world.getTileEntity(i, j, k - 1) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i, j, k - 1);
- else if (world.getBlockMetadata(i, j, k) == 1 && world.getTileEntity(i + 1, j, k) != null && world.getTileEntity(i + 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i + 1, j, k);
- else if (world.getBlockMetadata(i, j, k) == 2 && world.getTileEntity(i, j, k + 1) != null && world.getTileEntity(i, j, k + 1) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i, j, k + 1);
- else if (world.getBlockMetadata(i, j, k) == 3 && world.getTileEntity(i - 1, j, k) != null && world.getTileEntity(i - 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i - 1, j, k);
-
- if (te != null && me != null && !world.isRemote)
- {
- if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me != null && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase)
- {
- te.pouring = true;
- te.isDirty = true;
- }
- else if (te.hasMetal && te.melting > 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.metalismelting", te.metal.getDisplayName()) + " (" + (((ConfigHandler.ingotMeltingTime*te.metal.stackSize) - te.melting) * 100 / (ConfigHandler.ingotMeltingTime*te.metal.stackSize)) + "%)"));
- else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k)) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderismissing")));
- else if (!me.hasMold && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasnomold")));
- else if (me.hasMoltenMetal && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasmoltenmetal")));
- else if (me.hasJewelBase && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.modlerhasitem")));
- else player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.empty")));
- }
-
+ if (world.getBlockMetadata(i, j, k) == 0 && world.getTileEntity(i, j, k - 1) != null && world.getTileEntity(i, j, k - 1) instanceof TileEntityMolder) me = (TileEntityMolder)world.getTileEntity(i, j, k - 1);
+ else if (world.getBlockMetadata(i, j, k) == 1 && world.getTileEntity(i + 1, j, k) != null && world.getTileEntity(i + 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder)world.getTileEntity(i + 1, j, k);
+ else if (world.getBlockMetadata(i, j, k) == 2 && world.getTileEntity(i, j, k + 1) != null && world.getTileEntity(i, j, k + 1) instanceof TileEntityMolder) me = (TileEntityMolder)world.getTileEntity(i, j, k + 1);
+ else if (world.getBlockMetadata(i, j, k) == 3 && world.getTileEntity(i - 1, j, k) != null && world.getTileEntity(i - 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder)world.getTileEntity(i - 1, j, k);
+ if (te != null && me != null && !world.isRemote) if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me != null && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase){
+ te.pouring = true;
+ te.isDirty = true;
+// System.out.println(Block.getBlockById(Item.getIdFromItem(te.moltenMetal.getItem())));
+ }else if (te.hasMetal && te.melting > 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.metalismelting", te.metal.getDisplayName()) + " (" + (ConfigHandler.ingotMeltingTime * te.metal.stackSize - te.melting) * 100 / (ConfigHandler.ingotMeltingTime * te.metal.stackSize) + "%)"));
+ else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k)) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderismissing")));
+ else if (!me.hasMold && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasnomold")));
+ else if (me.hasMoltenMetal && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasmoltenmetal")));
+ else if (me.hasJewelBase && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.modlerhasitem")));
+ else player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.empty")));
}
+ /**
+ * Determines if a molder is placed in front of this
+ *
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @return true if a molder is attached, false otherwise
+ */
public boolean isConnectedToMolder(World world, int i, int j, int k)
{
int blockMeta = world.getBlockMetadata(i, j, k);
@@ -232,14 +226,14 @@ public class BlockSmelter extends BlockContainer
else if (blockMeta == 3 && world.getBlock(i - 1, j, k) instanceof BlockMolder) return true;
return false;
}
-
+
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
-
+
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
@@ -258,9 +252,9 @@ public class BlockSmelter extends BlockContainer
return -1;
}
+ @Override
public void registerBlockIcons(IIconRegister icon)
{
- this.blockIcon = icon.registerIcon("jewelrycraft:smelter");
+ blockIcon = icon.registerIcon("jewelrycraft:smelter");
}
-
}
diff --git a/java/darkknight/jewelrycraft/client/ClientProxy.java b/java/darkknight/jewelrycraft/client/ClientProxy.java
index 8593b58..8f95d9e 100644
--- a/java/darkknight/jewelrycraft/client/ClientProxy.java
+++ b/java/darkknight/jewelrycraft/client/ClientProxy.java
@@ -4,24 +4,22 @@ import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.client.registry.ClientRegistry;
+import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
import darkknight.jewelrycraft.CommonProxy;
import darkknight.jewelrycraft.block.BlockList;
+import darkknight.jewelrycraft.entities.EntityHalfHeart;
+import darkknight.jewelrycraft.entities.EntityHeart;
+import darkknight.jewelrycraft.entities.renders.HeartRender;
import darkknight.jewelrycraft.model.ModelDisplayer;
+import darkknight.jewelrycraft.model.ModelHalfHeart;
import darkknight.jewelrycraft.model.ModelHandPedestal;
+import darkknight.jewelrycraft.model.ModelHeart;
import darkknight.jewelrycraft.model.ModelJewlersCraftingBench;
import darkknight.jewelrycraft.model.ModelMolder;
import darkknight.jewelrycraft.model.ModelShadowEye;
import darkknight.jewelrycraft.model.ModelShadowHand;
import darkknight.jewelrycraft.model.ModelSmelter;
-import darkknight.jewelrycraft.renders.ItemRender;
-import darkknight.jewelrycraft.renders.TileEntityDisplayerRender;
-import darkknight.jewelrycraft.renders.TileEntityHandPedestalRender;
-import darkknight.jewelrycraft.renders.TileEntityJewelrsCraftingTableRender;
-import darkknight.jewelrycraft.renders.TileEntityMolderRender;
-import darkknight.jewelrycraft.renders.TileEntityShadowEyeRender;
-import darkknight.jewelrycraft.renders.TileEntityShadowHandRender;
-import darkknight.jewelrycraft.renders.TileEntitySmelterRender;
import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
@@ -29,28 +27,43 @@ import darkknight.jewelrycraft.tileentity.TileEntityMolder;
import darkknight.jewelrycraft.tileentity.TileEntityShadowEye;
import darkknight.jewelrycraft.tileentity.TileEntityShadowHand;
import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
+import darkknight.jewelrycraft.tileentity.renders.ItemRender;
+import darkknight.jewelrycraft.tileentity.renders.TileEntityDisplayerRender;
+import darkknight.jewelrycraft.tileentity.renders.TileEntityHandPedestalRender;
+import darkknight.jewelrycraft.tileentity.renders.TileEntityJewelrsCraftingTableRender;
+import darkknight.jewelrycraft.tileentity.renders.TileEntityMolderRender;
+import darkknight.jewelrycraft.tileentity.renders.TileEntityShadowEyeRender;
+import darkknight.jewelrycraft.tileentity.renders.TileEntityShadowHandRender;
+import darkknight.jewelrycraft.tileentity.renders.TileEntitySmelterRender;
public class ClientProxy extends CommonProxy
{
@Override
public void registerRenderers()
{
+ ResourceLocation pedestalResourceLocation = new ResourceLocation("jewelrycraft", "textures/tileentities/BricksPedestal.png");
+ TileEntityHandPedestalRender pedestalRender = new TileEntityHandPedestalRender(new ModelHandPedestal(pedestalResourceLocation), pedestalResourceLocation);
+ ResourceLocation shadowResourceLocation = new ResourceLocation("jewelrycraft", "textures/tileentities/ShadowHand.png");
+ TileEntityShadowHandRender shadowHandRender = new TileEntityShadowHandRender(new ModelShadowHand(shadowResourceLocation), shadowResourceLocation);
+
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmelter.class, new TileEntitySmelterRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMolder.class, new TileEntityMolderRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityJewelrsCraftingTable.class, new TileEntityJewelrsCraftingTableRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDisplayer.class, new TileEntityDisplayerRender());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowEye.class, new TileEntityShadowEyeRender());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHandPedestal.class, new TileEntityHandPedestalRender());
- ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowHand.class, new TileEntityShadowHandRender());
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHandPedestal.class, pedestalRender);
+ ClientRegistry.bindTileEntitySpecialRenderer(TileEntityShadowHand.class, shadowHandRender);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.displayer), new ItemRender(new TileEntityDisplayerRender(), new TileEntityDisplayer(), new ModelDisplayer()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.jewelCraftingTable), new ItemRender(new TileEntityJewelrsCraftingTableRender(), new TileEntityJewelrsCraftingTable(), new ModelJewlersCraftingBench()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.smelter), new ItemRender(new TileEntitySmelterRender(), new TileEntitySmelter(), new ModelSmelter()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.molder), new ItemRender(new TileEntityMolderRender(), new TileEntityMolder(), new ModelMolder()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowEye), new ItemRender(new TileEntityShadowEyeRender(), new TileEntityShadowEye(), new ModelShadowEye()));
- MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.handPedestal), new ItemRender(new TileEntityHandPedestalRender(), new TileEntityHandPedestal(), new ModelHandPedestal()));
- MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowHand), new ItemRender(new TileEntityShadowHandRender(), new TileEntityShadowHand(), new ModelShadowHand()));
-
+ MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.handPedestal), new ItemRender(pedestalRender, new TileEntityHandPedestal(), new ModelHandPedestal(pedestalResourceLocation)));
+ MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(BlockList.shadowHand), new ItemRender(shadowHandRender, new TileEntityShadowHand(), new ModelShadowHand(shadowResourceLocation)));
VillagerRegistry.instance().registerVillagerSkin(3000, new ResourceLocation("jewelrycraft", "textures/entities/jeweler.png"));
+
+ RenderingRegistry.registerEntityRenderingHandler(EntityHeart.class, new HeartRender(new ModelHeart(), 0.25F));
+ RenderingRegistry.registerEntityRenderingHandler(EntityHalfHeart.class, new HeartRender(new ModelHalfHeart(), 0.25F));
}
}
diff --git a/java/darkknight/jewelrycraft/client/GuiGuide.java b/java/darkknight/jewelrycraft/client/GuiGuide.java
index 879c9b3..503e681 100644
--- a/java/darkknight/jewelrycraft/client/GuiGuide.java
+++ b/java/darkknight/jewelrycraft/client/GuiGuide.java
@@ -2,7 +2,6 @@ package darkknight.jewelrycraft.client;
import java.util.ArrayList;
import java.util.List;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -12,9 +11,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-
import org.lwjgl.opengl.GL11;
-
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.container.GuiRectangle;
import darkknight.jewelrycraft.container.GuiTab;
@@ -30,21 +27,32 @@ public class GuiGuide extends GuiContainer
World world;
private final GuiTab[] tabs;
private GuiTab activeTab;
+ ResourceLocation pageTexture, flippedPageTexture;
- public GuiGuide(Container container, World world)
+ /**
+ * @param container
+ * @param world
+ * @param pageTex
+ * @param flipPageTex
+ */
+ public GuiGuide(Container container, World world, ResourceLocation pageTex, ResourceLocation flipPageTex)
{
super(container);
page = 1;
rot = 0;
del = 0;
this.world = world;
-
- tabs = new GuiTab[]
- { new GuiTabBlocks(0), new GuiTabItems(1), new GuiTabGemsAndIngots(2), new GuiTabModifiers(3)};
-
+ tabs = new GuiTab[]{new GuiTabBlocks(0), new GuiTabItems(1), new GuiTabGemsAndIngots(2), new GuiTabModifiers(3)};
activeTab = tabs[0];
+ pageTexture = pageTex;
+ flippedPageTexture = flipPageTex;
}
+ /**
+ * @param f
+ * @param i
+ * @param j
+ */
@Override
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
@@ -53,115 +61,94 @@ public class GuiGuide extends GuiContainer
if (del == 0) rot++;
del++;
if (del >= 2) del = 0;
- Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePage.png"));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pageTexture);
drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10, 0, 0, 145, 180);
- Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png"));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(flippedPageTexture);
drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10, 0, 0, 145, 180);
-
- for (GuiRectangle tab : tabs)
- {
+ for(GuiRectangle tab: tabs){
int srcX = 24;
int sizeX = 19;
-
- if (tab == activeTab)
- {
+ if (tab == activeTab){
srcX += 38;
sizeX += 3;
- }
- else if (tab.inRect(this, i, j))
- {
- srcX += 19;
- }
-
+ }else if (tab.inRect(this, i, j)) srcX += 19;
tab.draw(this, srcX, 180, sizeX, 18);
}
-
- if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages())
- {
+ if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages()){
drawTexturedModalRect(guiLeft + 195 + 20, guiTop + 127 + 20, 0, 180, 11, 14);
nextHover = true;
}
-
- if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page - 2 > 0)
- {
+ if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page - 2 > 0){
drawTexturedModalRect(guiLeft - 61 + 20, guiTop + 127 + 20, 11, 180, 11, 14);
prevHover = true;
}
-
activeTab.drawBackground(this, i, j, page);
activeTab.drawBackground(this, i, j, page + 1);
-
ArrayList<String> text = new ArrayList<String>();
text.add(Integer.toString(page));
- this.drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
+ drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
text.remove(Integer.toString(page));
text.add(Integer.toString(page + 1));
- this.drawHoveringText(text, guiLeft - 10 + 20 + 147 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
-
- for (int tab = 0; tab < tabs.length; tab++)
+ drawHoveringText(text, guiLeft - 10 + 20 + 147 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
+ for(int tab = 0; tab < tabs.length; tab++)
renderItem(tabs[tab].getIcon(), guiLeft - 52, guiTop + 26 + tab * 19, activeTab.getIcon());
-
}
+ /**
+ * @param x
+ * @param y
+ */
+ @Override
protected void drawGuiContainerForegroundLayer(int x, int y)
{
activeTab.drawForeground(this, x, y, page);
activeTab.drawForeground(this, x, y, page + 1);
-
- for (GuiTab tab : tabs)
- {
+ for(GuiTab tab: tabs)
tab.drawString(this, x, y, tab.getName());
- }
}
+ /**
+ * @param x
+ * @param y
+ * @param button
+ */
@Override
protected void mouseClicked(int x, int y, int button)
{
if (nextHover && page + 2 <= activeTab.getMaxPages()) page += 2;
else if (prevHover && page > 1) page -= 2;
-
activeTab.mouseClick(this, x, y, button);
-
- for (GuiTab tab : tabs)
- {
- if (activeTab != tab)
- {
- if (tab.inRect(this, x, y))
- {
- activeTab = tab;
- page = 1;
- break;
- }
+ for(GuiTab tab: tabs)
+ if (activeTab != tab) if (tab.inRect(this, x, y)){
+ activeTab = tab;
+ page = 1;
+ break;
}
- }
}
+ /**
+ * @param item
+ * @param x
+ * @param y
+ * @param activeIcon
+ */
public void renderItem(ItemStack item, float x, float y, ItemStack activeIcon)
{
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
entityitem.hoverStart = 0.0F;
- if (item.isItemEqual(new ItemStack(BlockList.jewelAltar)))
- {
- y -= 4;
- }
+ if (item.isItemEqual(new ItemStack(BlockList.jewelAltar))) y -= 4;
GL11.glTranslatef(x, y, 100);
-
float scale = 30F;
GL11.glScalef(-scale, scale, scale);
-
if (activeIcon != null && item.isItemEqual(activeIcon)) GL11.glRotatef(rot, 0, 1, 0);
- if (item.isItemEqual(new ItemStack(BlockList.jewelAltar)))
- {
+ if (item.isItemEqual(new ItemStack(BlockList.jewelAltar))){
GL11.glRotatef(160.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
- }
- else GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
-
+ }else GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
+ else{
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
@@ -169,9 +156,14 @@ public class GuiGuide extends GuiContainer
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
-
}
+ /**
+ * @param item
+ * @param x
+ * @param y
+ * @param scale
+ */
public void renderItem(ItemStack item, float x, float y, float scale)
{
GL11.glPushMatrix();
@@ -183,8 +175,7 @@ public class GuiGuide extends GuiContainer
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
+ else{
RenderManager.instance.options.fancyGraphics = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
@@ -192,22 +183,36 @@ public class GuiGuide extends GuiContainer
GL11.glPopMatrix();
}
+ /**
+ * @return
+ */
public int getLeft()
{
return guiLeft;
}
+ /**
+ * @return
+ */
public int getTop()
{
return guiTop;
}
+ /**
+ * @return
+ */
public FontRenderer getFont()
{
return fontRendererObj;
}
- @SuppressWarnings("rawtypes")
+ /**
+ * @param lst
+ * @param x
+ * @param y
+ */
+ @SuppressWarnings ("rawtypes")
public void drawHoverString(List lst, int x, int y)
{
drawHoveringText(lst, x, y, fontRendererObj);
diff --git a/java/darkknight/jewelrycraft/client/GuiJewelry.java b/java/darkknight/jewelrycraft/client/GuiJewelry.java
index bbc6236..1d31770 100644
--- a/java/darkknight/jewelrycraft/client/GuiJewelry.java
+++ b/java/darkknight/jewelrycraft/client/GuiJewelry.java
@@ -1,32 +1,57 @@
package darkknight.jewelrycraft.client;
-import org.lwjgl.opengl.GL11;
-
-import darkknight.jewelrycraft.container.ContainerJewelryTab;
-import darkknight.jewelrycraft.container.ContainerRingChest;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.container.ContainerJewelryTab;
+import darkknight.jewelrycraft.events.KeyBindings;
public class GuiJewelry extends GuiContainer
-{
- public GuiJewelry(ContainerJewelryTab containerJewelryTab)
+{
+ ResourceLocation texture;
+
+ /**
+ * @param containerJewelryTab
+ * @param texture
+ */
+ public GuiJewelry(ContainerJewelryTab containerJewelryTab, ResourceLocation texture)
{
super(containerJewelryTab);
xSize = 194;
ySize = 166;
+ this.texture = texture;
}
+ /**
+ * @param f
+ * @param mouseX
+ * @param mouseY
+ */
@Override
public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY)
{
- GL11.glColor3f(1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/jewelry_tab.png"));
+ GL11.glColor3f(1, 1, 1);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
+ /**
+ * @param mouseX
+ * @param mouseY
+ */
@Override
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
+ {}
+
+ /**
+ * @param charecter
+ * @param key
+ */
+ @Override
+ protected void keyTyped(char charecter, int key)
{
+ super.keyTyped(charecter, key);
+ if (key == KeyBindings.inventory.getKeyCode()) mc.thePlayer.closeScreen();
}
}
diff --git a/java/darkknight/jewelrycraft/client/GuiRingChest.java b/java/darkknight/jewelrycraft/client/GuiRingChest.java
index f711558..2504d6f 100644
--- a/java/darkknight/jewelrycraft/client/GuiRingChest.java
+++ b/java/darkknight/jewelrycraft/client/GuiRingChest.java
@@ -1,35 +1,46 @@
package darkknight.jewelrycraft.client;
-import org.lwjgl.opengl.GL11;
-
-import darkknight.jewelrycraft.container.ContainerRingChest;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.container.ContainerRingChest;
public class GuiRingChest extends GuiContainer
{
public ContainerRingChest container;
+ ResourceLocation texture;
- public GuiRingChest(ContainerRingChest container)
+ /**
+ * @param container
+ * @param texture
+ */
+ public GuiRingChest(ContainerRingChest container, ResourceLocation texture)
{
super(container);
this.container = container;
xSize = 176;
ySize = 166;
+ this.texture = texture;
}
+ /**
+ * @param f
+ * @param mouseX
+ * @param mouseY
+ */
@Override
public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY)
{
GL11.glColor3f(1, 1, 1);
-
- Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/chest_ring.png"));
-
+ Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
+ /**
+ * @param mouseX
+ * @param mouseY
+ */
@Override
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
diff --git a/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java b/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java
new file mode 100644
index 0000000..582b99c
--- /dev/null
+++ b/java/darkknight/jewelrycraft/commands/JewelrycraftCommands.java
@@ -0,0 +1,124 @@
+/**
+ *
+ */
+package darkknight.jewelrycraft.commands;
+
+/**
+ * @author Sorin
+ *
+ */
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.command.WrongUsageException;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.ChatComponentTranslation;
+import net.minecraft.util.IChatComponent;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.curses.Curse;
+import darkknight.jewelrycraft.events.EntityEventHandler;
+import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+import darkknight.jewelrycraft.util.PlayerUtils;
+
+public class JewelrycraftCommands extends CommandBase
+{
+ private List aliases;
+
+ public JewelrycraftCommands()
+ {
+ this.aliases = new ArrayList();
+ this.aliases.add("jw");
+ this.aliases.add("jc");
+ this.aliases.add("jcrft");
+ this.aliases.add("jCraft");
+ this.aliases.add("jewelry");
+ }
+
+ @Override
+ public String getCommandName()
+ {
+ return "jewelrycraft";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender var1)
+ {
+ String use = "/jewelrycraft <addCursePoints:getCursePoints:setCursePoints> <user> [points] | ";
+ use += "/jewelrycraft <addModifier> <modifier> |";
+ use += "/jewelrycraft <addCurse> <curse> ";
+ return use;
+ }
+
+ @Override
+ public List getCommandAliases()
+ {
+ return aliases;
+ }
+
+ @Override
+ public void processCommand(ICommandSender commandSender, String[] astring)
+ {
+ if (astring.length == 0 || astring[0].equals("help")) throw new WrongUsageException(getCommandUsage(commandSender));
+ if (astring[0].equals("getCursePoints")){
+ EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
+ commandSender.addChatMessage(new ChatComponentTranslation(Integer.toString(JewelrycraftUtil.getCursePoints(entityplayermp))));
+ }else if (astring[0].equals("addCursePoints")){
+ int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0);
+ EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
+ JewelrycraftUtil.addCursePoints(entityplayermp, points);
+ }else if (astring[0].equals("setCursePoints")){
+ int points = CommandBase.parseIntWithMin(commandSender, astring[2], 0);
+ EntityPlayerMP entityplayermp = getPlayer(commandSender, astring[1]);
+ JewelrycraftUtil.addCursePoints(entityplayermp, points - JewelrycraftUtil.getCursePoints(entityplayermp));
+ }else if (astring[0].equals("addModifier")){
+ ItemStack item = new ItemStack(CommandBase.getItemByText(commandSender, astring[1]));
+ EntityPlayerMP entityplayermp = getPlayer(commandSender, commandSender.getCommandSenderName());
+ ArrayList<ItemStack> modifier = new ArrayList<ItemStack>();
+ modifier.add(item);
+ JewelryNBT.addModifiers(entityplayermp.getCurrentEquippedItem(), modifier);
+ }else if (astring[0].equals("addCurse")){
+ int curse = Integer.valueOf(astring[1]);
+ EntityPlayerMP entityplayermp = getPlayer(commandSender, commandSender.getCommandSenderName());
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(entityplayermp, "Jewelrycraft");
+ if (curse < Curse.availableCurses.size()){
+ try{
+ for(int i = 0; i <= 5; i++)
+ EntityEventHandler.addCurse(entityplayermp, playerInfo, ("curse" + i).toString(), curse);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ }
+ catch(Exception e){
+ entityplayermp.addChatMessage(new ChatComponentText(curse + " " + Curse.availableCurses.size()));
+ }
+ }
+ }
+ }
+
+ @Override
+ public List addTabCompletionOptions(ICommandSender icommandsender, String[] astring)
+ {
+ final List<String> MATCHES = new LinkedList<String>();
+ final String ARG_LC = astring[astring.length - 1].toLowerCase();
+ if (astring.length == 1){
+ if ("addCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addCursePoints");
+ if ("getCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("getCursePoints");
+ if ("setCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("setCursePoints");
+ if ("setCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addModifier");
+ if ("setCursePoints".toLowerCase().startsWith(ARG_LC)) MATCHES.add("addCurse");
+ }else if (astring.length == 2){
+ if (!astring[0].equals("addModifier") && !astring[0].equals("addCurse")){
+ for(String un: MinecraftServer.getServer().getAllUsernames())
+ if (un.toLowerCase().startsWith(ARG_LC)) MATCHES.add(un);
+ }else return getListOfStringsFromIterableMatchingLastWord(astring, Item.itemRegistry.getKeys());
+ }
+ return MATCHES.isEmpty() ? null : MATCHES;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/config/ConfigHandler.java b/java/darkknight/jewelrycraft/config/ConfigHandler.java
index 3d28829..a7d4157 100644
--- a/java/darkknight/jewelrycraft/config/ConfigHandler.java
+++ b/java/darkknight/jewelrycraft/config/ConfigHandler.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.config;
import java.io.File;
-
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@@ -11,7 +10,6 @@ public class ConfigHandler
public static int ingotCoolingTime = 100;
public static int ingotMeltingTime = 1500;
public static int jewelryCraftingTime = 200;
-
private static boolean isInitialized = false;
public static boolean generateVillageNetherstar = false;
public static boolean canFurnacesGenerateIngots = true;
@@ -25,24 +23,23 @@ public class ConfigHandler
public static int furnacesIngotStackMin = 2;
public static int furnacesIngotStackMax = 5;
+ /**
+ * Generates the config file and all the elements and attributes them to the appropriate variables if they exist
+ *
+ * @param e FMLPreInitializationEvent
+ */
public static void preInit(FMLPreInitializationEvent e)
{
- if (!isInitialized)
- {
+ if (!isInitialized){
config = new Configuration(new File(e.getModConfigurationDirectory(), "JewelryCraftv2.0.cfg"));
-
config.load();
-
ingotCoolingTime = config.get("Timers", "Molder Ingot Cooling Time", ingotCoolingTime, "This sets the number of ticks you need to wait before the mold is cooled.").getInt();
ingotMeltingTime = config.get("Timers", "Ingot Melting Time", ingotMeltingTime, "This sets the number of ticks you need to wait before an ingot is completely smelted.").getInt();
jewelryCraftingTime = config.get("Timers", "Jewelry Crafting Time", jewelryCraftingTime, "This sets the number of ticks it takes for a jewel to be modified.").getInt();
-
generateVillageNetherstar = config.get("Village Generation", "Netherstar Generation", generateVillageNetherstar, "If set to true Nether Stars will be able to generate in Jewelers chests.").getBoolean(generateVillageNetherstar);
canFurnacesGenerateIngots = config.get("Village Generation", "Furnace Ingots Generation", canFurnacesGenerateIngots, "If set to true jewelers will generate ingots in furnaces.").getBoolean(canFurnacesGenerateIngots);
-
maxVillageJewelers = config.get("Village Generation", "Maximum Jewelers", maxVillageJewelers, "Sets how many jewelers can be in a village.").getInt();
jewelerWeight = config.get("Village Generation", "Jewelers Weight", jewelerWeight, "Chance of getting a jeweler in a village. The higher the value, the higher the chance.").getInt();
-
ingotChestMin = config.get("Village Generation", "Ingot Chest Min", ingotChestMin, "Minimum number of ingots that can be found in a chest from the Jeweler. (It's the chest from the back part)").getInt();
ingotChestMax = config.get("Village Generation", "Ingot Chest Max", ingotChestMax, "Maximum number of ingots that can be found in a chest from the Jeweler. (It's the chest from the back part)").getInt();
ingotChestMaxStack = config.get("Village Generation", "Ingot Chest Max Stack", ingotChestMaxStack, "Maximum number of the stack the ingots can be. For example: if set to 2 and ingots have a chance of generating, you have a chance of getting a stack of max 2 ingots in a chest.").getInt();
@@ -50,9 +47,7 @@ public class ConfigHandler
jewelsChestMax = config.get("Village Generation", "Jewelers Chest Max", jewelsChestMax, "Determines the maximum nuber of jewels/modifiers that can be generated in the front chests of a Jeweler.").getInt();
furnacesIngotStackMin = config.get("Village Generation", "Ingot Furnace Min", furnacesIngotStackMin, "Determines the minimum number of ingots that can generate in a furnace.").getInt();
furnacesIngotStackMax = config.get("Village Generation", "Ingot Furnace Max", furnacesIngotStackMax, "Determines the maximum number of ingots that can generate in a furnace.").getInt();
-
config.save();
-
isInitialized = true;
}
}
diff --git a/java/darkknight/jewelrycraft/container/ContainerGuide.java b/java/darkknight/jewelrycraft/container/ContainerGuide.java
index 53f5bb8..b6513a3 100644
--- a/java/darkknight/jewelrycraft/container/ContainerGuide.java
+++ b/java/darkknight/jewelrycraft/container/ContainerGuide.java
@@ -9,10 +9,16 @@ import net.minecraft.inventory.Container;
public class ContainerGuide extends Container
{
+ /**
+ *
+ */
public ContainerGuide()
- {
- }
+ {}
+ /**
+ * @param entityplayer
+ * @return
+ */
@Override
public boolean canInteractWith(EntityPlayer entityplayer)
{
diff --git a/java/darkknight/jewelrycraft/container/ContainerJewelryTab.java b/java/darkknight/jewelrycraft/container/ContainerJewelryTab.java
index e33976a..701b338 100644
--- a/java/darkknight/jewelrycraft/container/ContainerJewelryTab.java
+++ b/java/darkknight/jewelrycraft/container/ContainerJewelryTab.java
@@ -1,65 +1,87 @@
package darkknight.jewelrycraft.container;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
-import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.item.ItemBracelet;
+import darkknight.jewelrycraft.item.ItemEarrings;
+import darkknight.jewelrycraft.item.ItemNecklace;
+import darkknight.jewelrycraft.item.ItemRing;
public class ContainerJewelryTab extends Container
{
- public ContainerJewelryTab(EntityPlayer player, InventoryPlayer inv)
+
+ /**
+ * @param player
+ * @param inv
+ * @param extra
+ */
+ public ContainerJewelryTab(EntityPlayer player, IInventory inv, IInventory extra)
{
int x, y;
// Rings
- for (x = 0; x <= 9; x++)
- this.addSlotToContainer(new SlotRing(new JewelryInventory(), x, 8 + x * 18, 7));
-
+ for(x = 0; x <= 9; x++)
+ addSlotToContainer(new SlotRing(extra, x, 8 + x * 18, 7));
+ // Bracelets
+ for(x = 10; x <= 13; x++)
+ addSlotToContainer(new SlotBracelet(extra, x, 8 + (x - 10) * 18, 26));
+ // Necklaces
+ for(x = 14; x <= 16; x++)
+ addSlotToContainer(new SlotNecklace(extra, x, 8 + (x - 14) * 18, 45));
+ // Earrings
+ addSlotToContainer(new SlotEarrings(extra, 17, 8, 64));
// Hotbar
- for (x = 0; x < 9; ++x)
- this.addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142));
-
+ for(x = 0; x < 9; ++x)
+ addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142));
// Inventory
- for (x = 0; x < 3; ++x)
- for (y = 0; y < 9; ++y)
- this.addSlotToContainer(new Slot(inv, 9 + y + x * 9, 17 + y * 18, 84 + x * 18));
-
+ for(x = 0; x < 3; ++x)
+ for(y = 0; y < 9; ++y)
+ addSlotToContainer(new Slot(inv, 9 + y + x * 9, 17 + y * 18, 84 + x * 18));
}
+ /**
+ * @param player
+ * @return
+ */
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
+ /**
+ * @param player
+ * @param slotID
+ * @return
+ */
@Override
- public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
+ public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
ItemStack itemstack = null;
- Slot slot = (Slot) this.inventorySlots.get(par2);
-
-// if (slot != null && slot.getHasStack())
-// {
-// ItemStack itemstack1 = slot.getStack();
-// itemstack = itemstack1.copy();
-//
-// if (par2 < 27)
-// {
-// if (!this.mergeItemStack(itemstack1, 27, this.inventorySlots.size(), true)) { return null; }
-// }
-// else if (!this.mergeItemStack(itemstack1, 0, 27, false)) { return null; }
-//
-// if (itemstack1.stackSize == 0)
-// {
-// slot.putStack((ItemStack) null);
-// }
-// else
-// {
-// slot.onSlotChanged();
-// }
-// }
-//
+ Slot slot = (Slot)inventorySlots.get(slotID);
+ if (slot != null && slot.getHasStack()){
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+ if (slotID < 18){
+ if (!mergeItemStack(itemstack1, 18, 18 + 36, true)) return null;
+ slot.onSlotChange(itemstack1, itemstack);
+ }else if (itemstack1.getItem() instanceof ItemRing){
+ if (!mergeItemStack(itemstack1, 0, 10, false)) return null;
+ }else if (itemstack1.getItem() instanceof ItemBracelet){
+ if (!mergeItemStack(itemstack1, 10, 14, false)) return null;
+ }else if (itemstack1.getItem() instanceof ItemNecklace){
+ if (!mergeItemStack(itemstack1, 14, 17, false)) return null;
+ }else if (itemstack1.getItem() instanceof ItemEarrings){
+ if (!mergeItemStack(itemstack1, 17, 18, false)) return null;
+ }else{
+ if (!mergeItemStack(itemstack1, 18, 54, true)) return null;
+ slot.onSlotChange(itemstack1, itemstack);
+ }
+ if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null);
+ else slot.onSlotChanged();
+ }
return itemstack;
}
}
diff --git a/java/darkknight/jewelrycraft/container/ContainerRingChest.java b/java/darkknight/jewelrycraft/container/ContainerRingChest.java
index 91bb346..925ded7 100644
--- a/java/darkknight/jewelrycraft/container/ContainerRingChest.java
+++ b/java/darkknight/jewelrycraft/container/ContainerRingChest.java
@@ -11,56 +11,53 @@ public class ContainerRingChest extends Container
{
public TileEntityChest theChest;
+ /**
+ * @param inv
+ * @param chest
+ */
public ContainerRingChest(InventoryPlayer inv, TileEntityChest chest)
{
theChest = chest;
-
int x, y;
-
- for (x = 0; x < 9; x++)
- addSlotToContainer(new SlotRingChest(inv, x, 8 + (18 * x), 142, x == inv.currentItem));
- for (y = 0; y < 3; y++)
- for (x = 0; x < 9; x++)
- addSlotToContainer(new Slot(inv, x + 9 + (y * 9), 8 + (18 * x), 84 + (y * 18)));
-
- for (y = 0; y < 3; y++)
- for (x = 0; x < 9; x++)
- addSlotToContainer(new SlotRingChest(chest, 26 - (x + (y * 9)), 8 + (18 * (8 - x)), 17 + ((2 - y) * 18), false));
+ for(x = 0; x < 9; x++)
+ addSlotToContainer(new SlotRingChest(inv, x, 8 + 18 * x, 142, x == inv.currentItem));
+ for(y = 0; y < 3; y++)
+ for(x = 0; x < 9; x++)
+ addSlotToContainer(new Slot(inv, x + 9 + y * 9, 8 + 18 * x, 84 + y * 18));
+ for(y = 0; y < 3; y++)
+ for(x = 0; x < 9; x++)
+ addSlotToContainer(new SlotRingChest(chest, 26 - (x + y * 9), 8 + 18 * (8 - x), 17 + (2 - y) * 18, false));
}
+ /**
+ * @param player
+ * @return
+ */
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
+ /**
+ * @param par1EntityPlayer
+ * @param par2
+ * @return
+ */
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack itemstack = null;
- Slot slot = (Slot) this.inventorySlots.get(par2);
-
- if (slot != null && slot.getHasStack())
- {
+ Slot slot = (Slot)inventorySlots.get(par2);
+ if (slot != null && slot.getHasStack()){
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
-
- if (par2 < 27)
- {
- if (!this.mergeItemStack(itemstack1, 27, this.inventorySlots.size(), true)) { return null; }
- }
- else if (!this.mergeItemStack(itemstack1, 0, 27, false)) { return null; }
-
- if (itemstack1.stackSize == 0)
- {
- slot.putStack((ItemStack) null);
- }
- else
- {
- slot.onSlotChanged();
- }
+ if (par2 < 27){
+ if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), true)) return null;
+ }else if (!mergeItemStack(itemstack1, 0, 27, false)) return null;
+ if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null);
+ else slot.onSlotChanged();
}
-
return itemstack;
}
}
diff --git a/java/darkknight/jewelrycraft/container/GuiHandler.java b/java/darkknight/jewelrycraft/container/GuiHandler.java
index 7773a38..6ebd3e9 100644
--- a/java/darkknight/jewelrycraft/container/GuiHandler.java
+++ b/java/darkknight/jewelrycraft/container/GuiHandler.java
@@ -2,6 +2,7 @@ package darkknight.jewelrycraft.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
@@ -12,38 +13,64 @@ import darkknight.jewelrycraft.client.GuiRingChest;
public class GuiHandler implements IGuiHandler
{
+ ResourceLocation pageTexture = new ResourceLocation("jewelrycraft", "textures/gui/guidePage.png");
+ ResourceLocation flippedPageTexture = new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png");
+ ResourceLocation chestTexture = new ResourceLocation("jewelrycraft", "textures/gui/chest_ring.png");
+ ResourceLocation jewelryInvTexture = new ResourceLocation("jewelrycraft", "textures/gui/jewelry_tab.png");
+
+ /**
+ *
+ */
public GuiHandler()
{
NetworkRegistry.INSTANCE.registerGuiHandler(JewelrycraftMod.instance, this);
}
+ /**
+ * @param ID
+ * @param player
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
- switch (ID)
+ switch(ID)
{
case 0:
- return new ContainerRingChest(player.inventory, (TileEntityChest) world.getTileEntity(x, y, z));
+ return new ContainerRingChest(player.inventory, (TileEntityChest)world.getTileEntity(x, y, z));
case 1:
return new ContainerGuide();
case 2:
- return new ContainerJewelryTab(player, player.inventory);
+ return new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player));
default:
return null;
}
}
+ /**
+ * @param ID
+ * @param player
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
- switch (ID)
+ switch(ID)
{
case 0:
- return new GuiRingChest((ContainerRingChest) getServerGuiElement(ID, player, world, x, y, z));
+ return new GuiRingChest((ContainerRingChest)getServerGuiElement(ID, player, world, x, y, z), chestTexture);
case 1:
- return new GuiGuide((ContainerGuide) getServerGuiElement(ID, player, world, x, y, z), world);
+ return new GuiGuide((ContainerGuide)getServerGuiElement(ID, player, world, x, y, z), world, pageTexture, flippedPageTexture);
case 2:
- return new GuiJewelry(new ContainerJewelryTab(player, player.inventory));
+ return new GuiJewelry(new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player)), jewelryInvTexture);
default:
return null;
}
diff --git a/java/darkknight/jewelrycraft/container/GuiRectangle.java b/java/darkknight/jewelrycraft/container/GuiRectangle.java
index 3ecf20c..50b7cd5 100644
--- a/java/darkknight/jewelrycraft/container/GuiRectangle.java
+++ b/java/darkknight/jewelrycraft/container/GuiRectangle.java
@@ -1,19 +1,22 @@
package darkknight.jewelrycraft.container;
import java.util.Arrays;
-
import net.minecraft.item.ItemStack;
-
import darkknight.jewelrycraft.client.GuiGuide;
public class GuiRectangle
{
-
private int x;
private int y;
private int w;
private int h;
+ /**
+ * @param x
+ * @param y
+ * @param w
+ * @param h
+ */
public GuiRectangle(int x, int y, int w, int h)
{
this.x = x;
@@ -22,42 +25,71 @@ public class GuiRectangle
this.h = h;
}
+ /**
+ * @param gui
+ * @param mouseX
+ * @param mouseY
+ * @return
+ */
public boolean inRect(GuiGuide gui, int mouseX, int mouseY)
{
mouseX -= gui.getLeft();
mouseY -= gui.getTop();
-
return x <= mouseX && mouseX <= x + w && y <= mouseY && mouseY <= y + h;
}
+ /**
+ * @param x
+ */
public void setX(int x)
{
this.x = x;
}
+ /**
+ * @param y
+ */
public void setY(int y)
{
this.y = y;
}
+ /**
+ * @param gui
+ * @param srcX
+ * @param srcY
+ */
public void draw(GuiGuide gui, int srcX, int srcY)
{
gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, w, h);
}
+ /**
+ * @param gui
+ * @param srcX
+ * @param srcY
+ * @param width
+ * @param height
+ */
public void draw(GuiGuide gui, int srcX, int srcY, int width, int height)
{
gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, width, height);
}
+ /**
+ * @param gui
+ * @param mouseX
+ * @param mouseY
+ * @param str
+ */
public void drawString(GuiGuide gui, int mouseX, int mouseY, String str)
{
- if (inRect(gui, mouseX, mouseY))
- {
- gui.drawHoverString(Arrays.asList(str.split("\n")), mouseX - gui.getLeft(), mouseY - gui.getTop());
- }
+ if (inRect(gui, mouseX, mouseY)) gui.drawHoverString(Arrays.asList(str.split("\n")), mouseX - gui.getLeft(), mouseY - gui.getTop());
}
+ /**
+ * @return
+ */
public ItemStack getIcon()
{
return null;
diff --git a/java/darkknight/jewelrycraft/container/GuiTab.java b/java/darkknight/jewelrycraft/container/GuiTab.java
index 959fef7..e315d3a 100644
--- a/java/darkknight/jewelrycraft/container/GuiTab.java
+++ b/java/darkknight/jewelrycraft/container/GuiTab.java
@@ -4,12 +4,16 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.client.GuiGuide;
-@SideOnly(Side.CLIENT)
+@SideOnly (Side.CLIENT)
public abstract class GuiTab extends GuiRectangle
{
int values, del;
private String name;
+ /**
+ * @param name
+ * @param id
+ */
public GuiTab(String name, int id)
{
super(-62, 10 + 19 * id, 19, 18);
@@ -18,30 +22,63 @@ public abstract class GuiTab extends GuiRectangle
del = 0;
}
+ /**
+ * @return
+ */
public String getName()
{
return name;
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
public abstract void drawBackground(GuiGuide gui, int x, int y, int page);
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
public abstract void drawForeground(GuiGuide gui, int x, int y, int page);
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param button
+ */
public void mouseClick(GuiGuide gui, int x, int y, int button)
- {
- }
+ {}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param button
+ * @param timeSinceClicked
+ */
public void mouseMoveClick(GuiGuide gui, int x, int y, int button, long timeSinceClicked)
- {
- }
+ {}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param button
+ */
public void mouseReleased(GuiGuide gui, int x, int y, int button)
- {
- }
+ {}
+ /**
+ * @return
+ */
public int getMaxPages()
{
return 1;
}
-
}
diff --git a/java/darkknight/jewelrycraft/container/GuiTabBlocks.java b/java/darkknight/jewelrycraft/container/GuiTabBlocks.java
index 237466c..c48aaa8 100644
--- a/java/darkknight/jewelrycraft/container/GuiTabBlocks.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabBlocks.java
@@ -1,7 +1,7 @@
package darkknight.jewelrycraft.container;
-import java.util.ArrayList;
-
+import java.awt.Desktop;
+import java.net.URL;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -13,23 +13,35 @@ import darkknight.jewelrycraft.item.ItemList;
public class GuiTabBlocks extends GuiTab
{
+ /**
+ * @param id
+ */
public GuiTabBlocks(int id)
{
super("Blocks", id);
}
+ /**
+ * @return
+ */
+ @Override
public ItemStack getIcon()
{
return new ItemStack(BlockList.jewelAltar);
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
@Override
public void drawBackground(GuiGuide gui, int x, int y, int page)
{
String text = "";
- ArrayList<ItemStack> items = new ArrayList<ItemStack>();
- int xPos = (page % 2 == 0) ? 107 : -35;
- switch (page)
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch(page)
{
case 1:
text = "This ore is extremely rare and can be found only between Y-level 5 and 8. It can only be mined using a diamond pickaxe.";
@@ -37,10 +49,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 2:
text = "The Shadow Block is crafted using 9 shadow ingots. Magicians believed it held the ability to merge with the shadows. It becomes more transparent as it";
- items.add(new ItemStack(BlockList.shadowBlock));
- for (int i = 1; i <= 9; i++)
- items.add(new ItemStack(ItemList.shadowIngot));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.shadowBlock), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot));
break;
case 3:
text = "gets darker. If a comparator is attached to it, the output strength will be equal to the value of darkness it is in.";
@@ -48,17 +57,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 4:
text = "The smelter is one of the first blocks needed to get started with Jewelrycraft. Requiring just some cobble and a couple buckets. It is required in order to";
- items.add(new ItemStack(BlockList.smelter));
- items.add(new ItemStack(Blocks.cobblestone));
- items.add(new ItemStack(Items.bucket));
- items.add(new ItemStack(Blocks.cobblestone));
- items.add(new ItemStack(Blocks.cobblestone));
- items.add(null);
- items.add(new ItemStack(Blocks.cobblestone));
- items.add(new ItemStack(Blocks.cobblestone));
- items.add(new ItemStack(Items.lava_bucket));
- items.add(new ItemStack(Blocks.cobblestone));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.smelter), new ItemStack(Blocks.cobblestone), new ItemStack(Items.bucket), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Items.lava_bucket), new ItemStack(Blocks.cobblestone));
break;
case 5:
text = "melt ingots or even ores which can be made into rings, necklaces, bracelets or earrings. To use the block all you need to do is right click on it with any ore or ingot. It can melt multimple ingots/ores at a time. Crouch (default: Shift) + Right Click will remove all items";
@@ -70,14 +69,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 7:
text = "The molder is a key piece in creating jewellery. You need to pour the molten metal out of the smelter somewhere. That somewhere is the";
-
- items.add(new ItemStack(BlockList.molder));
- items.add(new ItemStack(Blocks.cobblestone));
- items.add(null);
- items.add(new ItemStack(Blocks.cobblestone));
- for (int i = 1; i <= 3; i++)
- items.add(new ItemStack(Blocks.cobblestone));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.molder), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone));
break;
case 8:
text = "molder. But before pouring the molten metal in it, you must first add a mold. You can do that by simply right clicking the block with the mold of your choice. If you want to get the mold out, simply crouch and Right Click it with an empty hand. Once you";
@@ -93,16 +85,7 @@ public class GuiTabBlocks extends GuiTab
del++;
if (del >= 300) del = 0;
if (values >= 4) values = 0;
- items.add(new ItemStack(BlockList.jewelCraftingTable));
- for (int i = 1; i <= 3; i++)
- items.add(new ItemStack(Blocks.planks, 1, values));
- items.add(new ItemStack(Blocks.cobblestone));
- items.add(null);
- items.add(new ItemStack(Blocks.cobblestone));
- items.add(new ItemStack(Blocks.cobblestone));
- items.add(null);
- items.add(new ItemStack(Blocks.cobblestone));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.jewelCraftingTable), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone));
break;
case 11:
text = "can find a list with all possible gems in this guide). Crouch + Right Click to retreive placed items. Left Click the block to see the progress the crafting has made. Once the crafting is done, Left Click the block to get the item. You are able to recraft a";
@@ -114,17 +97,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 13:
text = "This block can store any jewellery in it and activate their effects as it were a player. To do that simply right click the block with a jewellery. Crouch +";
- items.add(new ItemStack(BlockList.jewelAltar));
- items.add(new ItemStack(Blocks.end_stone));
- items.add(new ItemStack(Blocks.wool, 1, 5));
- items.add(new ItemStack(Blocks.end_stone));
- items.add(new ItemStack(Blocks.nether_brick));
- items.add(new ItemStack(Blocks.wool, 1, 5));
- items.add(new ItemStack(Blocks.nether_brick));
- items.add(new ItemStack(Blocks.nether_brick));
- items.add(new ItemStack(Blocks.nether_brick));
- items.add(new ItemStack(Blocks.nether_brick));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.jewelAltar), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.wool, 1, 5), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.wool, 1, 5), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick));
break;
case 14:
text = "Right Click to retreive the jewellery.";
@@ -132,17 +105,7 @@ public class GuiTabBlocks extends GuiTab
break;
case 15:
text = "The Storage Displayer, as the name suggests, can store a large amount (Up to: " + Integer.MAX_VALUE + ") of a single item/block placed in it. It will";
- items.add(new ItemStack(BlockList.displayer));
- items.add(null);
- items.add(new ItemStack(Items.iron_ingot));
- items.add(null);
- items.add(new ItemStack(Items.iron_ingot));
- items.add(new ItemStack(Items.iron_ingot));
- items.add(new ItemStack(Items.iron_ingot));
- items.add(new ItemStack(Blocks.emerald_block));
- items.add(new ItemStack(Blocks.emerald_block));
- items.add(new ItemStack(Blocks.emerald_block));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.displayer), null, new ItemStack(Items.iron_ingot), null, new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block));
break;
case 16:
text = "display all possible infromation about the object in it, such as the name, durability, enchantments etc. To store something in it simply right click with that object on it and the whole amount of items or blocks you are holding will be immediately stored inside.";
@@ -156,19 +119,60 @@ public class GuiTabBlocks extends GuiTab
text = "get a whole stack, Crouch + Left Click on it. In creative mode you can simply hold Right Click on a displayer containing an object and it will add 64 of it with every right click, without it being in your inventory.";
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
+ case 19:
+ text = "This mysterious shaped block is used in the ritual. The acient ones claimed it had the power to travel through worlds. They would use these to offer";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.handPedestal), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), null, new ItemStack(Blocks.stonebrick), null, new ItemStack(Blocks.stone_slab, 1, 5), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stone_slab, 1, 5));
+ break;
+ case 20:
+ text = "sacrifices to 'The Dark One' in exchange for unimaginable powers.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 21:
+ text = "The Cursed Eye is an ancient artifact also known as 'The Dark One's Eye'. It is part of the sacrifice ritual the ancient ones talk about. Be careful";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.shadowEye), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Items.ender_eye), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick));
+ break;
+ case 22:
+ String link = "HERE";
+ if (x >= gui.getLeft() + 130 && x <= gui.getLeft() + 160 && y >= gui.getTop() + 40 && y <= gui.getTop() + 50) link = EnumChatFormatting.DARK_BLUE + "HERE" + EnumChatFormatting.BLACK;
+ text = "though, for He sees everything. To see how to create the ritual click " + link + " for a link with the pictures (will be part of the book later).";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
default:
;
}
}
+ /**
+ * @return
+ */
+ @Override
public int getMaxPages()
{
- return 17;
+ return 21;
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param button
+ */
@Override
- public void drawForeground(GuiGuide gui, int x, int y, int page)
+ public void mouseClick(GuiGuide gui, int x, int y, int button)
{
+ if (gui.page == 21 && x >= gui.getLeft() + 130 && x <= gui.getLeft() + 160 && y >= gui.getTop() + 40 && y <= gui.getTop() + 50) try{
+ Desktop.getDesktop().browse(new URL("http://imgur.com/a/Zk0LW").toURI());
+ }
+ catch(Exception e){}
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page)
+ {}
}
diff --git a/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java b/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java
index 7e9c815..aa41611 100644
--- a/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java
@@ -3,60 +3,76 @@ package darkknight.jewelrycraft.container;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-
import org.lwjgl.opengl.GL11;
-
import darkknight.jewelrycraft.client.GuiGuide;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class GuiTabGemsAndIngots extends GuiTab
{
+
+ /**
+ * @param id
+ */
public GuiTabGemsAndIngots(int id)
{
super("Gems and ingots", id);
}
+ /**
+ * @return
+ */
+ @Override
public ItemStack getIcon()
{
return new ItemStack(Items.emerald);
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
@Override
public void drawBackground(GuiGuide gui, int x, int y, int page)
{
- int xPos = (page % 2 == 0) ? 107 : -35;
+ int xPos = page % 2 == 0 ? 107 : -35;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- for (int i = (page - 1) * 9; i < page * 9; i++)
- if (i < JewelrycraftUtil.gem.size())
- {
+ for(int i = (page - 1) * 9; i < page * 9; i++)
+ if (i < JewelrycraftUtil.gem.size()){
gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Gems", gui.getLeft() + xPos + 40, gui.getTop(), 0);
gui.renderItem(JewelrycraftUtil.gem.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f);
gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.gem.get(i).getDisplayName()), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16 * (i - 9 * (page - 1)), 0);
GL11.glDisable(GL11.GL_LIGHTING);
}
- page -= (JewelrycraftUtil.gem.size() / 9 + 1);
- for (int i = (page - 1) * 9; i < page * 9; i++)
- {
- if (i < JewelrycraftUtil.metal.size() && page > 0)
- {
+ page -= JewelrycraftUtil.gem.size() / 9 + 1;
+ for(int i = (page - 1) * 9; i < page * 9; i++)
+ if (i < JewelrycraftUtil.metal.size() && page > 0){
gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Ingots", gui.getLeft() + xPos + 40, gui.getTop(), 0);
gui.renderItem(JewelrycraftUtil.metal.get(i).copy(), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f);
gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.metal.get(i).copy().getDisplayName()), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16 * (i - 9 * (page - 1)), 0);
GL11.glDisable(GL11.GL_LIGHTING);
}
- }
GL11.glDisable(GL11.GL_BLEND);
}
+ /**
+ * @return
+ */
+ @Override
public int getMaxPages()
{
return JewelrycraftUtil.gem.size() / 9 + JewelrycraftUtil.metal.size() / 9 + 2;
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
@Override
public void drawForeground(GuiGuide gui, int x, int y, int page)
- {
- }
-
+ {}
}
diff --git a/java/darkknight/jewelrycraft/container/GuiTabItems.java b/java/darkknight/jewelrycraft/container/GuiTabItems.java
index 5950218..03069b9 100644
--- a/java/darkknight/jewelrycraft/container/GuiTabItems.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabItems.java
@@ -2,8 +2,6 @@ package darkknight.jewelrycraft.container;
import java.awt.Desktop;
import java.net.URL;
-import java.util.ArrayList;
-
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -17,43 +15,43 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class GuiTabItems extends GuiTab
{
+ /**
+ * @param id
+ */
public GuiTabItems(int id)
{
super("Items", id);
}
+ /**
+ * @return
+ */
+ @Override
public ItemStack getIcon()
{
return new ItemStack(ItemList.thiefGloves);
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
@Override
public void drawBackground(GuiGuide gui, int x, int y, int page)
{
String text = "";
- ArrayList<ItemStack> items = new ArrayList<ItemStack>();
- int xPos = (page % 2 == 0) ? 107 : -35;
- switch (page)
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch(page)
{
case 1:
- text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewellery work.";
- items.add(new ItemStack(BlockList.shadowOre));
- items.add(new ItemStack(ItemList.shadowIngot));
- Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y);
+ text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewelry work.";
+ Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, new ItemStack(BlockList.shadowOre), new ItemStack(ItemList.shadowIngot));
break;
case 2:
text = "These gloves give you the chance to steal the trades those pesky Testificates have to offer. To use these simply open their gui at least once, then Crouch and";
- items.add(new ItemStack(ItemList.thiefGloves));
- items.add(new ItemStack(ItemList.shadowIngot));
- items.add(null);
- items.add(new ItemStack(ItemList.shadowIngot));
- items.add(new ItemStack(Blocks.wool, 1, 15));
- items.add(new ItemStack(ItemList.shadowIngot));
- items.add(new ItemStack(Blocks.wool, 1, 15));
- items.add(new ItemStack(Blocks.wool, 1, 15));
- items.add(new ItemStack(ItemList.shadowIngot));
- items.add(new ItemStack(Blocks.wool, 1, 15));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.thiefGloves), new ItemStack(ItemList.shadowIngot), null, new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15));
break;
case 3:
text = "right click on the them to hopefully steal the trades. If you traded with him before, then you have a chance of getting the traded emeralds back as well. This has a maximum of 10 uses before it breaks.";
@@ -61,105 +59,43 @@ public class GuiTabItems extends GuiTab
break;
case 4:
text = "In order to get the ingot back from the smelter you need a mold for it. However, this mold can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- items.add(new ItemStack(ItemList.clayMolds, 1, 0));
- items.add(new ItemStack(Items.clay_ball));
- items.add(new ItemStack(Items.clay_ball));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball));
break;
case 5:
text = "To create a ring you need a mold for it. However, this one is too soft to be used. It needs to be hardened in order for it to be used.";
- items.add(new ItemStack(ItemList.clayMolds, 1, 1));
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 1), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null);
break;
case 6:
text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- items.add(new ItemStack(ItemList.clayMolds, 1, 2));
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null);
break;
case 7:
text = "To create a bracelet you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- items.add(new ItemStack(ItemList.clayMolds, 1, 3));
- items.add(new ItemStack(Items.clay_ball));
- items.add(new ItemStack(Items.clay_ball));
- items.add(new ItemStack(Items.clay_ball));
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(new ItemStack(Items.clay_ball));
- items.add(new ItemStack(Items.clay_ball));
- items.add(new ItemStack(Items.clay_ball));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 3), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball));
break;
case 8:
text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used.";
- items.add(new ItemStack(ItemList.clayMolds, 1, 4));
- items.add(null);
- items.add(null);
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- items.add(new ItemStack(Items.clay_ball));
- items.add(null);
- items.add(null);
- items.add(null);
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 4), null, null, null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, null, null);
break;
case 9:
if (del == 0) values++;
del++;
if (del >= 300) del = 0;
if (values > 4) values = 0;
- text = "By smelting a clay mold you get a harder version which can be used to create jewellery. Simply right click with this on a molder to attach it and you're ready to go.";
- items.add(new ItemStack(ItemList.clayMolds, 1, values));
- items.add(new ItemStack(ItemList.molds, 1, values));
- Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y);
+ text = "By smelting a clay mold you get a harder version which can be used to create jewelry. Simply right click with this on a molder to attach it and you're ready to go.";
+ Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, new ItemStack(ItemList.clayMolds, 1, values), new ItemStack(ItemList.molds, 1, values));
break;
case 10:
- text = "Crystals don't do much as of yet. They can be dyed in any color and used as gems to create a nice jewellery.";
- items.add(new ItemStack(ItemList.crystal, 1, 15));
- items.add(null);
- items.add(new ItemStack(Blocks.glass));
- items.add(null);
- items.add(new ItemStack(Blocks.glass));
- items.add(null);
- items.add(new ItemStack(Blocks.glass));
- items.add(null);
- items.add(new ItemStack(Blocks.glass));
- items.add(null);
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
+ text = "Crystals don't do much as of yet. They can be dyed in any color and used as gems to create a nice jewelry.";
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.crystal, 1, 15), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null);
break;
case 11:
if (del == 0) values++;
del++;
if (del >= 300) del = 0;
if (values >= 15) values = 0;
- items.add(new ItemStack(ItemList.crystal, 1, values));
- items.add(new ItemStack(Items.dye, 1, values));
- items.add(new ItemStack(ItemList.crystal, 1, 15));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y);
- items.removeAll(items);
- items.add(new ItemStack(ItemList.crystal, 1, 15));
- items.add(new ItemStack(Items.dye, 1, 15));
- items.add(new ItemStack(ItemList.crystal, 1, values));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop() + 60, true, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, new ItemStack(ItemList.crystal, 1, values), new ItemStack(Items.dye, 1, values), new ItemStack(ItemList.crystal, 1, 15));
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop() + 60, true, text, x, y, new ItemStack(ItemList.crystal, 1, 15), new ItemStack(Items.dye, 1, 15), new ItemStack(ItemList.crystal, 1, values));
break;
case 12:
if (del == 0) values++;
@@ -167,10 +103,7 @@ public class GuiTabItems extends GuiTab
if (del >= 300) del = 0;
if (values > 4) values = 0;
text = "It's this exact guide. I don't even know why you're reading this. I added this recipe in case you lose the original. Even if this is more helpful than NEI, I do suggest";
- items.add(new ItemStack(ItemList.guide));
- items.add(new ItemStack(ItemList.molds, 1, values));
- items.add(new ItemStack(Items.book));
- Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y);
+ Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, new ItemStack(ItemList.guide), new ItemStack(ItemList.molds, 1, values), new ItemStack(Items.book));
break;
case 13:
String link = "HERE";
@@ -183,11 +116,11 @@ public class GuiTabItems extends GuiTab
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
case 15:
- ItemStack item = new ItemStack(ItemList.bucket);
+ ItemStack item = new ItemStack(ItemList.bucket);
if (del == 0) values++;
del++;
if (del >= 300) del = 0;
- if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
text = "These buckets contain molten metal. To obtain one simply Right Click a full Smelter to get a bucket. You can pour the metal, other than that it has no use. You can place the molten metal back in a Smelter by Right Clicking one with it.";
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, item, text, 40f, 0, 0, true, 45, 10);
@@ -197,28 +130,37 @@ public class GuiTabItems extends GuiTab
}
}
+ /**
+ * @return
+ */
+ @Override
public int getMaxPages()
{
return 15;
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param button
+ */
+ @Override
public void mouseClick(GuiGuide gui, int x, int y, int button)
{
- if (gui.page == 13 && x >= gui.getLeft() && x <= gui.getLeft() + 30 && y >= gui.getTop() + 104 && y <= gui.getTop() + 124)
- {
- try
- {
- Desktop.getDesktop().browse(new URL("http://www.minecraftforum.net/topic/2210959-164smp-ssp-jewelrycraft-version-12/").toURI());
- }
- catch (Exception e)
- {
- }
+ if (gui.page == 13 && x >= gui.getLeft() && x <= gui.getLeft() + 30 && y >= gui.getTop() + 104 && y <= gui.getTop() + 124) try{
+ Desktop.getDesktop().browse(new URL("http://www.minecraftforum.net/topic/2210959-164smp-ssp-jewelrycraft-version-12/").toURI());
}
+ catch(Exception e){}
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
@Override
public void drawForeground(GuiGuide gui, int x, int y, int page)
- {
- }
-
+ {}
}
diff --git a/java/darkknight/jewelrycraft/container/GuiTabModifiers.java b/java/darkknight/jewelrycraft/container/GuiTabModifiers.java
index 6a0143d..b7d4d1b 100644
--- a/java/darkknight/jewelrycraft/container/GuiTabModifiers.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabModifiers.java
@@ -1,50 +1,71 @@
package darkknight.jewelrycraft.container;
-import java.util.ArrayList;
-
-import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.client.GuiGuide;
-import darkknight.jewelrycraft.item.ItemList;
public class GuiTabModifiers extends GuiTab
-{
+{
+
+ /**
+ * @param id
+ */
public GuiTabModifiers(int id)
{
super("Modifiers", id);
}
+ /**
+ * @return
+ */
+ @Override
public ItemStack getIcon()
{
return new ItemStack(Items.blaze_powder);
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
@Override
public void drawBackground(GuiGuide gui, int x, int y, int page)
{
String text = "";
- int xPos = (page % 2 == 0) ? 107 : -35;
- switch (page)
+ int xPos = page % 2 == 0 ? 107 : -35;
+ switch(page)
{
case 1:
- text = "This is a test to see if the program works or not! And it does seem to be working. Yaaay! Thank God I made this. This is so much easier :D";
+ text = "Although you can add anything as a modifier, only some objects have an effect. In this tab you can find all of modifiers that have a use and what they do, in the form of a story/riddle/poem. However different jewellery have different effects for the same modifier.";
+ Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
+ break;
+ case 2:
+ text = "The ancient ones talked about a rising fire in your heart. Fret do not, for flames do not burn, but water might sting a turn. Watch your step, do not be cocky, for its protection is a bit sloppy.";
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(Items.blaze_powder), text, 40f);
break;
- default:;
+ default:
+ ;
}
}
+ /**
+ * @return
+ */
+ @Override
public int getMaxPages()
{
return 1;
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param page
+ */
@Override
public void drawForeground(GuiGuide gui, int x, int y, int page)
- {
- }
-
+ {}
}
diff --git a/java/darkknight/jewelrycraft/container/JewelryInventory.java b/java/darkknight/jewelrycraft/container/JewelryInventory.java
index 05accfa..ce6f0b5 100644
--- a/java/darkknight/jewelrycraft/container/JewelryInventory.java
+++ b/java/darkknight/jewelrycraft/container/JewelryInventory.java
@@ -4,47 +4,67 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
+import darkknight.jewelrycraft.item.ItemBracelet;
+import darkknight.jewelrycraft.item.ItemEarrings;
+import darkknight.jewelrycraft.item.ItemNecklace;
+import darkknight.jewelrycraft.item.ItemRing;
+import darkknight.jewelrycraft.util.PlayerUtils;
public class JewelryInventory implements IInventory
{
- public ItemStack[] inventory = new ItemStack[18];
- public JewelryInventory()
+ public EntityPlayer player;
+ public ItemStack[] inventory = new ItemStack[18];
+
+ /**
+ * @param player
+ */
+ public JewelryInventory(EntityPlayer player)
{
+ this.player = player;
+ NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ for(int i = 0; i < 18; i++)
+ inventory[i] = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("ext" + i));
}
+ /**
+ * @return
+ */
@Override
public int getSizeInventory()
{
return inventory.length;
}
+ /**
+ * @param slot
+ * @return
+ */
@Override
public ItemStack getStackInSlot(int slot)
{
return inventory[slot];
}
+ /**
+ * @param slot
+ * @param amount
+ * @return
+ */
@Override
public ItemStack decrStackSize(int slot, int amount)
{
ItemStack stack = getStackInSlot(slot);
- if (stack != null)
- {
- if (stack.stackSize > amount)
- {
- stack = stack.splitStack(amount);
- markDirty();
- }
- else
- {
- setInventorySlotContents(slot, null);
- }
- }
-
+ if (stack != null) if (stack.stackSize > amount){
+ stack = stack.splitStack(amount);
+ markDirty();
+ }else setInventorySlotContents(slot, null);
return stack;
}
+ /**
+ * @param slot
+ * @return
+ */
@Override
public ItemStack getStackInSlotOnClosing(int slot)
{
@@ -53,66 +73,93 @@ public class JewelryInventory implements IInventory
return stack;
}
+ /**
+ * @param slot
+ * @param stack
+ */
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
inventory[slot] = stack;
- if (stack != null && stack.stackSize > getInventoryStackLimit())
- {
- stack.stackSize = getInventoryStackLimit();
- }
+ if (stack != null && stack.stackSize > getInventoryStackLimit()) stack.stackSize = getInventoryStackLimit();
markDirty();
}
+ /**
+ * @return
+ */
@Override
public String getInventoryName()
{
return "Jewelry";
}
+ /**
+ * @return
+ */
@Override
public boolean hasCustomInventoryName()
{
return false;
}
+ /**
+ * @return
+ */
@Override
public int getInventoryStackLimit()
{
return 1;
}
+ /**
+ *
+ */
@Override
public void markDirty()
{
- for (int i = 0; i < getSizeInventory(); ++i)
- {
- if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0)
- {
- inventory[i] = null;
- }
- }
+ NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ for(int i = 0; i < 18; i++)
+ if (inventory[i] != null) nbt.setTag("ext" + i, inventory[i].writeToNBT(nbt.getCompoundTag("ext" + i)));
+ else nbt.removeTag("ext" + i);
}
+ /**
+ * @param player
+ * @return
+ */
@Override
public boolean isUseableByPlayer(EntityPlayer player)
{
return true;
}
+ /**
+ *
+ */
@Override
public void openInventory()
- {
- }
+ {}
+ /**
+ *
+ */
@Override
public void closeInventory()
- {
- }
+ {}
+ /**
+ * @param slot
+ * @param stack
+ * @return
+ */
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
- return true;
+ if (slot >= 0 && slot <= 9 && stack.getItem() instanceof ItemRing) return true;
+ else if (slot >= 10 && slot <= 13 && stack.getItem() instanceof ItemBracelet) return true;
+ else if (slot >= 14 && slot <= 16 && stack.getItem() instanceof ItemNecklace) return true;
+ else if (slot == 17 && stack.getItem() instanceof ItemEarrings) return true;
+ return false;
}
} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/container/Page.java b/java/darkknight/jewelrycraft/container/Page.java
index 69de204..bca21a8 100644
--- a/java/darkknight/jewelrycraft/container/Page.java
+++ b/java/darkknight/jewelrycraft/container/Page.java
@@ -1,174 +1,106 @@
package darkknight.jewelrycraft.container;
import java.util.ArrayList;
-import java.util.List;
-
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
-
import org.lwjgl.opengl.GL11;
-
import darkknight.jewelrycraft.client.GuiGuide;
public class Page
{
- public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, String text, ArrayList<ItemStack> items, int mouseX, int mouseY)
+ static ResourceLocation pageFlipped = new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png");
+
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param isSmall
+ * @param text
+ * @param mouseX
+ * @param mouseY
+ * @param items
+ */
+ public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, String text, int mouseX, int mouseY, ItemStack ... items)
{
y += 5;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items.get(0).getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items.get(0).getDisplayName()) / 2) - 10, y - 2, 0);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items[0].getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items[0].getDisplayName()) / 2) - 10, y - 2, 0);
GL11.glColor4f(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png"));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
ArrayList<String> name = new ArrayList<String>();
- if (isSmall)
- {
+ if (isSmall){
gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, 46);
- gui.renderItem(items.get(0), x + 89, y + 22 + 10, 30f);
- // gui.drawRect(x, y + 10, x + 111, y + 46, 325325);
- if (items.size() > 1 && items.get(1) != null)
- {
- gui.renderItem(items.get(1), x + 8, y + 16 + 10, 30f);
- List<String> list = new ArrayList<String>();
- list.add(text);
- if (x - gui.getLeft() >= x + 8) gui.drawHoverString(list, x, y);
- name.add(items.get(1).getDisplayName());
- if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x - 8, y + 10);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 2 && items.get(2) != null)
- {
- gui.renderItem(items.get(2), x + 30, y + 16 + 10, 30f);
- name.add(items.get(2).getDisplayName());
- if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 15, y + 10);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 3 && items.get(3) != null)
- {
- gui.renderItem(items.get(3), x + 8, y + 40 + 10, 30f);
- name.add(items.get(3).getDisplayName());
- if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x - 8, y + 35);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 4 && items.get(4) != null)
- {
- gui.renderItem(items.get(4), x + 30, y + 40 + 10, 30f);
- name.add(items.get(4).getDisplayName());
- if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x + 15, y + 35);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
+ gui.renderItem(items[0], x + 89, y + 22 + 10, 30f);
+ for(int i = 1; i <= 4; i++)
+ if (items.length > i && items[i] != null){
+ int posX = x + 8 + (i - 1) % 2 * 22;
+ int posY = y + 26 + (i - 1) / 2 * 22;
+ gui.renderItem(items[i], posX, posY, 30f);
+ name.add(items[i].getDisplayName());
+ if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 16 && mouseY <= posY) gui.drawHoverString(name, posX - 20, posY - 14);
+ name.removeAll(name);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ }
drawText(gui, text, x, y + 25);
- }
- else
- {
+ }else{
gui.drawTexturedModalRect(x, y + 12, 145, 0, 111, 54);
- gui.renderItem(items.get(0), x + 91, y + 28 + 10, 30f);
- if (items.size() > 1 && items.get(1) != null)
- {
- gui.renderItem(items.get(1), x + 8, y + 20, 30f);
- name.add(items.get(1).getDisplayName());
- if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 8, y + 10);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 2 && items.get(2) != null)
- {
- gui.renderItem(items.get(2), x + 28, y + 20, 30f);
- name.add(items.get(2).getDisplayName());
- if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 28, y + 10);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 3 && items.get(3) != null)
- {
- gui.renderItem(items.get(3), x + 45, y + 20, 30f);
- name.add(items.get(3).getDisplayName());
- if (mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 45, y + 10);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 4 && items.get(4) != null)
- {
- gui.renderItem(items.get(4), x + 8, y + 37, 30f);
- name.add(items.get(4).getDisplayName());
- if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 8, y + 27);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 5 && items.get(5) != null)
- {
- gui.renderItem(items.get(5), x + 28, y + 37, 30f);
- name.add(items.get(5).getDisplayName());
- if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 28, y + 27);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 6 && items.get(6) != null)
- {
- gui.renderItem(items.get(6), x + 45, y + 37, 30f);
- name.add(items.get(6).getDisplayName());
- if (mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 45, y + 27);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 7 && items.get(7) != null)
- {
- gui.renderItem(items.get(7), x + 8, y + 54, 30f);
- name.add(items.get(7).getDisplayName());
- if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 44 && mouseY <= y + 44 + 16) gui.drawHoverString(name, x + 8, y + 44);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 8 && items.get(8) != null)
- {
- gui.renderItem(items.get(8), x + 28, y + 54, 30f);
- name.add(items.get(8).getDisplayName());
- if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 44 && mouseY <= y + 44 + 16) gui.drawHoverString(name, x + 28, y + 44);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- if (items.size() > 9 && items.get(9) != null)
- {
- gui.renderItem(items.get(9), x + 45, y + 54, 30f);
- name.add(items.get(9).getDisplayName());
- if (mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 44 && mouseY <= y + 44 + 16) gui.drawHoverString(name, x + 45, y + 44);
- name.removeAll(name);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
+ gui.renderItem(items[0], x + 91, y + 28 + 10, 30f);
+ for(int i = 1; i <= 9; i++)
+ if (items.length > i && items[i] != null){
+ int posX = x + 8 + (i - 1) % 3 * 19;
+ int posY = y + 22 + (i - 1) / 3 * 17;
+ gui.renderItem(items[i], posX, posY, 30f);
+ name.add(items[i].getDisplayName());
+ if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 10 && mouseY <= posY) gui.drawHoverString(name, posX - 20, posY - 12);
+ name.removeAll(name);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ }
drawText(gui, text, x, y + 32);
GL11.glColor4f(1, 1, 1, 1);
}
GL11.glDisable(GL11.GL_BLEND);
}
- public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, String text, ArrayList<ItemStack> items, int mouseX, int mouseY)
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param text
+ * @param mouseX
+ * @param mouseY
+ * @param items
+ */
+ public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, String text, int mouseX, int mouseY, ItemStack ... items)
{
ArrayList<String> name = new ArrayList<String>();
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items.get(1).getDisplayName(), x + 30 - items.get(0).getDisplayName().length() / 2, y + 2, 0);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items[1].getDisplayName(), x + 30 - items[0].getDisplayName().length() / 2, y + 2, 0);
GL11.glColor4f(1, 1, 1, 1);
- Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip" + ".png"));
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 56);
-
- gui.renderItem(items.get(0), x + 13, y + 20 + 10, 35f);
- name.add(items.get(0).getDisplayName());
+ gui.renderItem(items[0], x + 13, y + 20 + 10, 35f);
+ name.add(items[0].getDisplayName());
if (mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 20 + 16) gui.drawHoverString(name, x, y + 20);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
-
- gui.renderItem(items.get(1), x + 77, y + 28 + 10, 35f);
+ gui.renderItem(items[1], x + 77, y + 28 + 10, 35f);
drawText(gui, text, x, y + 30);
GL11.glColor4f(1, 1, 1, 1);
GL11.glDisable(GL11.GL_BLEND);
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param item
+ * @param text
+ * @param size
+ */
public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size)
{
y += 5;
@@ -177,10 +109,23 @@ public class Page
gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + 2, 0);
GL11.glColor4f(1, 1, 1, 1);
gui.renderItem(item, x + 13, y + 18, size);
- drawText(gui, text, x, y);
+ drawText(gui, text, x, y - (int)(200 / size));
GL11.glDisable(GL11.GL_BLEND);
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param item
+ * @param text
+ * @param size
+ * @param txtX
+ * @param txtY
+ * @param showName
+ * @param imgX
+ * @param imgY
+ */
public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, int txtX, int txtY, boolean showName, int imgX, int imgY)
{
y += 5;
@@ -193,6 +138,12 @@ public class Page
GL11.glDisable(GL11.GL_BLEND);
}
+ /**
+ * @param gui
+ * @param x
+ * @param y
+ * @param text
+ */
public static void addTextPage(GuiGuide gui, int x, int y, String text)
{
y -= 25;
@@ -200,22 +151,25 @@ public class Page
GL11.glColor4f(1, 1, 1, 1);
}
+ /**
+ * @param gui
+ * @param text
+ * @param x
+ * @param y
+ */
public static void drawText(GuiGuide gui, String text, int x, int y)
{
String[] s = text.split(" ");
String displayText = "";
ArrayList<String> textLines = new ArrayList<String>();
- for (int i = 0; i < s.length; i++)
- {
- if ((displayText + s[i] + " ").length() <= 24) displayText += s[i] + " ";
- else
- {
+ for(String element: s)
+ if ((displayText + element + " ").length() <= 24) displayText += element + " ";
+ else{
textLines.add(displayText.trim());
- displayText = s[i] + " ";
+ displayText = element + " ";
}
- }
textLines.add(displayText.trim());
- for (int i = 0; i < textLines.size(); i++)
+ for(int i = 0; i < textLines.size(); i++)
gui.getFont().drawString(textLines.get(i), x, y + 30 + i * 12, 0);
}
}
diff --git a/java/darkknight/jewelrycraft/container/SlotBracelet.java b/java/darkknight/jewelrycraft/container/SlotBracelet.java
new file mode 100644
index 0000000..c82421d
--- /dev/null
+++ b/java/darkknight/jewelrycraft/container/SlotBracelet.java
@@ -0,0 +1,52 @@
+package darkknight.jewelrycraft.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.item.ItemBracelet;
+
+public class SlotBracelet extends Slot
+{
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotBracelet(IInventory tile, int slotID, int x, int y)
+ {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack)
+ {
+ return stack.getItem() instanceof ItemBracelet;
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount)
+ {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return true;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/container/SlotEarrings.java b/java/darkknight/jewelrycraft/container/SlotEarrings.java
new file mode 100644
index 0000000..550f4f9
--- /dev/null
+++ b/java/darkknight/jewelrycraft/container/SlotEarrings.java
@@ -0,0 +1,52 @@
+package darkknight.jewelrycraft.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.item.ItemEarrings;
+
+public class SlotEarrings extends Slot
+{
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotEarrings(IInventory tile, int slotID, int x, int y)
+ {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack)
+ {
+ return stack.getItem() instanceof ItemEarrings;
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount)
+ {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return true;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/container/SlotNecklace.java b/java/darkknight/jewelrycraft/container/SlotNecklace.java
new file mode 100644
index 0000000..42543b0
--- /dev/null
+++ b/java/darkknight/jewelrycraft/container/SlotNecklace.java
@@ -0,0 +1,52 @@
+package darkknight.jewelrycraft.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.item.ItemNecklace;
+
+public class SlotNecklace extends Slot
+{
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotNecklace(IInventory tile, int slotID, int x, int y)
+ {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack)
+ {
+ return stack.getItem() instanceof ItemNecklace;
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount)
+ {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return true;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/container/SlotRing.java b/java/darkknight/jewelrycraft/container/SlotRing.java
index 3207301..52aa4fb 100644
--- a/java/darkknight/jewelrycraft/container/SlotRing.java
+++ b/java/darkknight/jewelrycraft/container/SlotRing.java
@@ -8,23 +8,42 @@ import darkknight.jewelrycraft.item.ItemRing;
public class SlotRing extends Slot
{
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
public SlotRing(IInventory tile, int slotID, int x, int y)
{
super(tile, slotID, x, y);
}
+ /**
+ * @param stack
+ * @return
+ */
@Override
public boolean isItemValid(ItemStack stack)
{
return stack.getItem() instanceof ItemRing;
}
+ /**
+ * @param amount
+ * @return
+ */
@Override
public ItemStack decrStackSize(int amount)
{
return super.decrStackSize(amount);
}
+ /**
+ * @param player
+ * @return
+ */
@Override
public boolean canTakeStack(EntityPlayer player)
{
diff --git a/java/darkknight/jewelrycraft/container/SlotRingChest.java b/java/darkknight/jewelrycraft/container/SlotRingChest.java
index fe4cdd0..b1f553c 100644
--- a/java/darkknight/jewelrycraft/container/SlotRingChest.java
+++ b/java/darkknight/jewelrycraft/container/SlotRingChest.java
@@ -9,25 +9,44 @@ public class SlotRingChest extends Slot
{
public boolean locked = false;
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ * @param locked
+ */
public SlotRingChest(IInventory tile, int slotID, int x, int y, boolean locked)
{
super(tile, slotID, x, y);
this.locked = locked;
}
+ /**
+ * @param stack
+ * @return
+ */
@Override
public boolean isItemValid(ItemStack stack)
{
return !locked;
}
+ /**
+ * @param amount
+ * @return
+ */
@Override
public ItemStack decrStackSize(int amount)
{
- if (!locked) { return super.decrStackSize(amount); }
+ if (!locked) return super.decrStackSize(amount);
return null;
}
+ /**
+ * @param player
+ * @return
+ */
@Override
public boolean canTakeStack(EntityPlayer player)
{
diff --git a/java/darkknight/jewelrycraft/curses/Curse.java b/java/darkknight/jewelrycraft/curses/Curse.java
new file mode 100644
index 0000000..08421ef
--- /dev/null
+++ b/java/darkknight/jewelrycraft/curses/Curse.java
@@ -0,0 +1,85 @@
+package darkknight.jewelrycraft.curses;
+
+import java.util.ArrayList;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public class Curse
+{
+ protected int id, texturepack;
+ protected String name, description;
+ private static ArrayList<Curse> curses = new ArrayList<Curse>();
+ public static ArrayList<Curse> availableCurses = new ArrayList<Curse>();
+
+ /**
+ * @param id the ID of the curse
+ * @param name the name of the curse
+ * @param texturepack the ID of the pack the texture is located in
+ */
+ protected Curse(int id, String name, int texturepack)
+ {
+ this.id = id;
+ this.name = name;
+ this.texturepack = texturepack;
+ curses.add(this);
+ availableCurses.add(this);
+ }
+
+ /**
+ * @return the name of the curse
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @return the description of the curse
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public Curse setDescription(String desc)
+ {
+ description = desc;
+ return this;
+ }
+
+ /**
+ * @return the curse ID
+ */
+ public int getID()
+ {
+ return id;
+ }
+
+ /**
+ * @return the texture pack ID
+ */
+ public int getTexturePack()
+ {
+ return texturepack;
+ }
+
+ /**
+ * @param world
+ * @param player
+ */
+ public void action(World world, EntityPlayer player)
+ {}
+
+ public boolean itemToss()
+ {
+ return false;
+ }
+
+ /**
+ * @return
+ */
+ public static ArrayList<Curse> getCurseList()
+ {
+ return curses;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/curses/CurseBlind.java b/java/darkknight/jewelrycraft/curses/CurseBlind.java
new file mode 100644
index 0000000..62483cd
--- /dev/null
+++ b/java/darkknight/jewelrycraft/curses/CurseBlind.java
@@ -0,0 +1,25 @@
+package darkknight.jewelrycraft.curses;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+public class CurseBlind extends Curse
+{
+ public CurseBlind(int id, String name, int text)
+ {
+ super(id, name, text);
+ }
+
+ @Override
+ public void action(World world, EntityPlayer player)
+ {
+ if (!player.isPotionActive(Potion.blindness) || player.getActivePotionEffect(Potion.blindness).getDuration() < 30) player.addPotionEffect(new PotionEffect(Potion.blindness.id, 60));
+ }
+
+ public String getDescription()
+ {
+ return "You see the light slowly fading in front of you";
+ }
+}
diff --git a/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java b/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java
new file mode 100644
index 0000000..7c1104c
--- /dev/null
+++ b/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java
@@ -0,0 +1,23 @@
+package darkknight.jewelrycraft.curses;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+public class CurseFlamingSoul extends Curse
+{
+ public CurseFlamingSoul(int id, String name, int text)
+ {
+ super(id, name, text);
+ }
+
+ @Override
+ public void action(World world, EntityPlayer player)
+ {
+ if (!player.isBurning()) player.setFire(60);
+ }
+
+ public String getDescription()
+ {
+ return "Is it me or is it getting hot in here?";
+ }
+}
diff --git a/java/darkknight/jewelrycraft/curses/CurseGreed.java b/java/darkknight/jewelrycraft/curses/CurseGreed.java
new file mode 100644
index 0000000..1626925
--- /dev/null
+++ b/java/darkknight/jewelrycraft/curses/CurseGreed.java
@@ -0,0 +1,30 @@
+package darkknight.jewelrycraft.curses;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+public class CurseGreed extends Curse
+{
+ public CurseGreed(int id, String name, int text)
+ {
+ super(id, name, text);
+ }
+
+ @Override
+ public void action(World world, EntityPlayer player)
+ {
+ }
+
+ @Override
+ public boolean itemToss()
+ {
+ return true;
+ }
+
+ public String getDescription()
+ {
+ return "You might need that later";
+ }
+}
diff --git a/java/darkknight/jewelrycraft/curses/CurseList.java b/java/darkknight/jewelrycraft/curses/CurseList.java
new file mode 100644
index 0000000..4a46232
--- /dev/null
+++ b/java/darkknight/jewelrycraft/curses/CurseList.java
@@ -0,0 +1,24 @@
+package darkknight.jewelrycraft.curses;
+
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import darkknight.jewelrycraft.lib.Reference;
+
+public class CurseList
+{
+ private static Curse rotten, flaming, blind, greed;
+ private static boolean isInitialized = false;
+
+ /**
+ * @param e
+ */
+ public static void preInit(FMLPreInitializationEvent e)
+ {
+ if (!isInitialized){
+ rotten = new CurseRottenHeart(0, Reference.MODNAME + ":" + "Rotten Heart", 0);
+ flaming = new CurseFlamingSoul(1, Reference.MODNAME + ":" + "Flaming Soul", 0);
+ greed = new CurseGreed(2, Reference.MODNAME + ":" + "Greed", 0);
+ blind = new CurseBlind(3, Reference.MODNAME + ":" + "Blind", 0);
+ isInitialized = true;
+ }
+ }
+}
diff --git a/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java b/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java
new file mode 100644
index 0000000..f7fcfae
--- /dev/null
+++ b/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java
@@ -0,0 +1,25 @@
+package darkknight.jewelrycraft.curses;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+public class CurseRottenHeart extends Curse
+{
+ public CurseRottenHeart(int id, String name, int text)
+ {
+ super(id, name, text);
+ }
+
+ @Override
+ public void action(World world, EntityPlayer player)
+ {
+ if (!player.isPotionActive(Potion.poison) || player.getActivePotionEffect(Potion.poison).getDuration() < 30) player.addPotionEffect(new PotionEffect(Potion.poison.id, 80));
+ }
+
+ public String getDescription()
+ {
+ return "Your heart slowly rots inside";
+ }
+}
diff --git a/java/darkknight/jewelrycraft/damage/DamageSourceList.java b/java/darkknight/jewelrycraft/damage/DamageSourceList.java
new file mode 100644
index 0000000..915ec9e
--- /dev/null
+++ b/java/darkknight/jewelrycraft/damage/DamageSourceList.java
@@ -0,0 +1,27 @@
+package darkknight.jewelrycraft.damage;
+
+import net.minecraft.util.DamageSource;
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+
+/**
+ * @author Sorin
+ */
+public class DamageSourceList
+{
+ public static DamageSource shadows, weak, blackHeart, basic;
+ private static boolean isInitialized = false;
+
+ /**
+ * @param e
+ */
+ public static void postInit(FMLPostInitializationEvent e)
+ {
+ if (!isInitialized){
+ shadows = new DamageSource("shadows").setDamageBypassesArmor().setDamageIsAbsolute();
+ blackHeart = new DamageSource("blackHeart").setDamageBypassesArmor().setDamageIsAbsolute();
+ weak = new DamageSource("weak");
+ basic = new DamageSource("basic").setDifficultyScaled();
+ isInitialized = true;
+ }
+ }
+}
diff --git a/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java b/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
new file mode 100644
index 0000000..efec29b
--- /dev/null
+++ b/java/darkknight/jewelrycraft/effects/EffectBlazePowder.java
@@ -0,0 +1,86 @@
+package darkknight.jewelrycraft.effects;
+
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.DamageSource;
+import darkknight.jewelrycraft.item.ItemBracelet;
+import darkknight.jewelrycraft.item.ItemEarrings;
+import darkknight.jewelrycraft.item.ItemNecklace;
+import darkknight.jewelrycraft.item.ItemRing;
+import darkknight.jewelrycraft.util.JewelryNBT;
+
+public class EffectBlazePowder extends ModifierEffects
+{
+ public EffectBlazePowder()
+ {
+ super(new ItemStack(Items.blaze_powder));
+ }
+
+ @Override
+ public void action(ItemStack item, EntityPlayer player, Item jewelry)
+ {
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ if (jewelry instanceof ItemNecklace && pos != -1){
+ //Positive for necklace
+ player.extinguish();
+
+ //Negative for necklace
+ if (player.isInWater()) player.attackEntityFrom(DamageSource.drown, 1f);
+ }
+ //Negative for bracelet
+ if (jewelry instanceof ItemBracelet && pos != -1) if(player.isInWater()) player.fallDistance *= 0.8F;
+
+ //Negative for earrings
+ if (jewelry instanceof ItemEarrings && pos != -1){
+ if (player.getAir() >= 300) player.setAir(player.getAir() / 2);
+ else player.setAir(player.getAir() - 1);
+
+ }
+
+ }
+
+ @Override
+ public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
+ {
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ //Balanced for ring
+ if (jewelry instanceof ItemRing && pos != -1 && !player.isInWater()) target.setFire(2);
+ return false;
+ }
+
+ @Override
+ public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
+ {
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ if (jewelry instanceof ItemEarrings && pos != -1 && player.worldObj.rand.nextInt(4) == 0) if (source == DamageSource.lava || source == DamageSource.inFire || source == DamageSource.onFire){
+ //Positive for earrings
+ int stackSize = JewelryNBT.modifier(item).get(pos).stackSize;
+ player.heal((float)(0.05 * stackSize));
+ return true;
+ }
+ //Positive for bracelet
+ if (jewelry instanceof ItemBracelet && pos != -1) if (source == DamageSource.inFire || source == DamageSource.onFire || source == DamageSource.lava && player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY - 0.7, player.boundingBox.maxZ), Material.lava) && !player.worldObj.isMaterialInBB(AxisAlignedBB.getBoundingBox(player.boundingBox.minX, player.boundingBox.minY + 0.9, player.boundingBox.minZ, player.boundingBox.maxX, player.boundingBox.maxY, player.boundingBox.maxZ), Material.lava)) return true;
+ return false;
+ }
+
+ @Override
+ public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
+ {
+ }
+
+ @Override
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
+ {
+ }
+
+ @Override
+ public boolean onPlayerFall(ItemStack item, EntityPlayer player, Item jewelry)
+ {
+ return false;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/effects/EffectEnderEye.java b/java/darkknight/jewelrycraft/effects/EffectEnderEye.java
new file mode 100644
index 0000000..886b18d
--- /dev/null
+++ b/java/darkknight/jewelrycraft/effects/EffectEnderEye.java
@@ -0,0 +1,53 @@
+package darkknight.jewelrycraft.effects;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+import darkknight.jewelrycraft.item.ItemNecklace;
+import darkknight.jewelrycraft.util.JewelryNBT;
+
+public class EffectEnderEye extends ModifierEffects
+{
+ public EffectEnderEye()
+ {
+ super(new ItemStack(Items.ender_eye));
+ }
+
+ @Override
+ public void action(ItemStack item, EntityPlayer player, Item jewelry)
+ {
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ if (jewelry instanceof ItemNecklace && pos != -1) ;
+ }
+
+ @Override
+ public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
+ {
+ return false;
+ }
+
+ @Override
+ public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
+ {
+ return false;
+ }
+
+ @Override
+ public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
+ {
+ }
+
+ @Override
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
+ {
+ }
+
+ @Override
+ public boolean onPlayerFall(ItemStack item, EntityPlayer player, Item jewelry)
+ {
+ return false;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/effects/EffectFeather.java b/java/darkknight/jewelrycraft/effects/EffectFeather.java
new file mode 100644
index 0000000..b331044
--- /dev/null
+++ b/java/darkknight/jewelrycraft/effects/EffectFeather.java
@@ -0,0 +1,69 @@
+package darkknight.jewelrycraft.effects;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+import darkknight.jewelrycraft.damage.DamageSourceList;
+import darkknight.jewelrycraft.item.ItemBracelet;
+import darkknight.jewelrycraft.item.ItemEarrings;
+import darkknight.jewelrycraft.item.ItemNecklace;
+import darkknight.jewelrycraft.util.JewelryNBT;
+
+public class EffectFeather extends ModifierEffects
+{
+ public EffectFeather()
+ {
+ super(new ItemStack(Items.feather));
+ }
+
+ @Override
+ public void action(ItemStack item, EntityPlayer player, Item jewelry)
+ {
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ // Positive necklace
+ if (jewelry instanceof ItemNecklace && pos != -1 && !player.onGround){
+ player.motionY = -10D;
+ System.out.println(player.motionY);
+ }
+ }
+
+ @Override
+ public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
+ {
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ // if (jewelry instanceof ItemNecklace && pos != -1) player.fallDistance *= 0.5F;
+ if (jewelry instanceof ItemBracelet && pos != -1) return true;
+ return false;
+ }
+
+ @Override
+ public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
+ {
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ // Positive bracelet
+ if (jewelry instanceof ItemBracelet && pos != -1) return true;
+ return true;
+ }
+
+ @Override
+ public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount)
+ {}
+
+ @Override
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount)
+ {
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ // Negative necklace
+ if (jewelry instanceof ItemNecklace && pos != -1 && source != DamageSourceList.weak) player.attackEntityFrom(DamageSourceList.weak, amount * 2F);
+ }
+
+ @Override
+ public boolean onPlayerFall(ItemStack item, EntityPlayer player, Item jewelry)
+ {
+ int pos = JewelryNBT.doesModifierExist(item, modifier);
+ return false;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/effects/EffectsList.java b/java/darkknight/jewelrycraft/effects/EffectsList.java
new file mode 100644
index 0000000..13abc48
--- /dev/null
+++ b/java/darkknight/jewelrycraft/effects/EffectsList.java
@@ -0,0 +1,22 @@
+package darkknight.jewelrycraft.effects;
+
+import cpw.mods.fml.common.event.FMLPostInitializationEvent;
+
+public class EffectsList
+{
+ private static ModifierEffects blazePowder, enderEye, feather;
+ private static boolean isInitialized = false;
+
+ /**
+ * @param e
+ */
+ public static void postInit(FMLPostInitializationEvent e)
+ {
+ if (!isInitialized){
+ blazePowder = new EffectBlazePowder();
+ enderEye = new EffectEnderEye();
+ feather = new EffectFeather();
+ isInitialized = true;
+ }
+ }
+}
diff --git a/java/darkknight/jewelrycraft/effects/ModifierEffects.java b/java/darkknight/jewelrycraft/effects/ModifierEffects.java
new file mode 100644
index 0000000..2d62639
--- /dev/null
+++ b/java/darkknight/jewelrycraft/effects/ModifierEffects.java
@@ -0,0 +1,82 @@
+package darkknight.jewelrycraft.effects;
+
+import java.util.ArrayList;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+
+public abstract class ModifierEffects
+{
+ protected ItemStack modifier;
+ protected static ArrayList<ModifierEffects> effects = new ArrayList<ModifierEffects>();
+
+ /**
+ * @param modifier
+ */
+ public ModifierEffects(ItemStack modifier)
+ {
+ this.modifier = modifier;
+ effects.add(this);
+ }
+
+ /**
+ * @return
+ */
+ public static ArrayList<ModifierEffects> getEffects()
+ {
+ return effects;
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param jewelry
+ */
+ public abstract void action(ItemStack item, EntityPlayer player, Item jewelry);
+
+ /**
+ * @param item
+ * @param player
+ * @param target
+ * @param jewelry
+ * @return
+ */
+ public abstract boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount);
+
+ /**
+ * @param item
+ * @param player
+ * @param source
+ * @param jewelry
+ * @return
+ */
+ public abstract boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount);
+ /**
+ * @param item
+ * @param player
+ * @param target
+ * @param jewelry
+ * @return
+ */
+ public abstract void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, Item jewelry, float amount);
+
+ /**
+ * @param item
+ * @param player
+ * @param source
+ * @param jewelry
+ * @return
+ */
+ public abstract void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, Item jewelry, float amount);
+
+ /**
+ * @param item
+ * @param player
+ * @param source
+ * @param jewelry
+ * @return
+ */
+ public abstract boolean onPlayerFall(ItemStack item, EntityPlayer player, Item jewelry);
+}
diff --git a/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java b/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java
new file mode 100644
index 0000000..4fc1e39
--- /dev/null
+++ b/java/darkknight/jewelrycraft/entities/EntityHalfHeart.java
@@ -0,0 +1,45 @@
+/**
+ *
+ */
+package darkknight.jewelrycraft.entities;
+
+import net.minecraft.entity.SharedMonsterAttributes;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
+import darkknight.jewelrycraft.util.PlayerUtils;
+
+/**
+ * @author Sorin
+ */
+public class EntityHalfHeart extends EntityHeart
+{
+ public EntityHalfHeart(World world)
+ {
+ super(world);
+ }
+
+ @Override
+ public void onCollideWithPlayer(EntityPlayer player)
+ {
+ if (!player.worldObj.isRemote){
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (getType().equals("Red") && player.getHealth() < player.getMaxHealth()){
+ player.heal(1f);
+ this.setDead();
+ }else if (getType().equals("White") && playerInfo.getFloat("WhiteHeart") > 0.1F){
+ playerInfo.setFloat(getType() + "Heart", 0F);
+ player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + 2f);
+ this.setDead();
+ }else if (!getType().equals("Red") && playerInfo.getFloat(getType() + "Heart") < 20f){
+ playerInfo.setFloat(getType() + "Heart", playerInfo.getFloat(getType() + "Heart") + 1.0F <= 20f ? playerInfo.getFloat(getType() + "Heart") + 1.0F : 20f);
+ this.setDead();
+ }
+ }
+ else JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ }
+}
diff --git a/java/darkknight/jewelrycraft/entities/EntityHeart.java b/java/darkknight/jewelrycraft/entities/EntityHeart.java
new file mode 100644
index 0000000..ebd64e7
--- /dev/null
+++ b/java/darkknight/jewelrycraft/entities/EntityHeart.java
@@ -0,0 +1,107 @@
+/**
+ *
+ */
+package darkknight.jewelrycraft.entities;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
+import darkknight.jewelrycraft.util.PlayerUtils;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.EnumCreatureAttribute;
+import net.minecraft.entity.SharedMonsterAttributes;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.potion.Potion;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+
+/**
+ * @author Sorin
+ */
+public class EntityHeart extends EntityLiving
+{
+ public EntityHeart(World world)
+ {
+ super(world);
+ this.setSize(0.4F, 0.4F);
+ }
+
+ public boolean isEntityInvulnerable()
+ {
+ return true;
+ }
+
+ protected boolean canDespawn()
+ {
+ return false;
+ }
+
+ @Override
+ public void onCollideWithPlayer(EntityPlayer player)
+ {
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (getType() == "Red" && player.getHealth() < player.getMaxHealth()){
+ player.heal(2f);
+ this.setDead();
+ }
+ else if (getType() != "Red" && playerInfo.getFloat(getType() + "Heart") < 20f){
+ playerInfo.setFloat(getType() + "Heart", playerInfo.getFloat(getType() + "Heart") + 2.0F <= 20f ? playerInfo.getFloat(getType() + "Heart") + 2.0F : 20f);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ this.setDead();
+ }
+ }
+
+ @Override
+ protected void updateEntityActionState()
+ {
+ }
+
+ @SideOnly(Side.CLIENT)
+ public boolean canRenderOnFire()
+ {
+ return false;
+ }
+
+ protected void entityInit()
+ {
+ super.entityInit();
+ this.dataWatcher.addObject(16, "Red");
+ }
+
+ public void writeEntityToNBT(NBTTagCompound nbt)
+ {
+ super.writeEntityToNBT(nbt);
+ nbt.setString("Type", getType());
+ }
+
+ /**
+ * (abstract) Protected helper method to read subclass entity data from NBT.
+ */
+ public void readEntityFromNBT(NBTTagCompound nbt)
+ {
+ super.readEntityFromNBT(nbt);
+ setType(nbt.getString("Type"));
+ }
+
+ public String getType()
+ {
+ return this.dataWatcher.getWatchableObjectString(16);
+ }
+
+ public void setType(String type)
+ {
+ this.dataWatcher.updateObject(16, type);
+ }
+
+ public EnumCreatureAttribute getCreatureAttribute()
+ {
+ return EnumCreatureAttribute.UNDEAD;
+ }
+
+}
diff --git a/java/darkknight/jewelrycraft/entities/renders/HeartRender.java b/java/darkknight/jewelrycraft/entities/renders/HeartRender.java
new file mode 100644
index 0000000..6005bb3
--- /dev/null
+++ b/java/darkknight/jewelrycraft/entities/renders/HeartRender.java
@@ -0,0 +1,44 @@
+package darkknight.jewelrycraft.entities.renders;
+
+import org.lwjgl.opengl.GL11;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.renderer.entity.RenderLiving;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.util.ResourceLocation;
+import darkknight.jewelrycraft.entities.EntityHeart;
+
+/**
+ * @author Sorin
+ */
+public class HeartRender extends RenderLiving
+{
+ protected ResourceLocation texture;
+
+ public HeartRender(ModelBase modelBase, float shadowSize)
+ {
+ super(modelBase, shadowSize);
+// texture = new ResourceLocation("jewelrycraft", "textures/entities/RedHeart.png");
+ }
+
+ @Override
+ protected void preRenderCallback(EntityLivingBase entity, float f)
+ {
+ preRenderCallbackHeart((EntityHeart) entity, f);
+ }
+
+ protected void preRenderCallbackHeart(EntityHeart entity, float f)
+ {
+ GL11.glScalef(0.4F, 0.4F, 0.4F);
+ GL11.glRotatef(55F, 1F, 0F, 0F);
+ String type = entity.getType();
+ if(type == "" || type == null) type = "Red";
+ texture = new ResourceLocation("jewelrycraft", "textures/entities/"+type+"Heart.png");
+ }
+
+ @Override
+ protected ResourceLocation getEntityTexture(Entity par1Entity)
+ {
+ return texture;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/events/BucketHandler.java b/java/darkknight/jewelrycraft/events/BucketHandler.java
index a7b40cd..871f26e 100644
--- a/java/darkknight/jewelrycraft/events/BucketHandler.java
+++ b/java/darkknight/jewelrycraft/events/BucketHandler.java
@@ -9,9 +9,7 @@ package darkknight.jewelrycraft.events;
import java.util.HashMap;
import java.util.Map;
-
import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -26,54 +24,56 @@ import darkknight.jewelrycraft.util.JewelryNBT;
public class BucketHandler
{
-
public static BucketHandler INSTANCE = new BucketHandler();
public Map<Block, Item> buckets = new HashMap<Block, Item>();
+ /**
+ *
+ */
private BucketHandler()
- {
- }
+ {}
+ /**
+ * @param event
+ */
@SubscribeEvent
public void onBucketFill(FillBucketEvent event)
- {
- ItemStack result = fillCustomBucket(event.world, event.target);
- if (result == null) return;
+ {
+ ItemStack result = fillCustomBucket(event.world, event.target);
+ if (result == null) return;
event.result = result;
event.setResult(Result.ALLOW);
}
+ /**
+ * @param world
+ * @param pos
+ * @return
+ */
private ItemStack fillCustomBucket(World world, MovingObjectPosition pos)
- {
+ {
Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
Item bucket = buckets.get(block);
-
- if (bucket != null && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) != Blocks.air && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) instanceof BlockMoltenMetal)
- {
+ if (bucket != null && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) != Blocks.air && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) instanceof BlockMoltenMetal){
world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
ItemStack item = new ItemStack(bucket);
String ingotData = JewelrycraftMod.saveData.getString(pos.blockX + " " + pos.blockY + " " + pos.blockZ + " " + world.provider.dimensionId);
- if (ingotData != null && ingotData != "")
- {
+ if (ingotData != null && ingotData != ""){
String[] splitData = ingotData.split(":");
- if (splitData.length == 3)
- {
- int itemID, itemDamage, color;
- try
- {
+ if (splitData.length == 3){
+ int itemID, itemDamage;
+ try{
itemID = Integer.parseInt(splitData[0]);
itemDamage = Integer.parseInt(splitData[1]);
- color = Integer.parseInt(splitData[2]);
+ Integer.parseInt(splitData[2]);
JewelryNBT.addMetal(item, new ItemStack(Item.getItemById(itemID), 1, itemDamage));
}
- catch (Exception e)
- {
+ catch(Exception e){
e.printStackTrace();
}
}
}
return item;
- }
- else return null;
+ }else return null;
}
} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/events/EntityEventHandler.java b/java/darkknight/jewelrycraft/events/EntityEventHandler.java
index 7229318..9231ada 100644
--- a/java/darkknight/jewelrycraft/events/EntityEventHandler.java
+++ b/java/darkknight/jewelrycraft/events/EntityEventHandler.java
@@ -5,27 +5,40 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
import net.minecraftforge.client.event.EntityViewRenderEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
+import net.minecraftforge.event.entity.item.ItemTossEvent;
+import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
+import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.event.world.WorldEvent;
-
import org.lwjgl.opengl.GL11;
-
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.curses.Curse;
+import darkknight.jewelrycraft.damage.DamageSourceList;
+import darkknight.jewelrycraft.entities.EntityHalfHeart;
+import darkknight.jewelrycraft.entities.EntityHeart;
+import darkknight.jewelrycraft.item.ItemBaseJewelry;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.network.PacketClearColorCache;
import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
@@ -36,185 +49,342 @@ import darkknight.jewelrycraft.util.PlayerUtils;
/**
* Code taken from OpenBlocks
*/
-
public class EntityEventHandler
{
-
+ /**
+ * @param event
+ */
@SubscribeEvent
public void onEntityJoinWorld(EntityJoinWorldEvent event)
{
- if (event.entity instanceof EntityPlayerMP) JewelrycraftMod.netWrapper.sendTo(new PacketClearColorCache(), (EntityPlayerMP) event.entity);
-
+ if (event.entity instanceof EntityPlayerMP) JewelrycraftMod.netWrapper.sendTo(new PacketClearColorCache(), (EntityPlayerMP)event.entity);
+ if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
final Entity entity = event.entity;
-
- if (!event.world.isRemote && entity instanceof EntityPlayer)
- {
- EntityPlayer player = (EntityPlayer) entity;
+ if (!event.world.isRemote && entity instanceof EntityPlayer){
+ EntityPlayer player = (EntityPlayer)entity;
NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
-
boolean shouldGiveManual = ItemList.guide != null && !persistTag.getBoolean("givenGuide");
- if (shouldGiveManual)
- {
+ if (shouldGiveManual){
ItemStack manual = new ItemStack(ItemList.guide);
if (!player.inventory.addItemStackToInventory(manual)) BlockUtils.dropItemStackInWorld(player.worldObj, player.posX, player.posY, player.posZ, manual);
persistTag.setBoolean("givenGuide", true);
}
-
boolean render = persistTag.getBoolean("fancyRender");
JewelrycraftMod.fancyRender = render;
+ for(Curse curse: Curse.getCurseList())
+ if (!persistTag.hasKey(curse.getName())) persistTag.setInteger(curse.getName(), 0);
}
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
+ /**
+ * @param event
+ */
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event)
{
- final Entity entity = event.entity;
- if (entity instanceof EntityPlayer)
- {
- EntityPlayer player = (EntityPlayer) entity;
+ Entity entity = event.entity;
+ if (entity instanceof EntityPlayer){
+ EntityPlayer player = (EntityPlayer)entity;
NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
playerInfo.setBoolean("fancyRender", JewelrycraftMod.fancyRender);
- if (!player.worldObj.isRemote)
- {
-// System.out.println(playerInfo.getInteger("curseTime") + " " + playerInfo.getBoolean("reselectCurses"));
- if (playerInfo.hasKey("reselectCurses") && !playerInfo.getBoolean("reselectCurses"))
- {
- playerInfo.setInteger("curseTime", playerInfo.getInteger("curseTime") - 100);
+ if (!player.worldObj.isRemote){
+ if (playerInfo.hasKey("reselectCurses") && !playerInfo.getBoolean("reselectCurses")){
+ playerInfo.setInteger("curseTime", playerInfo.getInteger("curseTime") - 10000);
if (playerInfo.getInteger("curseTime") <= 0) playerInfo.setBoolean("reselectCurses", true);
}
+ if (playerInfo.hasKey("playerCursePointsChanged") && playerInfo.getBoolean("playerCursePointsChanged")){
+ int points = playerInfo.getInteger("cursePoints");
+ for(int i = 0; i <= 5; i++)
+ if (points > i * 750) addCurse(player, playerInfo, ("curse" + i).toString());
+ if (!playerInfo.hasKey("curseTime") || !playerInfo.hasKey("reselectCurses") || playerInfo.getBoolean("reselectCurses")){
+ playerInfo.setInteger("curseTime", 23000);
+ playerInfo.setBoolean("reselectCurses", false);
+ }
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ }
+ for(int i = 0; i < 18; i++)
+ if (playerInfo.hasKey("ext" + i)){
+ NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
+ ((ItemBaseJewelry)item.getItem()).action(item, player);
+ }
+ if (playerInfo.getBoolean("playerCursePointsChanged")) playerInfo.setBoolean("playerCursePointsChanged", false);
+// for(Curse curse: Curse.getCurseList())
+// if (playerInfo.getInteger(curse.getName()) > 0) curse.action(player.worldObj, player);
+ }
+ }
+ }
+
+ /**
+ * @param event
+ */
+ @SubscribeEvent
+ public void onEntityAttacked(LivingAttackEvent event)
+ {
+ Entity entity = event.entityLiving;
+ if (entity instanceof EntityPlayer && !(event.source.getEntity() instanceof EntityPlayer)){
+ EntityPlayer player = (EntityPlayer)entity;
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (!player.worldObj.isRemote) for(int i = 0; i < 18; i++)
+ if (playerInfo.hasKey("ext" + i)){
+ NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
+ if (((ItemBaseJewelry)item.getItem()).onPlayerAttackedCacellable(item, player, event.source, event.ammount)){
+ event.setCanceled(true);
+ break;
+ }
+ ((ItemBaseJewelry)item.getItem()).onPlayerAttacked(item, player, event.source, event.ammount);
+ }
+ if (!player.worldObj.isRemote && player.getHealth() != player.prevHealth){
+ if (playerInfo.getFloat("WhiteHeart") > 0){
+ playerInfo.setFloat("WhiteHeart", 0f);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ }
+ if (playerInfo.getFloat("BlueHeart") > 0){
+ float damage = playerInfo.getFloat("BlueHeart") - event.ammount;
+ if (damage >= 0){
+ playerInfo.setFloat("BlueHeart", damage);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ player.heal(event.ammount);
+ }else{
+ playerInfo.setFloat("BlueHeart", 0f);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ player.heal(Math.abs(damage));
+ }
+ }else if (playerInfo.getFloat("BlackHeart") > 0){
+ AxisAlignedBB axisalignedbb = player.boundingBox.expand(2.0D, 0.0D, 2.0D);
+ List enemies = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, axisalignedbb);
+ if (enemies != null && !enemies.isEmpty()){
+ Iterator iterator = enemies.iterator();
+ while (iterator.hasNext()){
+ Entity enemy = (Entity)iterator.next();
+ enemy.attackEntityFrom(DamageSourceList.blackHeart, 5f * event.ammount);
+ }
+ }
+ float damage = playerInfo.getFloat("BlackHeart") - event.ammount;
+ if (damage >= 0){
+ playerInfo.setFloat("BlackHeart", damage);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ player.heal(event.ammount);
+ }else{
+ playerInfo.setFloat("BlackHeart", 0f);
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ player.heal(Math.abs(damage));
+ }
+ }
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
+ }else if (event.source.getEntity() instanceof EntityPlayer){
+ EntityPlayer player = (EntityPlayer)event.source.getEntity();
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (!player.worldObj.isRemote) for(int i = 0; i < 18; i++)
+ if (playerInfo.hasKey("ext" + i)){
+ NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
+ ((ItemBaseJewelry)item.getItem()).onEntityAttackedCacellable(item, player, entity, event.ammount);
+ ((ItemBaseJewelry)item.getItem()).onEntityAttacked(item, player, entity, event.ammount);
+ }
}
}
+ /**
+ * @param event
+ */
@SubscribeEvent
public void onPlayerRespawn(PlayerEvent.Clone event)
{
EntityPlayer player = event.entityPlayer;
- if (!player.worldObj.isRemote)
- {
+ if (!player.worldObj.isRemote){
NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (playerInfo.hasKey("cursePoints") && playerInfo.getInteger("cursePoints") > 0)
- {
+ if (playerInfo.hasKey("cursePoints") && playerInfo.getInteger("cursePoints") > 0){
int points = playerInfo.getInteger("cursePoints");
- addCurse(player, playerInfo, "curse1");
- if (points > 50) addCurse(player, playerInfo, "curse2");
- if(!playerInfo.hasKey("curseTime") || !playerInfo.hasKey("reselectCurses") || playerInfo.getBoolean("reselectCurses"))
- {
+ for(int i = 0; i <= 5; i++)
+ if (points > i * 750) addCurse(player, playerInfo, ("curse" + i).toString());
+ if (!playerInfo.hasKey("curseTime") || !playerInfo.hasKey("reselectCurses") || playerInfo.getBoolean("reselectCurses")){
playerInfo.setInteger("curseTime", 23000);
playerInfo.setBoolean("reselectCurses", false);
}
}
}
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ }
+
+ @SubscribeEvent
+ public void onPlayerFall(LivingFallEvent event)
+ {
+ Entity entity = event.entity;
+ if (entity instanceof EntityPlayer){
+ EntityPlayer player = (EntityPlayer)entity;
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (!player.worldObj.isRemote) for(int i = 0; i < 18; i++)
+ if (playerInfo.hasKey("ext" + i)){
+ NBTTagCompound nbt = (NBTTagCompound)playerInfo.getTag("ext" + i);
+ ItemStack item = ItemStack.loadItemStackFromNBT(nbt);
+ if (((ItemBaseJewelry)item.getItem()).onPlayerFall(item, player)){
+ event.setCanceled(true);
+ break;
+ }
+ }
+ }
}
+ /**
+ * @param player
+ * @param playerInfo
+ * @param curse
+ */
public void addCurse(EntityPlayer player, NBTTagCompound playerInfo, String curse)
{
- if ((!playerInfo.hasKey(curse) || playerInfo.getInteger(curse) == -1) && JewelrycraftUtil.availableCurseNames.size() > 0)
- {
- String name = JewelrycraftUtil.availableCurseNames.get(JewelrycraftUtil.rand.nextInt(JewelrycraftUtil.availableCurseNames.size()));
- int grade = player.worldObj.rand.nextInt(2);
- playerInfo.setByte(name, (byte) grade);
- JewelrycraftUtil.availableCurseNames.remove(JewelrycraftUtil.curseValues.get(name));
+ if ((!playerInfo.hasKey(curse) || playerInfo.getInteger(curse) == 0) && Curse.availableCurses.size() > 0){
+ int no = JewelrycraftUtil.rand.nextInt(Curse.availableCurses.size());
+ Curse cur = Curse.availableCurses.get(no);
+ int grade = 1 + player.worldObj.rand.nextInt(2);
+ playerInfo.setInteger(cur.getName(), grade);
+ Curse.availableCurses.remove(cur);
playerInfo.setInteger(curse, grade);
}
}
+ public static void addCurse(EntityPlayer player, NBTTagCompound playerInfo, String curseNo, int curseID)
+ {
+ if ((!playerInfo.hasKey(curseNo) || playerInfo.getInteger(curseNo) <= 0) && Curse.availableCurses.size() > 0){
+ Curse cur = Curse.availableCurses.get(curseID);
+ int grade = 1 + player.worldObj.rand.nextInt(2);
+ playerInfo.setInteger(cur.getName(), grade);
+ Curse.availableCurses.remove(cur);
+ playerInfo.setInteger(curseNo, grade);
+ }
+ }
+
+ @SubscribeEvent
+ public void itemToss(ItemTossEvent event)
+ {
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(event.player, "Jewelrycraft");
+ for(Curse curse: Curse.getCurseList())
+ if (playerInfo.getInteger(curse.getName()) > 0 && curse.itemToss()){
+ EntityItem entityitem = new EntityItem(event.player.worldObj, event.player.posX + 0.5D, event.player.posY + 0.5D, event.player.posZ + 0.5D, event.entityItem.getEntityItem());
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ event.player.worldObj.spawnEntityInWorld(entityitem);
+ event.player.addChatComponentMessage(new ChatComponentText("<" + event.player.getDisplayName() + "> This is MY item! MINE! I will NEVER give it to you! Mine! Mine! MINE!"));
+ event.setCanceled(true);
+ }
+ }
+
+ /**
+ * @param event
+ */
@SubscribeEvent
public void playerFileSave(PlayerEvent.SaveToFile event)
{
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
+ /**
+ * @param event
+ */
@SubscribeEvent
public void onEntityDead(LivingDeathEvent event)
{
final Entity entity = event.entity;
- if (!entity.worldObj.isRemote && entity instanceof EntityPlayer)
- {
- EntityPlayer player = (EntityPlayer) entity;
+ Random rand = new Random();
+ String[] types = {"Red", "Blue", "White", "Black"};
+ if (!entity.worldObj.isRemote && !(entity instanceof EntityPlayer) && entity instanceof EntityLiving){
+ EntityLiving live = (EntityLiving)entity;
+ String type = types[rand.nextInt(4)];
+ if (rand.nextInt(6) == 0){
+ if (type == "White"){
+ EntityHeart h = new EntityHalfHeart(live.worldObj);
+ h.setType(type);
+ h.setLocationAndAngles(live.posX, live.posY, live.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F);
+ live.worldObj.spawnEntityInWorld(h);
+ }else{
+ for(int i = 1; i <= 1 + rand.nextInt(1 + (int)(live.getMaxHealth() / 20)); i++){
+ EntityHeart[] hearts = {new EntityHeart(live.worldObj), new EntityHalfHeart(entity.worldObj)};
+ EntityHeart h = hearts[rand.nextInt(2)];
+ h.setType(type);
+ h.setLocationAndAngles(live.posX, live.posY, live.posZ, MathHelper.wrapAngleTo180_float(rand.nextFloat() * 360.0F), 0.0F);
+ live.worldObj.spawnEntityInWorld(h);
+ }
+ }
+ }
+ }
+ if (!entity.worldObj.isRemote && entity instanceof EntityPlayer){
+ EntityPlayer player = (EntityPlayer)entity;
NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (playerInfo.hasKey("reselectCurses") && playerInfo.getBoolean("reselectCurses"))
- {
- for (String l : JewelrycraftUtil.curseValues.keySet())
- if (playerInfo.getInteger(l) == 0 || playerInfo.getInteger("Deaths") == 2) playerInfo.setByte(l, (byte) -1);
- for (int i = 1; i <= 2; i++)
- if ((playerInfo.hasKey(("curse" + i).toString()) && playerInfo.getInteger(("curse" + i).toString()) == 0) || playerInfo.getInteger("Deaths") == 2) playerInfo.setInteger(("curse" + i).toString(), -1);
- JewelrycraftUtil.availableCurseNames.putAll(JewelrycraftUtil.curseNames);
+ if (playerInfo.hasKey("reselectCurses") && playerInfo.getBoolean("reselectCurses")){
+ for(Curse l: Curse.getCurseList()){
+ if (playerInfo.getInteger(l.getName()) == 1){
+ playerInfo.setInteger(l.getName(), 0);
+ if(!Curse.availableCurses.contains(l)) Curse.availableCurses.add(l);
+ }else if (playerInfo.getInteger(l.getName()) >= 2) playerInfo.setInteger(l.getName(), 1);
+ }
+ for(int i = 0; i <= 5; i++)
+ if (playerInfo.hasKey(("curse" + i).toString()))
+ playerInfo.setInteger(("curse" + i).toString(), playerInfo.getInteger(("curse" + i).toString()) == 1 ? 0:1);
+
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
- if (!playerInfo.hasKey("Deaths") || playerInfo.getInteger("Deaths") == 2) playerInfo.setInteger("Deaths", 0);
- playerInfo.setInteger("Deaths", playerInfo.getInteger("Deaths") + 1);
}
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
+ if (event.entity instanceof EntityPlayer && !(event.entity instanceof EntityPlayerMP)) JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
}
+ /**
+ * @param event
+ */
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event)
{
- if (!event.world.isRemote)
- {
+ if (!event.world.isRemote){
new File(JewelrycraftMod.dir + File.separator + "Jewelrycraft").mkdirs();
JewelrycraftMod.liquidsConf = new File(JewelrycraftMod.dir + File.separator + "Jewelrycraft", "JLP" + event.world.getWorldInfo().getWorldName() + ".cfg");
- try
- {
+ try{
if (!JewelrycraftMod.liquidsConf.exists()) JewelrycraftMod.liquidsConf.createNewFile();
}
- catch (IOException e)
- {
+ catch(IOException e){
e.printStackTrace();
}
}
-
- if (FMLCommonHandler.instance().getEffectiveSide().isServer())
- {
- try
- {
- if (JewelrycraftMod.liquidsConf.exists()) JewelrycraftMod.saveData = CompressedStreamTools.readCompressed(new FileInputStream(JewelrycraftMod.liquidsConf));
- }
- catch (EOFException e)
- {
- e.printStackTrace();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
+ if (FMLCommonHandler.instance().getEffectiveSide().isServer()) try{
+ if (JewelrycraftMod.liquidsConf.exists()) JewelrycraftMod.saveData = CompressedStreamTools.readCompressed(new FileInputStream(JewelrycraftMod.liquidsConf));
+ }
+ catch(EOFException e){
+ e.printStackTrace();
+ }
+ catch(IOException e){
+ e.printStackTrace();
}
- JewelrycraftMod.netWrapper.sendToServer(new PacketRequestPlayerInfo());
-
}
+ /**
+ * @param event
+ */
@SubscribeEvent
public void onWorldSave(WorldEvent.Save event)
{
- if (FMLCommonHandler.instance().getEffectiveSide().isServer())
- {
- try
- {
- if (JewelrycraftMod.liquidsConf.exists()) CompressedStreamTools.writeCompressed(JewelrycraftMod.saveData, new FileOutputStream(JewelrycraftMod.liquidsConf));
- }
- catch (EOFException e)
- {
- e.printStackTrace();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
+ if (FMLCommonHandler.instance().getEffectiveSide().isServer()) try{
+ if (JewelrycraftMod.liquidsConf.exists()) CompressedStreamTools.writeCompressed(JewelrycraftMod.saveData, new FileOutputStream(JewelrycraftMod.liquidsConf));
+ }
+ catch(EOFException e){
+ e.printStackTrace();
+ }
+ catch(IOException e){
+ e.printStackTrace();
}
}
+ /**
+ * @param event
+ */
@SubscribeEvent
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
public void fogColors(EntityViewRenderEvent.FogColors event)
{
- if (event.entity instanceof EntityPlayer)
- {
- EntityPlayer player = (EntityPlayer) event.entity;
+ if (event.entity instanceof EntityPlayer){
+ EntityPlayer player = (EntityPlayer)event.entity;
NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (persistTag.getBoolean("nearStartedRitual"))
- {
+ if (persistTag.getBoolean("nearStartedRitual")){
event.red = 0f;
event.green = 0f;
event.blue = 0f;
@@ -223,22 +393,25 @@ public class EntityEventHandler
if (event.isCancelable()) event.setCanceled(true);
}
+ /**
+ * @param event
+ */
@SubscribeEvent
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
public void fogDensity(EntityViewRenderEvent.FogDensity event)
- {
- }
+ {}
+ /**
+ * @param event
+ */
@SubscribeEvent
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
public void renderFog(EntityViewRenderEvent.RenderFogEvent event)
{
- if (event.entity instanceof EntityPlayer)
- {
- EntityPlayer player = (EntityPlayer) event.entity;
+ if (event.entity instanceof EntityPlayer){
+ EntityPlayer player = (EntityPlayer)event.entity;
NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (persistTag.getBoolean("nearStartedRitual"))
- {
+ if (persistTag.getBoolean("nearStartedRitual")){
GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
GL11.glFogf(GL11.GL_FOG_DENSITY, 0.6F);
}
diff --git a/java/darkknight/jewelrycraft/events/KeyBindings.java b/java/darkknight/jewelrycraft/events/KeyBindings.java
index 462be0c..a032047 100644
--- a/java/darkknight/jewelrycraft/events/KeyBindings.java
+++ b/java/darkknight/jewelrycraft/events/KeyBindings.java
@@ -1,14 +1,10 @@
package darkknight.jewelrycraft.events;
-import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
-
import org.lwjgl.input.Keyboard;
-
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
-import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.network.PacketKeyPressEvent;
@@ -17,12 +13,18 @@ public class KeyBindings
public static KeyBinding render = new KeyBinding("Pretty Render", Keyboard.KEY_Z, "Jewelrycraft");
public static KeyBinding inventory = new KeyBinding("Jewelry Inventory", Keyboard.KEY_J, "Jewelrycraft");
+ /**
+ *
+ */
public KeyBindings()
{
ClientRegistry.registerKeyBinding(render);
ClientRegistry.registerKeyBinding(inventory);
}
+ /**
+ * @param event
+ */
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
diff --git a/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java b/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java
new file mode 100644
index 0000000..c66a07a
--- /dev/null
+++ b/java/darkknight/jewelrycraft/events/PlayerRenderHandler.java
@@ -0,0 +1,20 @@
+package darkknight.jewelrycraft.events;
+
+import net.minecraft.client.Minecraft;
+import net.minecraftforge.client.event.RenderPlayerEvent;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import darkknight.jewelrycraft.model.ModelMask;
+import darkknight.jewelrycraft.tileentity.renders.MaskRender;
+
+public class PlayerRenderHandler
+{
+ ModelMask maskModel = new ModelMask();
+ MaskRender mask = new MaskRender();
+
+ @SubscribeEvent
+ public void renderScreen(RenderPlayerEvent.Pre event)
+ {
+// if (event.entityPlayer.equals(Minecraft.getMinecraft().thePlayer)) mask.doRender(event.entityPlayer, 0F, 0F, 0F, event.entityPlayer.rotationPitch, event.entityPlayer.rotationYawHead);
+ // mask.renderTileEntityAt(null, event.x, event.entity.rotationPitch, event.entity.rotationYawHead, 0F);
+ }
+}
diff --git a/java/darkknight/jewelrycraft/events/ScreenHandler.java b/java/darkknight/jewelrycraft/events/ScreenHandler.java
index 237a452..4d8013d 100644
--- a/java/darkknight/jewelrycraft/events/ScreenHandler.java
+++ b/java/darkknight/jewelrycraft/events/ScreenHandler.java
@@ -1,76 +1,96 @@
package darkknight.jewelrycraft.events;
-import java.awt.Color;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
-
-import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
-
-import cpw.mods.fml.client.FMLClientHandler;
-import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
-import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.config.ConfigHandler;
-import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-import darkknight.jewelrycraft.util.PlayerUtils;
+import darkknight.jewelrycraft.curses.Curse;
public class ScreenHandler extends Gui
{
private Minecraft mc;
-
public static NBTTagCompound tagCache;
public static int cooldown;
+ static ResourceLocation texture;
+ static ResourceLocation hearts = new ResourceLocation("jewelrycraft", "textures/gui/hearts.png");
- public ScreenHandler(Minecraft mc)
+ public ScreenHandler(Minecraft mc, ResourceLocation tex)
{
super();
this.mc = mc;
+ texture = tex;
}
@SubscribeEvent
public void renderScreen(RenderGameOverlayEvent event)
{
- if (event.isCancelable() || event.type != ElementType.ALL || tagCache == null) return;
- mc.renderEngine.bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/curses.png"));
- int count = 0;
- for (String l : JewelrycraftUtil.curseValues.keySet())
- if (tagCache.getByte(l) > -1){
- int tag = JewelrycraftUtil.curseValues.get(l);
- int size = 16;
- this.drawRect(0, (size + 6) * count, 24 + mc.fontRenderer.getStringWidth(l.split(":")[1]), 4 + (size + 6) * count + 16, 0xaf000000);
- this.drawRect(2, 2 + (size + 6) * count, 22 + mc.fontRenderer.getStringWidth(l.split(":")[1]), 2 + (size + 6) * count + 16, 0x95700064);
- count++;
- }
- count = 0;
- for (String l : JewelrycraftUtil.curseValues.keySet())
- if (tagCache.getByte(l) > -1){
- int tag = JewelrycraftUtil.curseValues.get(l);
- int size = 16;
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glDisable(GL11.GL_LIGHTING);
- this.drawTexturedModalRect(2, 2 + (size + 6) * count, tag % size * size, tag / size * size, size, size);
- count++;
+ if (event.isCancelable() || event.type != ElementType.ALL || tagCache == null) return;
+ if (!mc.gameSettings.showDebugInfo && !(mc.currentScreen instanceof GuiChat)){
+ int count = 0;
+ int size = 32;
+ ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
+ if (tagCache.hasKey("cursePoints") && tagCache.getInteger("cursePoints") > 0){
+ mc.renderEngine.bindTexture(texture);
+ for(Curse curse: Curse.getCurseList()){
+ if (tagCache.hasKey(curse.getName()) && tagCache.getInteger(curse.getName()) > 0){
+ Gui.drawRect(0, (size / 2 + 6) * count, 24 + mc.fontRenderer.getStringWidth(curse.getName().split(":")[1]), 4 + (size / 2 + 6) * count + 16, 0xaf000000);
+ Gui.drawRect(2, 2 + (size / 2 + 6) * count, 22 + mc.fontRenderer.getStringWidth(curse.getName().split(":")[1]), 2 + (size / 2 + 6) * count + 16, 0x95700064);
+ count++;
+ }
+ }
+ count = 0;
+ for(Curse curse: Curse.getCurseList())
+ if (tagCache.hasKey(curse.getName()) && tagCache.getInteger(curse.getName()) > 0){
+ int tag = curse.getID();
+ GL11.glPushMatrix();
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glScalef(0.5f, 0.5f, 0.0f);
+ drawTexturedModalRect(4, 4 + (size + 12) * count, tag % size * size, tag / size * size, size, size);
+ GL11.glPopMatrix();
+ count++;
+ }
+ count = 0;
+ size = 16;
+ for(Curse curse: Curse.getCurseList())
+ if (tagCache.hasKey(curse.getName()) && tagCache.getInteger(curse.getName()) > 0){
+ int tag = curse.getID();
+ mc.fontRenderer.drawStringWithShadow(curse.getName().split(":")[1], 20, 7 + (size + 6) * count, 16777215);
+ if (tagCache.getInteger(curse.getName()) == 2){
+ mc.renderEngine.bindTexture(hearts);
+ GL11.glPushMatrix();
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(1f, 1f, 1f, 0.5f);
+ drawTexturedModalRect(15 + mc.fontRenderer.getStringWidth(curse.getName().split(":")[1]), 8 + (size + 6) * count, 3 * size, 0, size, size);
+ GL11.glPopMatrix();
+ }
+ count++;
+ }
+ }
+ mc.renderEngine.bindTexture(hearts);
+ count = 0;
+ if (tagCache.getFloat("BlueHeart") > 0){
+ for(int i = 0; i < (int)tagCache.getFloat("BlueHeart") / 2; i++)
+ drawTexturedModalRect(2 + 13 * i, resolution.getScaledHeight() / 2 - 25 + 16 * count, 0 * size, 0 * size, size, size);
+ if (tagCache.getFloat("BlueHeart") % 2 != 0) drawTexturedModalRect(2 + 13 * ((int)tagCache.getFloat("BlueHeart") / 2), resolution.getScaledHeight() / 2 - 25 + 16 * count, 0 * size, 1 * size, size, size);
+ }
+ count++;
+ if (tagCache.getFloat("BlackHeart") > 0){
+ for(int i = 0; i < MathHelper.ceiling_float_int((tagCache.getFloat("BlackHeart")) / 2.0F); i++)
+ drawTexturedModalRect(2 + 13 * i, resolution.getScaledHeight() / 2 - 25 + 16 * count, 1 * size, 0 * size, size, size);
+ if (tagCache.getFloat("BlackHeart") % 2 != 0) drawTexturedModalRect(2 + 13 * ((int)tagCache.getFloat("BlackHeart") / 2), resolution.getScaledHeight() / 2 - 25 + 16 * count, 1 * size, 1 * size, size, size);
}
- count = 0;
- for (String l : JewelrycraftUtil.curseValues.keySet())
- if (tagCache.getByte(l) > -1){
- int tag = JewelrycraftUtil.curseValues.get(l);
- int size = 16;
- mc.fontRenderer.drawStringWithShadow(l.split(":")[1], 20, 7 + (size + 6) * count, 16777215);
- if(tagCache.getByte(l) == 1) mc.fontRenderer.drawStringWithShadow("Leech", mc.fontRenderer.getStringWidth(l.split(":")[1]) + 25, 7 + (size + 6) * count, 16777215);
- count++;
- }
+ count++;
+ if (tagCache.getFloat("WhiteHeart") > 0)
+ drawTexturedModalRect(2, resolution.getScaledHeight() / 2 - 25 + 16 * count, 2 * size, 1 * size, size, size);
+ }
}
} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java b/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java
index 9d65a60..fe614d0 100644
--- a/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java
+++ b/java/darkknight/jewelrycraft/item/ItemBaseJewelry.java
@@ -1,11 +1,5 @@
package darkknight.jewelrycraft.item;
-import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.awt.Image;
-import java.awt.Transparency;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
@@ -15,126 +9,97 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-
import javax.imageio.ImageIO;
-
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResourceManager;
+import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.effects.ModifierEffects;
import darkknight.jewelrycraft.util.JewelryNBT;
-public class ItemBaseJewelry extends Item
+public abstract class ItemBaseJewelry extends Item
{
public ItemBaseJewelry()
{
super();
- this.setMaxStackSize(1);
+ setMaxStackSize(1);
}
- @Override
public boolean requiresMultipleRenderPasses()
{
return true;
}
- @SideOnly(Side.CLIENT)
+ @SideOnly (Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass)
{
- try
- {
+ try{
return color(stack, pass);
}
- catch (IOException e)
- {
+ catch(IOException e){
e.printStackTrace();
}
return 16777215;
}
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ * @throws IOException
+ */
public static int color(ItemStack stack, int pass) throws IOException
{
- String domain = "", texture;
IResourceManager rm = Minecraft.getMinecraft().getResourceManager();
BufferedImage icon;
- if (pass == 0 && stack != null && JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0 && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215)
- {
- ItemStack in = JewelryNBT.ingot(stack);
- if (Item.getIdFromItem(in.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(in.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(in.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(in.getItem()) == Block.getIdFromBlock(Blocks.carpet)) in.setItemDamage(15 - in.getItemDamage());
- IIcon itemIcon = in.getItem().getIcon(in, 0);
- String ingotIconName = itemIcon.getIconName();
-
- if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim();
- else domain = "minecraft";
-
- texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png";
- ResourceLocation ingot = null;
- TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
-
- if (texturemanager.getResourceLocation(JewelryNBT.ingot(stack).getItemSpriteNumber()).toString().contains("items")) ingot = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
- else ingot = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
-
- icon = ImageIO.read(rm.getResource(ingot).getInputStream());
+ if (pass == 0 && stack != null && JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0 && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215){
+ ItemStack ingot = JewelryNBT.ingot(stack);
+ icon = ImageIO.read(rm.getResource(getLocation(ingot, stack, true)).getInputStream());
int height = icon.getHeight();
int width = icon.getWidth();
Map m = new HashMap();
- for (int i = 0; i < width; i++)
- for (int j = 0; j < height; j++)
- {
+ for(int i = 0; i < width; i++)
+ for(int j = 0; j < height; j++){
int rgb = icon.getRGB(i, j);
- int red = (rgb >> 16) & 0xff;
- int green = (rgb >> 8) & 0xff;
- int blue = (rgb) & 0xff;
+ int red = rgb >> 16 & 0xff;
+ int green = rgb >> 8 & 0xff;
+ int blue = rgb & 0xff;
int[] rgbArr = {red, green, blue};
int Cmax = Math.max(red, Math.max(green, blue));
int Cmin = Math.min(red, Math.min(green, blue));
- if (!isGray(rgbArr)) m.put(rgb, (Cmax + Cmin)/2);
+ if (!isGray(rgbArr)) m.put(rgb, (Cmax + Cmin) / 2);
}
int color = getMostCommonColour(m);
if (JewelryNBT.ingot(stack) != null && JewelryNBT.ingot(stack).getItem().getColorFromItemStack(JewelryNBT.ingot(stack), 1) != 16777215) JewelryNBT.addIngotColor(stack, JewelryNBT.ingot(stack).getItem().getColorFromItemStack(JewelryNBT.ingot(stack), 1));
else JewelryNBT.addIngotColor(stack, color);
- }
- else if (pass == 1 && stack != null && JewelryNBT.gem(stack) != null && JewelryNBT.gem(stack).getIconIndex() != null && JewelryNBT.gem(stack) != null)
- {
- IIcon itemIcon = JewelryNBT.gem(stack).getItem().getIconFromDamage(JewelryNBT.gem(stack).getItemDamage());
- String jewelIconName = itemIcon.getIconName();
-
- if (jewelIconName.substring(0, jewelIconName.indexOf(":") + 1) != "") domain = jewelIconName.substring(0, jewelIconName.indexOf(":") + 1).replace(":", " ").trim();
- else domain = "minecraft";
-
- texture = jewelIconName.substring(jewelIconName.lastIndexOf(":") + 1) + ".png";
- ResourceLocation jewelLoc = null;
-
- if (JewelryNBT.gem(stack).getUnlocalizedName().contains("item")) jewelLoc = new ResourceLocation(domain, "textures/items/" + texture);
- else jewelLoc = new ResourceLocation(domain, "textures/blocks/" + texture);
-
- icon = ImageIO.read(rm.getResource(jewelLoc).getInputStream());
+ }else if (pass == 1 && stack != null && JewelryNBT.gem(stack) != null && JewelryNBT.gem(stack).getIconIndex() != null && JewelryNBT.gem(stack) != null){
+ ItemStack gem = JewelryNBT.gem(stack);
+ icon = ImageIO.read(rm.getResource(getLocation(gem, stack, true)).getInputStream());
int height = icon.getHeight();
int width = icon.getWidth();
Map m = new HashMap();
- for (int i = 0; i < width; i++)
- for (int j = 0; j < height; j++)
- {
+ for(int i = 0; i < width; i++)
+ for(int j = 0; j < height; j++){
int rgb = icon.getRGB(i, j);
- int red = (rgb >> 16) & 0xff;
- int green = (rgb >> 8) & 0xff;
- int blue = (rgb) & 0xff;
+ int red = rgb >> 16 & 0xff;
+ int green = rgb >> 8 & 0xff;
+ int blue = rgb & 0xff;
int[] rgbArr = {red, green, blue};
int Cmax = Math.max(red, Math.max(green, blue));
int Cmin = Math.min(red, Math.min(green, blue));
- if (!isGray(rgbArr)) m.put(rgb, (Cmax + Cmin)/2);
+ if (!isGray(rgbArr)) m.put(rgb, (Cmax + Cmin) / 2);
}
int color = getMostCommonColour(m);
if (JewelryNBT.gem(stack).getItem().getColorFromItemStack(JewelryNBT.gem(stack), 1) == 16777215) JewelryNBT.addGemColor(stack, color);
@@ -146,56 +111,162 @@ public class ItemBaseJewelry extends Item
return 16777215;
}
+ /**
+ * @param item
+ * @param stack
+ * @param changeMeta
+ * @return
+ */
+ public static ResourceLocation getLocation(ItemStack item, ItemStack stack, boolean changeMeta)
+ {
+ String domain = "";
+ String texture;
+ if (changeMeta && (Item.getIdFromItem(item.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(item.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(item.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(item.getItem()) == Block.getIdFromBlock(Blocks.carpet))) item.setItemDamage(15 - item.getItemDamage());
+ IIcon itemIcon = item.getItem().getIcon(item, 0);
+ String iconName = itemIcon.getIconName();
+ if (iconName.substring(0, iconName.indexOf(":") + 1) != "") domain = iconName.substring(0, iconName.indexOf(":") + 1).replace(":", " ").trim();
+ else domain = "minecraft";
+ texture = iconName.substring(iconName.lastIndexOf(":") + 1) + ".png";
+ ResourceLocation textureLocation = null;
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
+ if (texturemanager.getResourceLocation(item.getItemSpriteNumber()).toString().contains("items")) textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
+ else textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
+ return textureLocation;
+ }
+
+ /**
+ * @param map
+ * @return
+ */
public static int getMostCommonColour(Map map)
{
List list = new LinkedList(map.entrySet());
- Collections.sort(list, new Comparator()
- {
+ Collections.sort(list, new Comparator(){
public int compare(Object o1, Object o2)
{
- return ((Comparable) ((Map.Entry) (o1)).getValue()).compareTo(((Map.Entry) (o2)).getValue());
+ return ((Comparable)((Map.Entry)o1).getValue()).compareTo(((Map.Entry)o2).getValue());
}
});
- Map.Entry me = (Map.Entry) list.get(list.size() - 1);
- for (int i = 0; i < list.size(); i++)
- {
+ Map.Entry me = (Map.Entry)list.get(list.size() - 1);
+ for(int i = 0; i < list.size(); i++){
float alpha = Float.valueOf(list.get(i).toString().split("=")[1]);
- if (alpha < 180) me = (Map.Entry) list.get(i);
+ if (alpha < 180) me = (Map.Entry)list.get(i);
}
- int rgb = (Integer) me.getKey();
+ int rgb = (Integer)me.getKey();
return rgb;
}
+ /**
+ * @param rgbArr
+ * @return
+ */
public static boolean isGray(int[] rgbArr)
{
int rgbSum = rgbArr[0] + rgbArr[1] + rgbArr[2];
- if (rgbSum > 0 && rgbSum < 256 * 3) { return false; }
+ if (rgbSum > 0 && rgbSum < 256 * 3) return false;
return true;
}
+ /**
+ * @param stack
+ * @return
+ */
public String getItemStackDisplayName(ItemStack stack)
{
- if (JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) return JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() + " " + ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
- return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
+ if (JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) return JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() + " " + ("" + StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name")).trim();
+ return ("" + StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name")).trim();
}
/**
- * allows items to add custom lines of information to the mouseover description
+ * allows items to add custom lines of information to the mouseover description.
+ *
+ * @param stack
+ * @param player
+ * @param list
+ * @param par4
*/
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
- if (stack.hasTagCompound() && par4)
- {
+ if (stack.hasTagCompound() && par4){
ItemStack ingot = JewelryNBT.ingot(stack);
if (ingot != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) list.add("Ingot: " + EnumChatFormatting.YELLOW + ingot.getDisplayName());
-
ItemStack gem = JewelryNBT.gem(stack);
if (gem != null) list.add("Gem: " + EnumChatFormatting.BLUE + gem.getDisplayName());
-
ArrayList<ItemStack> modifier = JewelryNBT.modifier(stack);
if (!modifier.isEmpty()) list.add("Modifiers: ");
- for (int i = 0; i < modifier.size(); i++)
+ for(int i = 0; i < modifier.size(); i++)
list.add(EnumChatFormatting.DARK_PURPLE + modifier.get(i).getDisplayName() + " x" + modifier.get(i).stackSize);
}
}
+
+ /**
+ * @param stack
+ * @param player
+ */
+ public void action(ItemStack stack, EntityPlayer player)
+ {
+ for(ModifierEffects mod: ModifierEffects.getEffects())
+ mod.action(stack, player, this);
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param source
+ * @return
+ */
+ public boolean onPlayerAttackedCacellable(ItemStack item, EntityPlayer player, DamageSource source, float amount)
+ {
+ for(ModifierEffects mod: ModifierEffects.getEffects())
+ return mod.onPlayerAttackedCacellable(item, player, source, this, amount);
+ return false;
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param target
+ * @return
+ */
+ public boolean onEntityAttackedCacellable(ItemStack item, EntityPlayer player, Entity target, float amount)
+ {
+ for(ModifierEffects mod: ModifierEffects.getEffects())
+ return mod.onEntityAttackedCacellable(item, player, target, this, amount);
+ return false;
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param source
+ * @return
+ */
+ public void onPlayerAttacked(ItemStack item, EntityPlayer player, DamageSource source, float amount)
+ {
+ for(ModifierEffects mod: ModifierEffects.getEffects()) mod.onPlayerAttacked(item, player, source, this, amount);
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param target
+ * @return
+ */
+ public void onEntityAttacked(ItemStack item, EntityPlayer player, Entity target, float amount)
+ {
+ for(ModifierEffects mod: ModifierEffects.getEffects()) mod.onEntityAttacked(item, player, target, this, amount);
+ }
+
+ /**
+ * @param item
+ * @param player
+ * @param source
+ * @return
+ */
+ public boolean onPlayerFall(ItemStack item, EntityPlayer player)
+ {
+ for(ModifierEffects mod: ModifierEffects.getEffects())
+ return mod.onPlayerFall(item, player, this);
+ return false;
+ }
}
diff --git a/java/darkknight/jewelrycraft/item/ItemBracelet.java b/java/darkknight/jewelrycraft/item/ItemBracelet.java
index 8b034c7..b754186 100644
--- a/java/darkknight/jewelrycraft/item/ItemBracelet.java
+++ b/java/darkknight/jewelrycraft/item/ItemBracelet.java
@@ -7,17 +7,30 @@ import darkknight.jewelrycraft.util.JewelryNBT;
public class ItemBracelet extends ItemBaseJewelry
{
- public IIcon gem;
+ public IIcon gem;
+
+ /**
+ *
+ */
public ItemBracelet()
- {
- }
+ {}
+ /**
+ * @param iconRegister
+ */
+ @Override
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:bracelet");
gem = iconRegister.registerIcon("jewelrycraft:jewelBracelet");
}
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
public IIcon getIcon(ItemStack stack, int pass)
{
if (pass == 0) return itemIcon;
diff --git a/java/darkknight/jewelrycraft/item/ItemClayMolds.java b/java/darkknight/jewelrycraft/item/ItemClayMolds.java
index 29a2526..9f99857 100644
--- a/java/darkknight/jewelrycraft/item/ItemClayMolds.java
+++ b/java/darkknight/jewelrycraft/item/ItemClayMolds.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.item;
import java.util.List;
-
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@@ -14,62 +13,75 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemClayMolds extends Item
{
/** List of molds color names */
- public static final String[] moldsItemNames = new String[]
- { "clayIngot", "clayRing", "clayNecklace", "clayBracelet", "clayEarrings"};
- @SideOnly(Side.CLIENT)
+ public static final String[] moldsItemNames = new String[]{"clayIngot", "clayRing", "clayNecklace", "clayBracelet", "clayEarrings"};
+ @SideOnly (Side.CLIENT)
private IIcon[] moldsIcons;
+ /**
+ *
+ */
public ItemClayMolds()
{
super();
- this.setHasSubtypes(true);
- this.setMaxDamage(0);
- this.setMaxStackSize(1);
+ setHasSubtypes(true);
+ setMaxDamage(0);
+ setMaxStackSize(1);
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param par1
+ * @return
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
/**
* Gets an icon index based on an item's damage value
*/
public IIcon getIconFromDamage(int par1)
{
int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
- return this.moldsIcons[j];
+ return moldsIcons[j];
}
/**
- * Returns the unlocalized name of this item. This version accepts an
- * ItemStack so different stacks can have different names based on their
- * damage or NBT.
+ * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on their damage or NBT.
+ *
+ * @param par1ItemStack
+ * @return
*/
+ @Override
public String getUnlocalizedName(ItemStack par1ItemStack)
{
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1);
return super.getUnlocalizedName() + "." + moldsItemNames[i];
}
- @SuppressWarnings(
- { "unchecked", "rawtypes" })
- @SideOnly(Side.CLIENT)
+ /**
+ * @param par1
+ * @param par2CreativeTabs
+ * @param par3List
+ */
+ @Override
+ @SuppressWarnings ({"unchecked", "rawtypes"})
+ @SideOnly (Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: molds returns 16 items)
*/
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
- for (int j = 0; j < moldsItemNames.length; ++j)
- {
+ for(int j = 0; j < moldsItemNames.length; ++j)
par3List.add(new ItemStack(par1, 1, j));
- }
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param par1IconRegister
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
{
- this.moldsIcons = new IIcon[moldsItemNames.length];
-
- for (int i = 0; i < moldsItemNames.length; ++i)
- {
- this.moldsIcons[i] = par1IconRegister.registerIcon("jewelrycraft:" + moldsItemNames[i] + this.getIconString());
- }
+ moldsIcons = new IIcon[moldsItemNames.length];
+ for(int i = 0; i < moldsItemNames.length; ++i)
+ moldsIcons[i] = par1IconRegister.registerIcon("jewelrycraft:" + moldsItemNames[i] + getIconString());
}
}
diff --git a/java/darkknight/jewelrycraft/item/ItemCrystal.java b/java/darkknight/jewelrycraft/item/ItemCrystal.java
index c9a234b..ca6b58d 100644
--- a/java/darkknight/jewelrycraft/item/ItemCrystal.java
+++ b/java/darkknight/jewelrycraft/item/ItemCrystal.java
@@ -1,80 +1,113 @@
package darkknight.jewelrycraft.item;
import java.util.List;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockSkull;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.IIcon;
-import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import darkknight.jewelrycraft.util.JewelryNBT;
public class ItemCrystal extends Item
{
public IIcon overlay;
- public static final int[] dyeColors = new int[]
- { 1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320 };
+ public static final int[] dyeColors = new int[]{1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
+ /**
+ *
+ */
public ItemCrystal()
{
super();
- this.setHasSubtypes(true);
- this.setMaxDamage(0);
+ setHasSubtypes(true);
+ setMaxDamage(0);
}
+ /**
+ * @param iconRegister
+ */
+ @Override
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:crystal");
overlay = iconRegister.registerIcon("jewelrycraft:crystalOverlay");
}
+ /**
+ * @return
+ */
@Override
public boolean requiresMultipleRenderPasses()
{
return true;
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass)
{
- if (pass == 1 && this.getDamage(stack) != 16) return dyeColors[this.getDamage(stack)];
+ if (pass == 1 && getDamage(stack) != 16) return dyeColors[getDamage(stack)];
return 16777215;
}
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
public IIcon getIcon(ItemStack stack, int pass)
{
return pass == 0 ? itemIcon : overlay;
}
+ /**
+ * @param stack
+ * @param player
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param side
+ * @param par8
+ * @param par9
+ * @param par10
+ * @return
+ */
+ @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int i, int j, int k, int side, float par8, float par9, float par10)
{
return true;
}
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
public String getUnlocalizedName(ItemStack stack)
{
return super.getUnlocalizedName() + "." + stack.getItemDamage();
}
- @SuppressWarnings(
- { "unchecked", "rawtypes" })
+ /**
+ * @param par1
+ * @param par2CreativeTabs
+ * @param par3List
+ */
+ @Override
+ @SuppressWarnings ({"unchecked", "rawtypes"})
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
- for (int j = 0; j < 16; ++j)
- {
+ for(int j = 0; j < 16; ++j)
par3List.add(new ItemStack(par1, 1, j));
- }
}
-
}
diff --git a/java/darkknight/jewelrycraft/item/ItemEarrings.java b/java/darkknight/jewelrycraft/item/ItemEarrings.java
index abff9cc..2321df0 100644
--- a/java/darkknight/jewelrycraft/item/ItemEarrings.java
+++ b/java/darkknight/jewelrycraft/item/ItemEarrings.java
@@ -7,17 +7,30 @@ import darkknight.jewelrycraft.util.JewelryNBT;
public class ItemEarrings extends ItemBaseJewelry
{
- public IIcon gem;
+ public IIcon gem;
+
+ /**
+ *
+ */
public ItemEarrings()
- {
- }
+ {}
+ /**
+ * @param iconRegister
+ */
+ @Override
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:earrings");
gem = iconRegister.registerIcon("jewelrycraft:jewelEarrings");
}
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
public IIcon getIcon(ItemStack stack, int pass)
{
if (pass == 0) return itemIcon;
diff --git a/java/darkknight/jewelrycraft/item/ItemGuide.java b/java/darkknight/jewelrycraft/item/ItemGuide.java
index 62f645e..ed85dc4 100644
--- a/java/darkknight/jewelrycraft/item/ItemGuide.java
+++ b/java/darkknight/jewelrycraft/item/ItemGuide.java
@@ -8,19 +8,25 @@ import darkknight.jewelrycraft.JewelrycraftMod;
public class ItemGuide extends Item
{
+
+ /**
+ *
+ */
public ItemGuide()
{
super();
}
+ /**
+ * @param stack
+ * @param world
+ * @param player
+ * @return
+ */
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
- if (world.isRemote)
- {
- player.openGui(JewelrycraftMod.instance, 1, player.worldObj, 0, 0, 0);
- }
-
+ if (world.isRemote) player.openGui(JewelrycraftMod.instance, 1, player.worldObj, 0, 0, 0);
return stack;
}
} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/item/ItemList.java b/java/darkknight/jewelrycraft/item/ItemList.java
index 1d060ec..b9acd96 100644
--- a/java/darkknight/jewelrycraft/item/ItemList.java
+++ b/java/darkknight/jewelrycraft/item/ItemList.java
@@ -1,15 +1,9 @@
package darkknight.jewelrycraft.item;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidContainerRegistry;
-import net.minecraftforge.fluids.FluidRegistry;
-import net.minecraftforge.fluids.FluidStack;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.block.BlockList;
public class ItemList
{
@@ -25,26 +19,26 @@ public class ItemList
public static Item guide;
public static ItemMoltenMetalBucket bucket;
public static ItemMoltenMetal metal;
-
private static boolean isInitialized = false;
+ /**
+ * @param e
+ */
public static void preInit(FMLPreInitializationEvent e)
{
- if (!isInitialized)
- {
+ if (!isInitialized){
thiefGloves = new ItemThiefGloves().setUnlocalizedName("Jewelrycraft.thiefGloves").setTextureName("jewelrycraft:thiefGloves").setCreativeTab(JewelrycraftMod.jewelrycraft);
shadowIngot = new Item().setUnlocalizedName("Jewelrycraft.ingotShadow").setTextureName("jewelrycraft:ingotShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
molds = new ItemMolds().setUnlocalizedName("Jewelrycraft.mold").setTextureName("Mold").setCreativeTab(JewelrycraftMod.jewelrycraft);
clayMolds = new ItemClayMolds().setUnlocalizedName("Jewelrycraft.mold").setTextureName("Mold").setCreativeTab(JewelrycraftMod.jewelrycraft);
- ring = (ItemRing) new ItemRing().setUnlocalizedName("Jewelrycraft.ring").setTextureName("jewelrycraft:ring");
- necklace = (ItemNecklace) new ItemNecklace().setUnlocalizedName("Jewelrycraft.necklace").setTextureName("jewelrycraft:necklace");
- bracelet = (ItemBracelet) new ItemBracelet().setUnlocalizedName("Jewelrycraft.bracelet").setTextureName("jewelrycraft:bracelet");
- earrings = (ItemEarrings) new ItemEarrings().setUnlocalizedName("Jewelrycraft.earrings").setTextureName("jewelrycraft:earrings");
+ ring = (ItemRing)new ItemRing().setUnlocalizedName("Jewelrycraft.ring").setTextureName("jewelrycraft:ring");
+ necklace = (ItemNecklace)new ItemNecklace().setUnlocalizedName("Jewelrycraft.necklace").setTextureName("jewelrycraft:necklace");
+ bracelet = (ItemBracelet)new ItemBracelet().setUnlocalizedName("Jewelrycraft.bracelet").setTextureName("jewelrycraft:bracelet");
+ earrings = (ItemEarrings)new ItemEarrings().setUnlocalizedName("Jewelrycraft.earrings").setTextureName("jewelrycraft:earrings");
crystal = new ItemCrystal().setUnlocalizedName("Jewelrycraft.crystal").setTextureName("jewelrycraft:crystal").setCreativeTab(JewelrycraftMod.jewelrycraft);
guide = new ItemGuide().setUnlocalizedName("Jewelrycraft.guide").setTextureName("jewelrycraft:guide").setCreativeTab(JewelrycraftMod.jewelrycraft);
- bucket = (ItemMoltenMetalBucket) new ItemMoltenMetalBucket().setUnlocalizedName("Jewelrycraft.bucket");
- metal = (ItemMoltenMetal) new ItemMoltenMetal().setUnlocalizedName("Jewelrycraft.bucket");
-
+ bucket = (ItemMoltenMetalBucket)new ItemMoltenMetalBucket().setUnlocalizedName("Jewelrycraft.bucket");
+ metal = (ItemMoltenMetal)new ItemMoltenMetal().setUnlocalizedName("Jewelrycraft.bucket");
GameRegistry.registerItem(thiefGloves, "thiefGloves");
GameRegistry.registerItem(shadowIngot, "shadowIngot");
GameRegistry.registerItem(molds, "molds");
@@ -57,7 +51,6 @@ public class ItemList
GameRegistry.registerItem(guide, "guide");
GameRegistry.registerItem(bucket, "moltenMetalBucket");
GameRegistry.registerItem(metal, "moltenMetal");
-
isInitialized = true;
}
}
diff --git a/java/darkknight/jewelrycraft/item/ItemMolds.java b/java/darkknight/jewelrycraft/item/ItemMolds.java
index 0703997..106fcbe 100644
--- a/java/darkknight/jewelrycraft/item/ItemMolds.java
+++ b/java/darkknight/jewelrycraft/item/ItemMolds.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.item;
import java.util.List;
-
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@@ -14,62 +13,75 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemMolds extends Item
{
/** List of molds color names */
- public static final String[] moldsItemNames = new String[]
- { "ingot", "ring", "necklace", "bracelet", "earrings" };
- @SideOnly(Side.CLIENT)
+ public static final String[] moldsItemNames = new String[]{"ingot", "ring", "necklace", "bracelet", "earrings"};
+ @SideOnly (Side.CLIENT)
private IIcon[] moldsIcons;
+ /**
+ *
+ */
public ItemMolds()
{
super();
- this.setHasSubtypes(true);
- this.setMaxDamage(0);
- this.setMaxStackSize(1);
+ setHasSubtypes(true);
+ setMaxDamage(0);
+ setMaxStackSize(1);
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param par1
+ * @return
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
/**
* Gets an icon index based on an item's damage value
*/
public IIcon getIconFromDamage(int par1)
{
int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
- return this.moldsIcons[j];
+ return moldsIcons[j];
}
/**
- * Returns the unlocalized name of this item. This version accepts an
- * ItemStack so different stacks can have different names based on their
- * damage or NBT.
+ * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on their damage or NBT.
+ *
+ * @param par1ItemStack
+ * @return
*/
+ @Override
public String getUnlocalizedName(ItemStack par1ItemStack)
{
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1);
return super.getUnlocalizedName() + "." + moldsItemNames[i];
}
- @SuppressWarnings(
- { "unchecked", "rawtypes" })
- @SideOnly(Side.CLIENT)
+ /**
+ * @param par1
+ * @param par2CreativeTabs
+ * @param par3List
+ */
+ @Override
+ @SuppressWarnings ({"unchecked", "rawtypes"})
+ @SideOnly (Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: molds returns 16 items)
*/
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
- for (int j = 0; j < moldsItemNames.length; ++j)
- {
+ for(int j = 0; j < moldsItemNames.length; ++j)
par3List.add(new ItemStack(par1, 1, j));
- }
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param par1IconRegister
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
{
- this.moldsIcons = new IIcon[moldsItemNames.length];
-
- for (int i = 0; i < moldsItemNames.length; ++i)
- {
- this.moldsIcons[i] = par1IconRegister.registerIcon("jewelrycraft:" + moldsItemNames[i] + this.getIconString());
- }
+ moldsIcons = new IIcon[moldsItemNames.length];
+ for(int i = 0; i < moldsItemNames.length; ++i)
+ moldsIcons[i] = par1IconRegister.registerIcon("jewelrycraft:" + moldsItemNames[i] + getIconString());
}
}
diff --git a/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java b/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java
index ef098f5..0638da7 100644
--- a/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java
+++ b/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java
@@ -8,16 +8,12 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-
import javax.imageio.ImageIO;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -25,79 +21,76 @@ import darkknight.jewelrycraft.util.JewelryNBT;
public class ItemMoltenMetal extends Item
{
- private int amplifier, cooldown = 0;
- int index = 0;
+ /**
+ *
+ */
public ItemMoltenMetal()
{
super();
- this.setMaxStackSize(1);
+ setMaxStackSize(1);
}
+ /**
+ * @param iconRegister
+ */
+ @Override
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:moltenMetalStill");
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass)
{
- try
- {
+ try{
return color(stack, pass);
}
- catch (IOException e)
- {
+ catch(IOException e){
e.printStackTrace();
}
return 16777215;
}
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ * @throws IOException
+ */
public static int color(ItemStack stack, int pass) throws IOException
{
- String domain = "", texture;
IResourceManager rm = Minecraft.getMinecraft().getResourceManager();
BufferedImage icon;
- if (stack != null && JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0 && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215)
- {
- IIcon itemIcon = JewelryNBT.ingot(stack).getItem().getIcon(JewelryNBT.ingot(stack), 0);
- String ingotIconName = itemIcon.getIconName();
-
- if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim();
- else domain = "minecraft";
-
- texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png";
- ResourceLocation ingot = null;
- TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
-
- if (texturemanager.getResourceLocation(JewelryNBT.ingot(stack).getItemSpriteNumber()).toString().contains("items")) ingot = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
- else ingot = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
-
+ if (stack != null && JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0 && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215){
+ ResourceLocation ingot = ItemBaseJewelry.getLocation(JewelryNBT.ingot(stack), stack, false);
icon = ImageIO.read(rm.getResource(ingot).getInputStream());
int height = icon.getHeight();
int width = icon.getWidth();
-
Map m = new HashMap();
- for (int i = 0; i < width; i++)
- for (int j = 0; j < height; j++)
- {
+ for(int i = 0; i < width; i++)
+ for(int j = 0; j < height; j++){
int rgb = icon.getRGB(i, j);
- int red = (rgb >> 16) & 0xff;
- int green = (rgb >> 8) & 0xff;
- int blue = (rgb) & 0xff;
+ int red = rgb >> 16 & 0xff;
+ int green = rgb >> 8 & 0xff;
+ int blue = rgb & 0xff;
int[] rgbArr = {red, green, blue};
int Cmax = Math.max(red, Math.max(green, blue));
int Cmin = Math.min(red, Math.min(green, blue));
- if (!isGray(rgbArr)) m.put(rgb, (Cmax + Cmin)/2);
+ if (!isGray(rgbArr)) m.put(rgb, (Cmax + Cmin) / 2);
}
- try
- {
+ try{
int color = getMostCommonColour(m);
if (JewelryNBT.ingot(stack) != null && JewelryNBT.ingot(stack).getItem().getColorFromItemStack(JewelryNBT.ingot(stack), 1) != 16777215) JewelryNBT.addIngotColor(stack, JewelryNBT.ingot(stack).getItem().getColorFromItemStack(JewelryNBT.ingot(stack), 1));
else JewelryNBT.addIngotColor(stack, color);
}
- catch (Exception e)
- {
+ catch(Exception e){
JewelryNBT.addIngotColor(stack, 16777215);
}
}
@@ -105,30 +98,36 @@ public class ItemMoltenMetal extends Item
return 0;
}
+ /**
+ * @param map
+ * @return
+ */
public static int getMostCommonColour(Map map)
{
List list = new LinkedList(map.entrySet());
- Collections.sort(list, new Comparator()
- {
+ Collections.sort(list, new Comparator(){
public int compare(Object o1, Object o2)
{
- return ((Comparable) ((Map.Entry) (o1)).getValue()).compareTo(((Map.Entry) (o2)).getValue());
+ return ((Comparable)((Map.Entry)o1).getValue()).compareTo(((Map.Entry)o2).getValue());
}
});
- Map.Entry me = (Map.Entry) list.get(list.size() - 1);
- for (int i = 0; i < list.size(); i++)
- {
+ Map.Entry me = (Map.Entry)list.get(list.size() - 1);
+ for(int i = 0; i < list.size(); i++){
float alpha = Float.valueOf(list.get(i).toString().split("=")[1]);
- if (alpha < 180) me = (Map.Entry) list.get(i);
+ if (alpha < 180) me = (Map.Entry)list.get(i);
}
- int rgb = (Integer) me.getKey();
+ int rgb = (Integer)me.getKey();
return rgb;
}
+ /**
+ * @param rgbArr
+ * @return
+ */
public static boolean isGray(int[] rgbArr)
{
int rgbSum = rgbArr[0] + rgbArr[1] + rgbArr[2];
- if (rgbSum > 0 && rgbSum < 256 * 3) { return false; }
+ if (rgbSum > 0 && rgbSum < 256 * 3) return false;
return true;
}
}
diff --git a/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java b/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
index 5c61398..9365224 100644
--- a/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
+++ b/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
@@ -1,22 +1,9 @@
package darkknight.jewelrycraft.item;
-import java.awt.image.BufferedImage;
import java.io.IOException;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import javax.imageio.ImageIO;
-
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
-import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.client.renderer.texture.TextureManager;
-import net.minecraft.client.resources.IResourceManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -24,7 +11,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
-import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
@@ -41,187 +27,157 @@ public class ItemMoltenMetalBucket extends Item
{
public IIcon liquid;
+ /**
+ *
+ */
public ItemMoltenMetalBucket()
{
- this.maxStackSize = 1;
+ maxStackSize = 1;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
+ *
+ * @param stack
+ * @param par2World
+ * @param par3EntityPlayer
+ * @return
*/
+ @Override
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer)
{
boolean flag = BlockList.moltenMetal == Blocks.air;
- MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, flag);
-
- if (movingobjectposition == null)
- {
- return stack;
- }
- else
- {
+ MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, flag);
+ if (movingobjectposition == null) return stack;
+ else{
FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, stack, par2World, movingobjectposition);
- if (MinecraftForge.EVENT_BUS.post(event)) { return stack; }
-
- if (event.getResult() == Event.Result.ALLOW)
- {
- if (par3EntityPlayer.capabilities.isCreativeMode) { return stack; }
-
- if (--stack.stackSize <= 0) { return event.result; }
-
- if (!par3EntityPlayer.inventory.addItemStackToInventory(event.result))
- {
- par3EntityPlayer.dropPlayerItemWithRandomChoice(event.result, false);
- }
-
+ if (MinecraftForge.EVENT_BUS.post(event)) return stack;
+ if (event.getResult() == Event.Result.ALLOW){
+ if (par3EntityPlayer.capabilities.isCreativeMode) return stack;
+ if (--stack.stackSize <= 0) return event.result;
+ if (!par3EntityPlayer.inventory.addItemStackToInventory(event.result)) par3EntityPlayer.dropPlayerItemWithRandomChoice(event.result, false);
return stack;
}
- if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
- {
+ if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
-
- if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) { return stack; }
-
- if (flag)
- {
- if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) { return stack; }
-
- Material material = par2World.getBlock(i, j, k).getMaterial();
- int l = par2World.getBlockMetadata(i, j, k);
+ if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) return stack;
+ if (flag){
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) return stack;
+ par2World.getBlock(i, j, k).getMaterial();
+ par2World.getBlockMetadata(i, j, k);
par2World.setBlockToAir(i, j, k);
- return this.func_150910_a(stack, par3EntityPlayer, ItemList.bucket);
- }
- else
- {
- if (BlockList.moltenMetal == Blocks.air) { return new ItemStack(Items.bucket); }
-
- if (movingobjectposition.sideHit == 0)
- {
- --j;
- }
-
- if (movingobjectposition.sideHit == 1)
- {
- ++j;
- }
-
- if (movingobjectposition.sideHit == 2)
- {
- --k;
- }
-
- if (movingobjectposition.sideHit == 3)
- {
- ++k;
- }
-
- if (movingobjectposition.sideHit == 4)
- {
- --i;
+ return func_150910_a(stack, par3EntityPlayer, ItemList.bucket);
+ }else{
+ if (BlockList.moltenMetal == Blocks.air) return new ItemStack(Items.bucket);
+ if (movingobjectposition.sideHit == 0) --j;
+ if (movingobjectposition.sideHit == 1) ++j;
+ if (movingobjectposition.sideHit == 2) --k;
+ if (movingobjectposition.sideHit == 3) ++k;
+ if (movingobjectposition.sideHit == 4) --i;
+ if (movingobjectposition.sideHit == 5) ++i;
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) return stack;
+ try{
+ if (tryPlaceContainedLiquid(par2World, i, j, k, stack) && !par3EntityPlayer.capabilities.isCreativeMode) return new ItemStack(Items.bucket);
}
-
- if (movingobjectposition.sideHit == 5)
- {
- ++i;
- }
-
- if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) { return stack; }
-
- try
- {
- if (this.tryPlaceContainedLiquid(par2World, i, j, k, stack) && !par3EntityPlayer.capabilities.isCreativeMode) { return new ItemStack(Items.bucket); }
- }
- catch (IOException e)
- {
+ catch(IOException e){
e.printStackTrace();
}
}
}
-
return stack;
}
}
+ /**
+ * @param p_150910_1_
+ * @param p_150910_2_
+ * @param p_150910_3_
+ * @return
+ */
private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_)
{
- if (p_150910_2_.capabilities.isCreativeMode)
- {
- return p_150910_1_;
- }
- else if (--p_150910_1_.stackSize <= 0)
- {
- return new ItemStack(p_150910_3_);
- }
- else
- {
- if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_)))
- {
- p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false);
- }
-
+ if (p_150910_2_.capabilities.isCreativeMode) return p_150910_1_;
+ else if (--p_150910_1_.stackSize <= 0) return new ItemStack(p_150910_3_);
+ else{
+ if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false);
return p_150910_1_;
}
}
/**
* Attempts to place the liquid contained inside the bucket.
- *
+ *
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param stack
+ * @return
* @throws IOException
*/
public boolean tryPlaceContainedLiquid(World world, int x, int y, int z, ItemStack stack) throws IOException
{
- if (BlockList.moltenMetal == Blocks.air)
- {
- return false;
- }
- else
- {
+ if (BlockList.moltenMetal == Blocks.air) return false;
+ else{
Material material = world.getBlock(x, y, z).getMaterial();
boolean flag = !material.isSolid();
-
if (!world.isAirBlock(x, y, z) && !flag) return false;
- else if (stack != null && JewelryNBT.ingot(stack) != null)
- {
+ else if (stack != null && JewelryNBT.ingot(stack) != null){
if (!world.isRemote && flag && !material.isLiquid()) world.func_147480_a(x, y, z, true);
int color = color(stack, 1);
JewelrycraftMod.saveData.setString(x + " " + y + " " + z + " " + world.provider.dimensionId, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) + ":" + JewelryNBT.ingot(stack).getItemDamage() + ":" + color);
JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, x, y, z, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()), JewelryNBT.ingot(stack).getItemDamage(), color));
-
world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3);
return true;
- }
- else return false;
+ }else return false;
}
}
+ /**
+ * @param iconRegister
+ */
+ @Override
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("bucket_empty");
liquid = iconRegister.registerIcon("jewelrycraft:bucketOverlay");
}
- @SideOnly(Side.CLIENT)
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
+ @SideOnly (Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass)
{
- try
- {
+ try{
return color(stack, pass);
}
- catch (IOException e)
- {
+ catch(IOException e){
e.printStackTrace();
}
return 16777215;
}
+ /**
+ * @return
+ */
@Override
public boolean requiresMultipleRenderPasses()
{
return true;
}
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
public IIcon getIcon(ItemStack stack, int pass)
{
if (pass == 0) return itemIcon;
@@ -229,77 +185,22 @@ public class ItemMoltenMetalBucket extends Item
return itemIcon;
}
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ * @throws IOException
+ */
public static int color(ItemStack stack, int pass) throws IOException
{
- String domain = "", texture;
- IResourceManager rm = Minecraft.getMinecraft().getResourceManager();
- BufferedImage icon;
- if (pass == 1 && stack != null && JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0 && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215)
- {
- IIcon itemIcon = JewelryNBT.ingot(stack).getItem().getIcon(JewelryNBT.ingot(stack), 0);
- String ingotIconName = itemIcon.getIconName();
-
- if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim();
- else domain = "minecraft";
-
- texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png";
- ResourceLocation ingot = null;
- TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
-
- if (texturemanager.getResourceLocation(JewelryNBT.ingot(stack).getItemSpriteNumber()).toString().contains("items")) ingot = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
- else ingot = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
-
- icon = ImageIO.read(rm.getResource(ingot).getInputStream());
- int height = icon.getHeight();
- int width = icon.getWidth();
- Map m = new HashMap();
- for (int i = 0; i < width; i++)
- for (int j = 0; j < height; j++)
- {
- int rgb = icon.getRGB(i, j);
- int red = (rgb >> 16) & 0xff;
- int green = (rgb >> 8) & 0xff;
- int blue = (rgb) & 0xff;
- int[] rgbArr = {red, green, blue};
- int Cmax = Math.max(red, Math.max(green, blue));
- int Cmin = Math.min(red, Math.min(green, blue));
- if (!isGray(rgbArr)) m.put(rgb, (Cmax + Cmin)/2);
- }
- int color = getMostCommonColour(m);
- if (JewelryNBT.ingot(stack) != null && JewelryNBT.ingot(stack).getItem().getColorFromItemStack(JewelryNBT.ingot(stack), 1) != 16777215) JewelryNBT.addIngotColor(stack, JewelryNBT.ingot(stack).getItem().getColorFromItemStack(JewelryNBT.ingot(stack), 1));
- else JewelryNBT.addIngotColor(stack, color);
- }
- if (JewelryNBT.ingot(stack) != null && pass == 1) return JewelryNBT.ingotColor(stack);
+ if (pass == 1) return ItemMoltenMetal.color(stack, pass);
return 16777215;
}
- public static int getMostCommonColour(Map map)
- {
- List list = new LinkedList(map.entrySet());
- Collections.sort(list, new Comparator()
- {
- public int compare(Object o1, Object o2)
- {
- return ((Comparable) ((Map.Entry) (o1)).getValue()).compareTo(((Map.Entry) (o2)).getValue());
- }
- });
- Map.Entry me = (Map.Entry) list.get(list.size() - 1);
- for (int i = 0; i < list.size(); i++)
- {
- float alpha = Float.valueOf(list.get(i).toString().split("=")[1]);
- if (alpha < 180) me = (Map.Entry) list.get(i);
- }
- int rgb = (Integer) me.getKey();
- return rgb;
- }
-
- public static boolean isGray(int[] rgbArr)
- {
- int rgbSum = rgbArr[0] + rgbArr[1] + rgbArr[2];
- if (rgbSum > 0 && rgbSum < 256 * 3) { return false; }
- return true;
- }
-
+ /**
+ * @param ingot
+ * @return
+ */
public ItemStack getModifiedItemStack(ItemStack ingot)
{
ItemStack itemstack = new ItemStack(this);
@@ -307,14 +208,18 @@ public class ItemMoltenMetalBucket extends Item
return itemstack;
}
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
public String getItemStackDisplayName(ItemStack stack)
{
- if (JewelryNBT.ingot(stack) != null)
- {
+ if (JewelryNBT.ingot(stack) != null){
ItemStack ingot = JewelryNBT.ingot(stack);
if (Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_glass) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.stained_hardened_clay) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.wool) || Item.getIdFromItem(ingot.getItem()) == Block.getIdFromBlock(Blocks.carpet)) ingot.setItemDamage(15 - ingot.getItemDamage());
- return (StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim() + " " + ingot.getDisplayName().replace("Ingot", " ").trim();
+ return StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name").trim() + " " + ingot.getDisplayName().replace("Ingot", " ").trim();
}
- return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim() + " Metal";
+ return ("" + StatCollector.translateToLocal(getUnlocalizedNameInefficiently(stack) + ".name")).trim() + " Metal";
}
}
diff --git a/java/darkknight/jewelrycraft/item/ItemNecklace.java b/java/darkknight/jewelrycraft/item/ItemNecklace.java
index e5905b5..9668589 100644
--- a/java/darkknight/jewelrycraft/item/ItemNecklace.java
+++ b/java/darkknight/jewelrycraft/item/ItemNecklace.java
@@ -7,17 +7,30 @@ import darkknight.jewelrycraft.util.JewelryNBT;
public class ItemNecklace extends ItemBaseJewelry
{
- public IIcon gem;
+ public IIcon gem;
+
+ /**
+ *
+ */
public ItemNecklace()
- {
- }
+ {}
+ /**
+ * @param iconRegister
+ */
+ @Override
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:necklace");
gem = iconRegister.registerIcon("jewelrycraft:jewelNecklace");
}
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
public IIcon getIcon(ItemStack stack, int pass)
{
if (pass == 0) return itemIcon;
diff --git a/java/darkknight/jewelrycraft/item/ItemRing.java b/java/darkknight/jewelrycraft/item/ItemRing.java
index af546fe..4472324 100644
--- a/java/darkknight/jewelrycraft/item/ItemRing.java
+++ b/java/darkknight/jewelrycraft/item/ItemRing.java
@@ -7,18 +7,30 @@ import darkknight.jewelrycraft.util.JewelryNBT;
public class ItemRing extends ItemBaseJewelry
{
- public IIcon gem;
+ public IIcon gem;
+
+ /**
+ *
+ */
public ItemRing()
- {
- super();
- }
+ {}
+ /**
+ * @param iconRegister
+ */
+ @Override
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:ring");
gem = iconRegister.registerIcon("jewelrycraft:jewelRing");
}
+ /**
+ * @param stack
+ * @param pass
+ * @return
+ */
+ @Override
public IIcon getIcon(ItemStack stack, int pass)
{
if (pass == 0) return itemIcon;
diff --git a/java/darkknight/jewelrycraft/item/ItemThiefGloves.java b/java/darkknight/jewelrycraft/item/ItemThiefGloves.java
index 658e9cc..e9cbeca 100644
--- a/java/darkknight/jewelrycraft/item/ItemThiefGloves.java
+++ b/java/darkknight/jewelrycraft/item/ItemThiefGloves.java
@@ -3,7 +3,6 @@ package darkknight.jewelrycraft.item;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
-
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityVillager;
@@ -18,73 +17,76 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
-
import org.lwjgl.input.Keyboard;
-
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
import darkknight.jewelrycraft.util.PlayerUtils;
public class ItemThiefGloves extends Item
{
public Random rand = new Random();
+ /**
+ *
+ */
public ItemThiefGloves()
{
super();
- this.setCreativeTab(CreativeTabs.tabTools);
- this.setMaxStackSize(1);
- this.setMaxDamage(10);
+ setCreativeTab(CreativeTabs.tabTools);
+ setMaxStackSize(1);
+ setMaxDamage(10);
}
+ /**
+ * @param stack
+ * @param player
+ * @param entity
+ * @return
+ */
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity)
{
- if (entity instanceof EntityVillager)
- {
- EntityVillager villager = (EntityVillager) entity;
- int wealth = (Integer) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "wealth", "field_70956_bz");
- MerchantRecipeList buyingList = (MerchantRecipeList) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "buyingList", "field_70963_i");
+ if (entity instanceof EntityVillager){
+ EntityVillager villager = (EntityVillager)entity;
+ int wealth = (Integer)ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "wealth", "field_70956_bz");
+ MerchantRecipeList buyingList = (MerchantRecipeList)ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "buyingList", "field_70963_i");
int chance = 5;
boolean areOtherVillagersAround = false, canTheySeeYou = false;
AxisAlignedBB axisalignedbb = villager.boundingBox.expand(4.0D, 4.0D, 4.0D);
List entities = villager.worldObj.getEntitiesWithinAABBExcludingEntity(villager, axisalignedbb);
- for (Object s : entities)
- if (s instanceof EntityVillager)
- {
+ for(Object s: entities)
+ if (s instanceof EntityVillager){
areOtherVillagersAround = true;
chance += rand.nextInt(2);
- if (((EntityVillager) s).canEntityBeSeen(player))
- {
+ if (((EntityVillager)s).canEntityBeSeen(player)){
chance += 2;
canTheySeeYou = true;
}
}
if (villager.canEntityBeSeen(player)) chance += 5;
- if (player.isPotionActive(Potion.invisibility)) chance -= (0.8 * chance);
+ if (player.isPotionActive(Potion.invisibility)) chance -= 0.8 * chance;
if (player.capabilities.isCreativeMode) chance = 1;
int steal = rand.nextInt(chance);
- NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
- if (buyingList != null)
- {
+ if (steal == 0){
+ villager.dropItem(Items.emerald, wealth);
+ ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 0, "wealth", "field_70956_bz");
+ }
+ if (buyingList != null){
Iterator<?> iterator = buyingList.iterator();
- if (steal == 0)
- {
- while (iterator.hasNext())
- {
- MerchantRecipe recipe = (MerchantRecipe) iterator.next();
- int toolUses = (Integer) ReflectionHelper.getPrivateValue(MerchantRecipe.class, recipe, "toolUses", "field_77400_d");
+ if (steal == 0){
+ while (iterator.hasNext()){
+ MerchantRecipe recipe = (MerchantRecipe)iterator.next();
+ int toolUses = (Integer)ReflectionHelper.getPrivateValue(MerchantRecipe.class, recipe, "toolUses", "field_77400_d");
int quantity;
if (recipe.getItemToSell().isStackable()) quantity = recipe.getItemToSell().stackSize * (7 - toolUses);
else quantity = recipe.getItemToSell().stackSize;
ItemStack s = new ItemStack(recipe.getItemToSell().getItem(), quantity, recipe.getItemToSell().getItemDamage());
s.setTagCompound(recipe.getItemToSell().getTagCompound());
- if (player.inventory.addItemStackToInventory(s))
- ;
+ if (player.inventory.addItemStackToInventory(s)) ;
else villager.entityDropItem(s, 0);
- if (playerInfo.hasKey("cursePoints")) playerInfo.setInteger("cursePoints", playerInfo.getInteger("cursePoints") + 5);
- else playerInfo.setInteger("cursePoints", 5);
+ JewelrycraftUtil.addCursePoints(player, 5);
player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + ": Hmmm... I seem to have lost my " + s.getDisplayName() + "!"));
stack.damageItem(1, player);
}
@@ -95,64 +97,69 @@ public class ItemThiefGloves extends Item
player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "Those who steal but don't get caught get rewarded and do not."));
player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "Embrace the path you have gone, for the darkness will not"));
player.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE + "dwell on."));
- }
- else
- {
- if (player.isPotionActive(Potion.invisibility)) player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " sensed a strange presence around him, making him cling on to his items. You didn't get anything."));
- else
- {
- if (areOtherVillagersAround)
- {
- if (!canTheySeeYou) player.addChatMessage(new ChatComponentText("As he was passing by, a random villager caught you trying to steal from Villager #" + villager.getProfession() + "."));
- else player.addChatMessage(new ChatComponentText("A villager nearby saw you trying to steal from Villager #" + villager.getProfession() + "."));
+ }else{
+ stack.damageItem(1, player);
+ JewelrycraftUtil.addCursePoints(player, 25);
+ if (player.isPotionActive(Potion.invisibility)){
+ player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " sensed a strange presence around him, making him cling on to his items. You didn't get anything."));
+ }
+ else{
+ if (areOtherVillagersAround){
+ if (!canTheySeeYou){
+ player.addChatMessage(new ChatComponentText("As he was passing by, a random villager caught you trying to steal from Villager #" + villager.getProfession() + "."));
+ player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " curses you for the attempt."));
+ return true;
+ }
+ else{
+ player.addChatMessage(new ChatComponentText("A villager nearby saw you trying to steal from Villager #" + villager.getProfession() + "."));
+ player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " curses you for the attempt."));
+ return true;
+ }
+ }else{
+ player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " caught you trying to steal from him."));
+ player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " curses you for the attempt."));
+ return true;
}
- else player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " caught you trying to steal from him."));
- player.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + " curses you for the attempt."));
}
- stack.damageItem(1, player);
- if (playerInfo.hasKey("cursePoints")) playerInfo.setInteger("cursePoints", playerInfo.getInteger("cursePoints") + 25);
- else playerInfo.setInteger("cursePoints", 25);
}
}
- if (steal == 0)
- {
- villager.dropItem(Items.emerald, wealth);
- ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 0, "wealth", "field_70956_bz");
- }
return true;
- }
- else
- {
- return super.itemInteractionForEntity(stack, player, entity);
- }
+ }else return super.itemInteractionForEntity(stack, player, entity);
}
+ /**
+ * @param stack
+ * @param player
+ * @param list
+ * @param par4
+ */
@Override
- @SuppressWarnings("unchecked")
- public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings("rawtypes") List list, boolean par4)
+ @SuppressWarnings ("unchecked")
+ public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings ("rawtypes") List list, boolean par4)
{
if (!shouldAddAdditionalInfo()) list.add(EnumChatFormatting.GRAY + additionalInfoInstructions());
- else
- {
+ else{
list.add(EnumChatFormatting.GRAY + "Right click with the gloves,");
list.add(EnumChatFormatting.GRAY + "while sneaking, on a villager");
list.add(EnumChatFormatting.GRAY + "to steal his stuff.");
}
}
+ /**
+ * @return
+ */
public static boolean shouldAddAdditionalInfo()
{
- if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
- {
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { return true; }
- }
+ if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) return true;
return false;
}
+ /**
+ * @return
+ */
public static String additionalInfoInstructions()
{
String message = "\247oPress \247b<SHIFT>\2477\247o for more information.";
return message;
}
-
}
diff --git a/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java b/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java
new file mode 100644
index 0000000..3162061
--- /dev/null
+++ b/java/darkknight/jewelrycraft/model/ItemStackModelRenderer.java
@@ -0,0 +1,71 @@
+package darkknight.jewelrycraft.model;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.client.renderer.entity.RenderItem;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.texture.TextureManager;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+
+/**
+ * @author Paul Fulham (pau101)
+ */
+public class ItemStackModelRenderer extends ModelRenderer
+{
+ private RenderItem renderItem;
+ private TextureManager textureManager;
+ private ResourceLocation resetResourceLocation;
+ private EntityItem entityItem;
+ private Minecraft mc;
+
+ /**
+ * @param modelBase
+ * @param resetResourceLocation
+ */
+ public ItemStackModelRenderer(ModelBase modelBase, ResourceLocation resetResourceLocation)
+ {
+ super(modelBase);
+ renderItem = (RenderItem)RenderManager.instance.entityRenderMap.get(EntityItem.class);
+ textureManager = (mc = Minecraft.getMinecraft()).getTextureManager();
+ this.resetResourceLocation = resetResourceLocation;
+ }
+
+ /**
+ * @param itemStack
+ */
+ public void setItemStack(ItemStack itemStack)
+ {
+ if (itemStack == null || itemStack.getItem() == null) entityItem = null;
+ else{
+ entityItem = new EntityItem(null, 0, 0, 0, itemStack);
+ entityItem.hoverStart = 0;
+ }
+ }
+
+ /**
+ * @param scale
+ */
+ @Override
+ public void render(float scale)
+ {
+ if (!isHidden && showModel && entityItem != null){
+ if (textureManager == null) textureManager = mc.getTextureManager();
+ GL11.glPushMatrix();
+ GL11.glTranslatef(offsetX, offsetY, offsetZ);
+ GL11.glTranslatef(rotationPointX * scale, rotationPointY * scale, rotationPointZ * scale);
+ GL11.glRotatef(rotateAngleZ * (180 / (float)Math.PI), 0, 0, 1);
+ GL11.glRotatef(rotateAngleY * (180 / (float)Math.PI), 0, 1, 0);
+ GL11.glRotatef(rotateAngleX * (180 / (float)Math.PI), 1, 0, 0);
+ boolean fancyGraphics = mc.gameSettings.fancyGraphics;
+ mc.gameSettings.fancyGraphics = true;
+ renderItem.doRender(entityItem, 0, 0, 0, 0, 0);
+ mc.gameSettings.fancyGraphics = fancyGraphics;
+ GL11.glPopMatrix();
+ textureManager.bindTexture(resetResourceLocation);
+ }
+ }
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/model/ModelDisplayer.java b/java/darkknight/jewelrycraft/model/ModelDisplayer.java
index 3a45957..065b87b 100644
--- a/java/darkknight/jewelrycraft/model/ModelDisplayer.java
+++ b/java/darkknight/jewelrycraft/model/ModelDisplayer.java
@@ -1,10 +1,9 @@
package darkknight.jewelrycraft.model;
-import org.lwjgl.opengl.GL11;
-
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
+import org.lwjgl.opengl.GL11;
public class ModelDisplayer extends ModelBase
{
@@ -35,11 +34,13 @@ public class ModelDisplayer extends ModelBase
ModelRenderer Ring311;
ModelRenderer Ring312;
+ /**
+ *
+ */
public ModelDisplayer()
{
textureWidth = 64;
textureHeight = 32;
-
Base = new ModelRenderer(this, 0, 0);
Base.addBox(0F, 0F, 0F, 16, 3, 16);
Base.setRotationPoint(-8F, 21F, -8F);
@@ -192,6 +193,16 @@ public class ModelDisplayer extends ModelBase
setRotation(Ring312, 0F, 0F, 0F);
}
+ /**
+ * @param entity
+ * @param f
+ * @param f1
+ * @param f2
+ * @param f3
+ * @param f4
+ * @param f5
+ */
+ @Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
GL11.glPushMatrix();
@@ -226,6 +237,12 @@ public class ModelDisplayer extends ModelBase
GL11.glPopMatrix();
}
+ /**
+ * @param model
+ * @param x
+ * @param y
+ * @param z
+ */
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
@@ -233,9 +250,16 @@ public class ModelDisplayer extends ModelBase
model.rotateAngleZ = z;
}
+ /**
+ * @param f
+ * @param f1
+ * @param f2
+ * @param f3
+ * @param f4
+ * @param f5
+ */
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
}
-
}
diff --git a/java/darkknight/jewelrycraft/model/ModelHalfHeart.java b/java/darkknight/jewelrycraft/model/ModelHalfHeart.java
new file mode 100644
index 0000000..1c0bb97
--- /dev/null
+++ b/java/darkknight/jewelrycraft/model/ModelHalfHeart.java
@@ -0,0 +1,497 @@
+// Date: 2/13/2015 8:30:06 PM
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+package darkknight.jewelrycraft.model;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+
+public class ModelHalfHeart extends ModelBase
+{
+ // fields
+ ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22;
+ ModelRenderer f1, f3, f4, f5, f6, f7, f8, f9, f13, f14, f16, f17, f19, f20, f21, f22, f23, f24, f25, f26;
+ ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b19, b20, b21, b23, b24, b25, b26;
+
+ public ModelHalfHeart()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ s1 = new ModelRenderer(this, 0, 16);
+ s1.addBox(0F, 0F, 0F, 1, 1, 1);
+ s1.setRotationPoint(1F, 13F, 0F);
+ s1.setTextureSize(64, 32);
+ s1.mirror = true;
+ setRotation(s1, 0F, 0F, 0F);
+ s2 = new ModelRenderer(this, 0, 16);
+ s2.addBox(0F, 0F, 0F, 2, 1, 1);
+ s2.setRotationPoint(-1F, 23F, 0F);
+ s2.setTextureSize(64, 32);
+ s2.mirror = true;
+ setRotation(s2, 0F, 0F, 0F);
+ s3 = new ModelRenderer(this, 0, 16);
+ s3.addBox(0F, 0F, 0F, 2, 1, 1);
+ s3.setRotationPoint(2F, 12F, 0F);
+ s3.setTextureSize(64, 32);
+ s3.mirror = true;
+ setRotation(s3, 0F, 0F, 0F);
+ s4 = new ModelRenderer(this, 0, 16);
+ s4.addBox(0F, 0F, 0F, 1, 1, 1);
+ s4.setRotationPoint(1F, 22F, 0F);
+ s4.setTextureSize(64, 32);
+ s4.mirror = true;
+ setRotation(s4, 0F, 0F, 0F);
+ s5 = new ModelRenderer(this, 0, 16);
+ s5.addBox(0F, 0F, 0F, 1, 1, 1);
+ s5.setRotationPoint(4F, 13F, 0F);
+ s5.setTextureSize(64, 32);
+ s5.mirror = true;
+ setRotation(s5, 0F, 0F, 0F);
+ s6 = new ModelRenderer(this, 0, 16);
+ s6.addBox(0F, 0F, 0F, 1, 1, 1);
+ s6.setRotationPoint(5F, 18F, 0F);
+ s6.setTextureSize(64, 32);
+ s6.mirror = true;
+ setRotation(s6, 0F, 0F, 0F);
+ s7 = new ModelRenderer(this, 0, 16);
+ s7.addBox(0F, 0F, 0F, 1, 1, 1);
+ s7.setRotationPoint(5F, 14F, 0F);
+ s7.setTextureSize(64, 32);
+ s7.mirror = true;
+ setRotation(s7, 0F, 0F, 0F);
+ s8 = new ModelRenderer(this, 0, 16);
+ s8.addBox(0F, 0F, 0F, 1, 1, 1);
+ s8.setRotationPoint(-2F, 22F, 0F);
+ s8.setTextureSize(64, 32);
+ s8.mirror = true;
+ setRotation(s8, 0F, 0F, 0F);
+ s9 = new ModelRenderer(this, 0, 16);
+ s9.addBox(0F, 0F, 0F, 1, 1, 1);
+ s9.setRotationPoint(-2F, 13F, 0F);
+ s9.setTextureSize(64, 32);
+ s9.mirror = true;
+ setRotation(s9, 0F, 0F, 0F);
+ s10 = new ModelRenderer(this, 0, 16);
+ s10.addBox(0F, 0F, 0F, 1, 1, 1);
+ s10.setRotationPoint(-6F, 18F, 0F);
+ s10.setTextureSize(64, 32);
+ s10.mirror = true;
+ setRotation(s10, 0F, 0F, 0F);
+ s11 = new ModelRenderer(this, 0, 16);
+ s11.addBox(0F, 0F, 0F, 2, 1, 1);
+ s11.setRotationPoint(-4F, 12F, 0F);
+ s11.setTextureSize(64, 32);
+ s11.mirror = true;
+ setRotation(s11, 0F, 0F, 0F);
+ s12 = new ModelRenderer(this, 0, 16);
+ s12.addBox(0F, 0F, 0F, 1, 1, 1);
+ s12.setRotationPoint(-3F, 21F, 0F);
+ s12.setTextureSize(64, 32);
+ s12.mirror = true;
+ setRotation(s12, 0F, 0F, 0F);
+ s13 = new ModelRenderer(this, 0, 16);
+ s13.addBox(0F, 0F, 0F, 1, 1, 1);
+ s13.setRotationPoint(-5F, 13F, 0F);
+ s13.setTextureSize(64, 32);
+ s13.mirror = true;
+ setRotation(s13, 0F, 0F, 0F);
+ s14 = new ModelRenderer(this, 0, 16);
+ s14.addBox(0F, 0F, 0F, 1, 1, 1);
+ s14.setRotationPoint(-4F, 20F, 0F);
+ s14.setTextureSize(64, 32);
+ s14.mirror = true;
+ setRotation(s14, 0F, 0F, 0F);
+ s15 = new ModelRenderer(this, 0, 16);
+ s15.addBox(0F, 0F, 0F, 1, 1, 1);
+ s15.setRotationPoint(-6F, 14F, 0F);
+ s15.setTextureSize(64, 32);
+ s15.mirror = true;
+ setRotation(s15, 0F, 0F, 0F);
+ s16 = new ModelRenderer(this, 0, 16);
+ s16.addBox(0F, 0F, 0F, 1, 1, 1);
+ s16.setRotationPoint(-5F, 19F, 0F);
+ s16.setTextureSize(64, 32);
+ s16.mirror = true;
+ setRotation(s16, 0F, 0F, 0F);
+ s17 = new ModelRenderer(this, 0, 16);
+ s17.addBox(0F, 0F, 0F, 2, 1, 1);
+ s17.setRotationPoint(-1F, 14F, 0F);
+ s17.setTextureSize(64, 32);
+ s17.mirror = true;
+ setRotation(s17, 0F, 0F, 0F);
+ s18 = new ModelRenderer(this, 0, 16);
+ s18.addBox(0F, 0F, 0F, 1, 1, 1);
+ s18.setRotationPoint(2F, 21F, 0F);
+ s18.setTextureSize(64, 32);
+ s18.mirror = true;
+ setRotation(s18, 0F, 0F, 0F);
+ s19 = new ModelRenderer(this, 0, 16);
+ s19.addBox(0F, 0F, 0F, 1, 3, 1);
+ s19.setRotationPoint(6F, 15F, 0F);
+ s19.setTextureSize(64, 32);
+ s19.mirror = true;
+ setRotation(s19, 0F, 0F, 0F);
+ s20 = new ModelRenderer(this, 0, 16);
+ s20.addBox(0F, 0F, 0F, 1, 1, 1);
+ s20.setRotationPoint(3F, 20F, 0F);
+ s20.setTextureSize(64, 32);
+ s20.mirror = true;
+ setRotation(s20, 0F, 0F, 0F);
+ s21 = new ModelRenderer(this, 0, 16);
+ s21.addBox(0F, 0F, 0F, 1, 3, 1);
+ s21.setRotationPoint(-7F, 15F, 0F);
+ s21.setTextureSize(64, 32);
+ s21.mirror = true;
+ setRotation(s21, 0F, 0F, 0F);
+ s22 = new ModelRenderer(this, 0, 16);
+ s22.addBox(0F, 0F, 0F, 1, 1, 1);
+ s22.setRotationPoint(4F, 19F, 0F);
+ s22.setTextureSize(64, 32);
+ s22.mirror = true;
+ setRotation(s22, 0F, 0F, 0F);
+ f1 = new ModelRenderer(this, 0, 0);
+ f1.addBox(0F, 0F, 0F, 1, 1, 1);
+ f1.setRotationPoint(-1F, 22F, 1F);
+ f1.setTextureSize(64, 32);
+ f1.mirror = true;
+ setRotation(f1, 0F, 0F, 0F);
+ f3 = new ModelRenderer(this, 0, 0);
+ f3.addBox(0F, 0F, 0F, 6, 3, 1);
+ f3.setRotationPoint(-6F, 15F, 1F);
+ f3.setTextureSize(64, 32);
+ f3.mirror = true;
+ setRotation(f3, 0F, 0F, 0F);
+ f4 = new ModelRenderer(this, 0, 0);
+ f4.addBox(0F, 0F, 0F, 7, 1, 1);
+ f4.setRotationPoint(-5F, 18F, 1F);
+ f4.setTextureSize(64, 32);
+ f4.mirror = true;
+ setRotation(f4, 0F, 0F, 0F);
+ f5 = new ModelRenderer(this, 0, 0);
+ f5.addBox(0F, 0F, 0F, 5, 1, 1);
+ f5.setRotationPoint(-4F, 19F, 1F);
+ f5.setTextureSize(64, 32);
+ f5.mirror = true;
+ setRotation(f5, 0F, 0F, 0F);
+ f6 = new ModelRenderer(this, 0, 0);
+ f6.addBox(0F, 0F, 0F, 3, 1, 1);
+ f6.setRotationPoint(-3F, 20F, 1F);
+ f6.setTextureSize(64, 32);
+ f6.mirror = true;
+ setRotation(f6, 0F, 0F, 0F);
+ f7 = new ModelRenderer(this, 0, 0);
+ f7.addBox(0F, 0F, 0F, 3, 1, 1);
+ f7.setRotationPoint(-2F, 21F, 1F);
+ f7.setTextureSize(64, 32);
+ f7.mirror = true;
+ setRotation(f7, 0F, 0F, 0F);
+ f8 = new ModelRenderer(this, 0, 0);
+ f8.addBox(0F, 0F, 0F, 4, 1, 1);
+ f8.setRotationPoint(-5F, 14F, 1F);
+ f8.setTextureSize(64, 32);
+ f8.mirror = true;
+ setRotation(f8, 0F, 0F, 0F);
+ f9 = new ModelRenderer(this, 0, 0);
+ f9.addBox(0F, 0F, 0F, 2, 1, 1);
+ f9.setRotationPoint(-4F, 13F, 1F);
+ f9.setTextureSize(64, 32);
+ f9.mirror = true;
+ setRotation(f9, 0F, 0F, 0F);
+ f13 = new ModelRenderer(this, 0, 0);
+ f13.addBox(0F, 0F, 0F, 5, 1, 1);
+ f13.setRotationPoint(-5F, 16F, 2F);
+ f13.setTextureSize(64, 32);
+ f13.mirror = true;
+ setRotation(f13, 0F, 0F, 0F);
+ f14 = new ModelRenderer(this, 0, 0);
+ f14.addBox(0F, 0F, 0F, 6, 1, 1);
+ f14.setRotationPoint(-5F, 17F, 2F);
+ f14.setTextureSize(64, 32);
+ f14.mirror = true;
+ setRotation(f14, 0F, 0F, 0F);
+ f16 = new ModelRenderer(this, 0, 0);
+ f16.addBox(0F, 0F, 0F, 3, 1, 1);
+ f16.setRotationPoint(-4F, 15F, 2F);
+ f16.setTextureSize(64, 32);
+ f16.mirror = true;
+ setRotation(f16, 0F, 0F, 0F);
+ f17 = new ModelRenderer(this, 0, 0);
+ f17.addBox(0F, 0F, 0F, 1, 1, 1);
+ f17.setRotationPoint(-3F, 14F, 2F);
+ f17.setTextureSize(64, 32);
+ f17.mirror = true;
+ setRotation(f17, 0F, 0F, 0F);
+ f19 = new ModelRenderer(this, 0, 0);
+ f19.addBox(0F, 0F, 0F, 1, 1, 1);
+ f19.setRotationPoint(-3F, 15F, 3F);
+ f19.setTextureSize(64, 32);
+ f19.mirror = true;
+ setRotation(f19, 0F, 0F, 0F);
+ f20 = new ModelRenderer(this, 0, 0);
+ f20.addBox(0F, 0F, 0F, 3, 1, 1);
+ f20.setRotationPoint(-4F, 16F, 3F);
+ f20.setTextureSize(64, 32);
+ f20.mirror = true;
+ setRotation(f20, 0F, 0F, 0F);
+ f21 = new ModelRenderer(this, 0, 0);
+ f21.addBox(0F, 0F, 0F, 2, 1, 1);
+ f21.setRotationPoint(-2F, 20F, 2F);
+ f21.setTextureSize(64, 32);
+ f21.mirror = true;
+ setRotation(f21, 0F, 0F, 0F);
+ f22 = new ModelRenderer(this, 0, 0);
+ f22.addBox(0F, 0F, 0F, 4, 1, 1);
+ f22.setRotationPoint(-3F, 19F, 2F);
+ f22.setTextureSize(64, 32);
+ f22.mirror = true;
+ setRotation(f22, 0F, 0F, 0F);
+ f23 = new ModelRenderer(this, 0, 0);
+ f23.addBox(0F, 0F, 0F, 6, 1, 1);
+ f23.setRotationPoint(-4F, 18F, 2F);
+ f23.setTextureSize(64, 32);
+ f23.mirror = true;
+ setRotation(f23, 0F, 0F, 0F);
+ f24 = new ModelRenderer(this, 0, 0);
+ f24.addBox(0F, 0F, 0F, 3, 1, 1);
+ f24.setRotationPoint(-3F, 17F, 3F);
+ f24.setTextureSize(64, 32);
+ f24.mirror = true;
+ setRotation(f24, 0F, 0F, 0F);
+ f25 = new ModelRenderer(this, 0, 0);
+ f25.addBox(0F, 0F, 0F, 2, 1, 1);
+ f25.setRotationPoint(-2F, 18F, 3F);
+ f25.setTextureSize(64, 32);
+ f25.mirror = true;
+ setRotation(f25, 0F, 0F, 0F);
+ f26 = new ModelRenderer(this, 0, 0);
+ f26.addBox(0F, 0F, 0F, 1, 1, 1);
+ f26.setRotationPoint(-1F, 19F, 3F);
+ f26.setTextureSize(64, 32);
+ f26.mirror = true;
+ setRotation(f26, 0F, 0F, 0F);
+ b1 = new ModelRenderer(this, 0, 0);
+ b1.addBox(0F, 0F, 0F, 2, 1, 1);
+ b1.setRotationPoint(-2F, 20F, -2F);
+ b1.setTextureSize(64, 32);
+ b1.mirror = true;
+ setRotation(b1, 0F, 0F, 0F);
+ b2 = new ModelRenderer(this, 0, 0);
+ b2.addBox(0F, 0F, 0F, 1, 1, 1);
+ b2.setRotationPoint(-3F, 14F, -2F);
+ b2.setTextureSize(64, 32);
+ b2.mirror = true;
+ setRotation(b2, 0F, 0F, 0F);
+ b3 = new ModelRenderer(this, 0, 0);
+ b3.addBox(0F, 0F, 0F, 7, 1, 1);
+ b3.setRotationPoint(-6F, 15F, -1F);
+ b3.setTextureSize(64, 32);
+ b3.mirror = true;
+ setRotation(b3, 0F, 0F, 0F);
+ b4 = new ModelRenderer(this, 0, 0);
+ b4.addBox(0F, 0F, 0F, 6, 1, 1);
+ b4.setRotationPoint(-4F, 18F, -2F);
+ b4.setTextureSize(64, 32);
+ b4.mirror = true;
+ setRotation(b4, 0F, 0F, 0F);
+ b5 = new ModelRenderer(this, 0, 0);
+ b5.addBox(0F, 0F, 0F, 4, 1, 1);
+ b5.setRotationPoint(-3F, 19F, -2F);
+ b5.setTextureSize(64, 32);
+ b5.mirror = true;
+ setRotation(b5, 0F, 0F, 0F);
+ b6 = new ModelRenderer(this, 0, 0);
+ b6.addBox(0F, 0F, 0F, 3, 1, 1);
+ b6.setRotationPoint(-4F, 15F, -2F);
+ b6.setTextureSize(64, 32);
+ b6.mirror = true;
+ setRotation(b6, 0F, 0F, 0F);
+ b7 = new ModelRenderer(this, 0, 0);
+ b7.addBox(0F, 0F, 0F, 6, 2, 1);
+ b7.setRotationPoint(-6F, 16F, -1F);
+ b7.setTextureSize(64, 32);
+ b7.mirror = true;
+ setRotation(b7, 0F, 0F, 0F);
+ b8 = new ModelRenderer(this, 0, 0);
+ b8.addBox(0F, 0F, 0F, 1, 1, 1);
+ b8.setRotationPoint(-1F, 22F, -1F);
+ b8.setTextureSize(64, 32);
+ b8.mirror = true;
+ setRotation(b8, 0F, 0F, 0F);
+ b9 = new ModelRenderer(this, 0, 0);
+ b9.addBox(0F, 0F, 0F, 1, 1, 1);
+ b9.setRotationPoint(-3F, 15F, -3F);
+ b9.setTextureSize(64, 32);
+ b9.mirror = true;
+ setRotation(b9, 0F, 0F, 0F);
+ b10 = new ModelRenderer(this, 0, 0);
+ b10.addBox(0F, 0F, 0F, 2, 1, 1);
+ b10.setRotationPoint(-2F, 18F, -3F);
+ b10.setTextureSize(64, 32);
+ b10.mirror = true;
+ setRotation(b10, 0F, 0F, 0F);
+ b11 = new ModelRenderer(this, 0, 0);
+ b11.addBox(0F, 0F, 0F, 5, 2, 1);
+ b11.setRotationPoint(-5F, 16F, -2F);
+ b11.setTextureSize(64, 32);
+ b11.mirror = true;
+ setRotation(b11, 0F, 0F, 0F);
+ b12 = new ModelRenderer(this, 0, 0);
+ b12.addBox(0F, 0F, 0F, 3, 1, 1);
+ b12.setRotationPoint(-4F, 16F, -3F);
+ b12.setTextureSize(64, 32);
+ b12.mirror = true;
+ setRotation(b12, 0F, 0F, 0F);
+ b13 = new ModelRenderer(this, 0, 0);
+ b13.addBox(0F, 0F, 0F, 1, 1, 1);
+ b13.setRotationPoint(0F, 19F, 0F);
+ b13.setTextureSize(64, 32);
+ b13.mirror = true;
+ setRotation(b13, 0F, 0F, 0F);
+ b15 = new ModelRenderer(this, 0, 0);
+ b15.addBox(0F, 0F, 0F, 2, 1, 1);
+ b15.setRotationPoint(-3F, 17F, -3F);
+ b15.setTextureSize(64, 32);
+ b15.mirror = true;
+ setRotation(b15, 0F, 0F, 0F);
+ b16 = new ModelRenderer(this, 0, 0);
+ b16.addBox(0F, 0F, 0F, 2, 1, 1);
+ b16.setRotationPoint(-1F, 19F, -3F);
+ b16.setTextureSize(64, 32);
+ b16.mirror = true;
+ setRotation(b16, 0F, 0F, 0F);
+ b19 = new ModelRenderer(this, 0, 0);
+ b19.addBox(0F, 0F, 0F, 2, 1, 1);
+ b19.setRotationPoint(-4F, 13F, -1F);
+ b19.setTextureSize(64, 32);
+ b19.mirror = true;
+ setRotation(b19, 0F, 0F, 0F);
+ b20 = new ModelRenderer(this, 0, 0);
+ b20.addBox(0F, 0F, 0F, 1, 8, 1);
+ b20.setRotationPoint(-1F, 15F, 0F);
+ b20.setTextureSize(64, 32);
+ b20.mirror = true;
+ setRotation(b20, 0F, 0F, 0F);
+ b21 = new ModelRenderer(this, 0, 0);
+ b21.addBox(0F, 0F, 0F, 4, 1, 1);
+ b21.setRotationPoint(-5F, 14F, -1F);
+ b21.setTextureSize(64, 32);
+ b21.mirror = true;
+ setRotation(b21, 0F, 0F, 0F);
+ b23 = new ModelRenderer(this, 0, 0);
+ b23.addBox(0F, 0F, 0F, 6, 1, 1);
+ b23.setRotationPoint(-5F, 18F, -1F);
+ b23.setTextureSize(64, 32);
+ b23.mirror = true;
+ setRotation(b23, 0F, 0F, 0F);
+ b24 = new ModelRenderer(this, 0, 0);
+ b24.addBox(0F, 0F, 0F, 4, 1, 1);
+ b24.setRotationPoint(-4F, 19F, -1F);
+ b24.setTextureSize(64, 32);
+ b24.mirror = true;
+ setRotation(b24, 0F, 0F, 0F);
+ b25 = new ModelRenderer(this, 0, 0);
+ b25.addBox(0F, 0F, 0F, 3, 1, 1);
+ b25.setRotationPoint(-3F, 20F, -1F);
+ b25.setTextureSize(64, 32);
+ b25.mirror = true;
+ setRotation(b25, 0F, 0F, 0F);
+ b26 = new ModelRenderer(this, 0, 0);
+ b26.addBox(0F, 0F, 0F, 3, 1, 1);
+ b26.setRotationPoint(-2F, 21F, -1F);
+ b26.setTextureSize(64, 32);
+ b26.mirror = true;
+ setRotation(b26, 0F, 0F, 0F);
+ b14 = new ModelRenderer(this, 0, 0);
+ b14.addBox(0F, 0F, 0F, 1, 1, 1);
+ b14.setRotationPoint(0F, 16F, 0F);
+ b14.setTextureSize(64, 32);
+ b14.mirror = true;
+ setRotation(b14, 0F, 0F, 0F);
+ }
+
+ public void render(Entity entity, float angle1, float angle2, float angle3, float angle4, float angle5, float angle6)
+ {
+ super.render(entity, angle1, angle2, angle3, angle4, angle5, angle6);
+ setRotationAngles(angle1, angle2, angle3, angle4, angle5, angle6);
+ s1.render(angle6);
+ s2.render(angle6);
+ s3.render(angle6);
+ s4.render(angle6);
+ s5.render(angle6);
+ s6.render(angle6);
+ s7.render(angle6);
+ s8.render(angle6);
+ s9.render(angle6);
+ s10.render(angle6);
+ s11.render(angle6);
+ s12.render(angle6);
+ s13.render(angle6);
+ s14.render(angle6);
+ s15.render(angle6);
+ s16.render(angle6);
+ s17.render(angle6);
+ s18.render(angle6);
+ s19.render(angle6);
+ s20.render(angle6);
+ s21.render(angle6);
+ s22.render(angle6);
+ f1.render(angle6);
+ f3.render(angle6);
+ f4.render(angle6);
+ f5.render(angle6);
+ f6.render(angle6);
+ f7.render(angle6);
+ f8.render(angle6);
+ f9.render(angle6);
+ f13.render(angle6);
+ f14.render(angle6);
+ f16.render(angle6);
+ f17.render(angle6);
+ f19.render(angle6);
+ f20.render(angle6);
+ f21.render(angle6);
+ f22.render(angle6);
+ f23.render(angle6);
+ f24.render(angle6);
+ f25.render(angle6);
+ f26.render(angle6);
+ b1.render(angle6);
+ b2.render(angle6);
+ b3.render(angle6);
+ b4.render(angle6);
+ b5.render(angle6);
+ b6.render(angle6);
+ b7.render(angle6);
+ b8.render(angle6);
+ b9.render(angle6);
+ b10.render(angle6);
+ b11.render(angle6);
+ b12.render(angle6);
+ b13.render(angle6);
+ b15.render(angle6);
+ b16.render(angle6);
+ b19.render(angle6);
+ b20.render(angle6);
+ b21.render(angle6);
+ b23.render(angle6);
+ b24.render(angle6);
+ b25.render(angle6);
+ b26.render(angle6);
+ b14.render(angle6);
+ }
+
+ private void setRotation(ModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
+ {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
+ }
+}
diff --git a/java/darkknight/jewelrycraft/model/ModelHandPedestal.java b/java/darkknight/jewelrycraft/model/ModelHandPedestal.java
index 072d186..312bd17 100644
--- a/java/darkknight/jewelrycraft/model/ModelHandPedestal.java
+++ b/java/darkknight/jewelrycraft/model/ModelHandPedestal.java
@@ -2,147 +2,145 @@ package darkknight.jewelrycraft.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
-import net.minecraft.entity.Entity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import com.pau101.util.CubicBezier;
+import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
+/**
+ * @author Paul Fulham (pau101)
+ */
public class ModelHandPedestal extends ModelBase
{
- //fields
- ModelRenderer finger1;
- ModelRenderer finger2;
- ModelRenderer finger3;
- ModelRenderer finger4;
- ModelRenderer finger5;
- ModelRenderer finger6;
- ModelRenderer finger7;
- ModelRenderer finger8;
- ModelRenderer finger9;
- ModelRenderer finger10;
- ModelRenderer Base;
- ModelRenderer Base2;
- ModelRenderer Base3;
- ModelRenderer Palm;
+ protected ModelRenderer plinth;
+ protected ModelRenderer base;
+ protected ModelRenderer shaft;
+ private ModelRenderer palm;
+ private ModelRenderer[] fingers;
+ private ModelRenderer thumb;
+ private ItemStackModelRenderer heldItemStack;
+ private CubicBezier easeInOut;
- public ModelHandPedestal()
+ /**
+ * @param resetResourceLocation
+ */
+ public ModelHandPedestal(ResourceLocation resetResourceLocation)
{
- textureWidth = 64;
- textureHeight = 32;
-
- finger1 = new ModelRenderer(this, 0, 0);
- finger1.addBox(-1.5F, -4.5F, -9F, 2, 4, 3);
- finger1.setRotationPoint(0F, 10F, 0F);
- finger1.setTextureSize(64, 32);
- finger1.mirror = true;
- setRotation(finger1, -0.2094395F, 0.7853982F, 0F);
- finger2 = new ModelRenderer(this, 0, 0);
- finger2.addBox(-2.5F, -4.5F, -9F, 2, 4, 3);
- finger2.setRotationPoint(0F, 10F, 0F);
- finger2.setTextureSize(64, 32);
- finger2.mirror = true;
- setRotation(finger2, -0.2094395F, 0.0872665F, 0F);
- finger3 = new ModelRenderer(this, 0, 0);
- finger3.addBox(0.5F, -4.5F, -9F, 2, 4, 3);
- finger3.setRotationPoint(0F, 10F, 0F);
- finger3.setTextureSize(64, 32);
- finger3.mirror = true;
- setRotation(finger3, -0.2094395F, -0.0872665F, 0F);
- finger4 = new ModelRenderer(this, 0, 0);
- finger4.addBox(-0.5F, -4.5F, -9F, 2, 4, 3);
- finger4.setRotationPoint(0F, 10F, 0F);
- finger4.setTextureSize(64, 32);
- finger4.mirror = true;
- setRotation(finger4, -0.2094395F, -0.7853982F, 0F);
- finger5 = new ModelRenderer(this, 0, 0);
- finger5.addBox(-1F, -4.5F, 5F, 2, 4, 3);
- finger5.setRotationPoint(0F, 10F, 0F);
- finger5.setTextureSize(64, 32);
- finger5.mirror = true;
- setRotation(finger5, 0.2094395F, 0F, 0F);
- finger6 = new ModelRenderer(this, 0, 0);
- finger6.addBox(-1.5F, -0.5F, -9F, 2, 3, 5);
- finger6.setRotationPoint(0F, 10F, 0F);
- finger6.setTextureSize(64, 32);
- finger6.mirror = true;
- setRotation(finger6, -0.2094395F, 0.7853982F, 0F);
- finger7 = new ModelRenderer(this, 0, 0);
- finger7.addBox(-2.5F, -0.5F, -9F, 2, 3, 5);
- finger7.setRotationPoint(0F, 10F, 0F);
- finger7.setTextureSize(64, 32);
- finger7.mirror = true;
- setRotation(finger7, -0.2094395F, 0.0872665F, 0F);
- finger8 = new ModelRenderer(this, 0, 0);
- finger8.addBox(0.5F, -0.5F, -9F, 2, 3, 5);
- finger8.setRotationPoint(0F, 10F, 0F);
- finger8.setTextureSize(64, 32);
- finger8.mirror = true;
- setRotation(finger8, -0.2094395F, -0.0872665F, 0F);
- finger9 = new ModelRenderer(this, 0, 0);
- finger9.addBox(-0.5F, -0.5F, -9F, 2, 3, 5);
- finger9.setRotationPoint(0F, 10F, 0F);
- finger9.setTextureSize(64, 32);
- finger9.mirror = true;
- setRotation(finger9, -0.2094395F, -0.7853982F, 0F);
- finger10 = new ModelRenderer(this, 0, 0);
- finger10.addBox(-1F, -0.5F, 3F, 2, 3, 5);
- finger10.setRotationPoint(0F, 10F, 0F);
- finger10.setTextureSize(64, 32);
- finger10.mirror = true;
- setRotation(finger10, 0.2094395F, 0F, 0F);
- Base = new ModelRenderer(this, 0, 0);
- Base.addBox(-6F, 4F, -6F, 12, 4, 12);
- Base.setRotationPoint(0F, 16F, 0F);
- Base.setTextureSize(64, 32);
- Base.mirror = true;
- setRotation(Base, 0F, 0F, 0F);
- Base2 = new ModelRenderer(this, 0, 0);
- Base2.addBox(-4F, 0F, -4F, 8, 4, 8);
- Base2.setRotationPoint(0F, 16F, 0F);
- Base2.setTextureSize(64, 32);
- Base2.mirror = true;
- setRotation(Base2, 0F, 0F, 0F);
- Base3 = new ModelRenderer(this, 0, 0);
- Base3.addBox(-3F, -4F, -3F, 6, 4, 6);
- Base3.setRotationPoint(0F, 16F, 0F);
- Base3.setTextureSize(64, 32);
- Base3.mirror = true;
- setRotation(Base3, 0F, 0F, 0F);
- Palm = new ModelRenderer(this, 0, 0);
- Palm.addBox(-4F, -8F, -4F, 8, 4, 8);
- Palm.setRotationPoint(0F, 16F, 0F);
- Palm.setTextureSize(64, 32);
- Palm.mirror = true;
- setRotation(Palm, 0F, 0F, 0F);
+ initPedestalRenderers();
+ plinth.setRotationPoint(0, 16, 0);
+ plinth.addChild(base);
+ base.addChild(shaft);
+ initHandModelRenderers(resetResourceLocation);
+ initCubicBeziers();
}
- public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
+ /**
+ *
+ */
+ protected void initPedestalRenderers()
{
- super.render(entity, f, f1, f2, f3, f4, f5);
- setRotationAngles(f, f1, f2, f3, f4, f5);
- finger1.render(f5);
- finger2.render(f5);
- finger3.render(f5);
- finger4.render(f5);
- finger5.render(f5);
- finger6.render(f5);
- finger7.render(f5);
- finger8.render(f5);
- finger9.render(f5);
- finger10.render(f5);
- Base.render(f5);
- Base2.render(f5);
- Base3.render(f5);
- Palm.render(f5);
+ plinth = createModelRenderer(0, 0).addBox(-6, 4, -6, 12, 4, 12);
+ base = createModelRenderer(0, 0).addBox(-4, 0, -4, 8, 4, 8);
+ shaft = createModelRenderer(0, 0).addBox(-3, -4, -3, 6, 4, 6);
}
- private void setRotation(ModelRenderer model, float x, float y, float z)
+ /**
+ *
+ */
+ private void initCubicBeziers()
{
- model.rotateAngleX = x;
- model.rotateAngleY = y;
- model.rotateAngleZ = z;
+ easeInOut = new CubicBezier(0.4F, 0, 0.6F, 1);
}
- public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
+ /**
+ * @param textureOffsetX
+ * @param textureOffsetY
+ * @return
+ */
+ protected final ModelRenderer createModelRenderer(int textureOffsetX, int textureOffsetY)
{
- super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
+ ModelRenderer modelRenderer = new ModelRenderer(this, textureOffsetX, textureOffsetY);
+ modelRenderer.setTextureSize(textureWidth, textureHeight);
+ return modelRenderer;
}
-}
+ /**
+ * @return
+ */
+ private ModelRenderer createPhalanges()
+ {
+ return createModelRenderer(0, 0).addBox(-1, -1.5F, 0, 2, 3, 5).addBox(-1, -5.5F, 2, 2, 4, 3);
+ }
+
+ /**
+ * @param resetResourceLocation
+ */
+ private void initHandModelRenderers(ResourceLocation resetResourceLocation)
+ {
+ palm = createModelRenderer(0, 0).addBox(-4, -8, -4, 8, 4, 8);
+ shaft.addChild(palm);
+ int fingerCount = 4;
+ fingers = new ModelRenderer[fingerCount];
+ for(int i = 0; i < fingerCount; i++){
+ ModelRenderer phalanges = createPhalanges();
+ float theta = (i / (float)fingerCount - 0.5F + 1F / fingerCount / 2) * ((float)Math.PI * 0.6F);
+ phalanges.rotateAngleY = theta;
+ phalanges.setRotationPoint(MathHelper.sin(theta) * 5, -5.75F, MathHelper.cos(theta) * 5 - 1);
+ fingers[i] = phalanges;
+ palm.addChild(phalanges);
+ }
+ thumb = createPhalanges();
+ thumb.rotateAngleY = (float)Math.PI;
+ thumb.rotationPointY = -5.75F;
+ thumb.rotationPointZ = -3;
+ palm.addChild(thumb);
+ heldItemStack = new ItemStackModelRenderer(this, resetResourceLocation);
+ heldItemStack.rotateAngleZ = (float)Math.PI;
+ heldItemStack.rotateAngleX = (float)(Math.PI / 2);
+ heldItemStack.setRotationPoint(0, -8.5F, -3.5F);
+ palm.addChild(heldItemStack);
+ }
+
+ /**
+ * @param pedestal
+ * @param partialRenderTicks
+ * @param scale
+ */
+ public void render(TileEntityHandPedestal pedestal, float partialRenderTicks, float scale)
+ {
+ handleHeldItemStack(pedestal.getHeldItemStack());
+ float gripScale = pedestal.getGripScale();
+ float grip = easeInOut.eval(pedestal.getGrip(partialRenderTicks)) * gripScale;
+ float rotateAngleX = (float)(grip * 75 * Math.PI / 180 + (1 - grip) * 10 * Math.PI / 180);
+ float rotateAngleZ = (float)(grip * 20 * Math.PI / 180);
+ for(int i = 0; i < fingers.length; i++){
+ ModelRenderer phalanges = fingers[i];
+ phalanges.rotateAngleX = rotateAngleX;
+ phalanges.rotateAngleZ = rotateAngleZ * (2F / (fingers.length - 1) * i - 1);
+ }
+ thumb.rotateAngleX = (float)(grip * 60 * Math.PI / 180 + (1 - grip) * 10 * Math.PI / 180);
+ thumb.rotateAngleZ = rotateAngleZ;
+ plinth.render(scale);
+ }
+
+ /**
+ * @param itemStack
+ */
+ private void handleHeldItemStack(ItemStack itemStack)
+ {
+ heldItemStack.setItemStack(itemStack);
+ if (itemStack != null){
+ Item item = itemStack.getItem();
+ if (item instanceof ItemBlock){
+ heldItemStack.rotateAngleX = 0;
+ heldItemStack.rotationPointZ = 0;
+ }else{
+ heldItemStack.rotateAngleX = (float)(Math.PI / 2);
+ heldItemStack.rotationPointZ = -3.5F;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/model/ModelHeart.java b/java/darkknight/jewelrycraft/model/ModelHeart.java
new file mode 100644
index 0000000..0c6a438
--- /dev/null
+++ b/java/darkknight/jewelrycraft/model/ModelHeart.java
@@ -0,0 +1,539 @@
+// Date: 2/13/2015 8:18:43 PM
+// Template version 1.1
+// Java generated by Techne
+// Keep in mind that you still need to fill in some blanks
+// - ZeuX
+package darkknight.jewelrycraft.model;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+
+public class ModelHeart extends ModelBase
+{
+ // fields
+ ModelRenderer s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20, s21, s22;
+ ModelRenderer f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26;
+ ModelRenderer b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26;
+
+ public ModelHeart()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+ s1 = new ModelRenderer(this, 0, 16);
+ s1.addBox(0F, 0F, 0F, 1, 1, 1);
+ s1.setRotationPoint(1F, 13F, 0F);
+ s1.setTextureSize(64, 32);
+ s1.mirror = true;
+ setRotation(s1, 0F, 0F, 0F);
+ s2 = new ModelRenderer(this, 0, 16);
+ s2.addBox(0F, 0F, 0F, 2, 1, 1);
+ s2.setRotationPoint(-1F, 23F, 0F);
+ s2.setTextureSize(64, 32);
+ s2.mirror = true;
+ setRotation(s2, 0F, 0F, 0F);
+ s3 = new ModelRenderer(this, 0, 16);
+ s3.addBox(0F, 0F, 0F, 2, 1, 1);
+ s3.setRotationPoint(2F, 12F, 0F);
+ s3.setTextureSize(64, 32);
+ s3.mirror = true;
+ setRotation(s3, 0F, 0F, 0F);
+ s4 = new ModelRenderer(this, 0, 16);
+ s4.addBox(0F, 0F, 0F, 1, 1, 1);
+ s4.setRotationPoint(1F, 22F, 0F);
+ s4.setTextureSize(64, 32);
+ s4.mirror = true;
+ setRotation(s4, 0F, 0F, 0F);
+ s5 = new ModelRenderer(this, 0, 16);
+ s5.addBox(0F, 0F, 0F, 1, 1, 1);
+ s5.setRotationPoint(4F, 13F, 0F);
+ s5.setTextureSize(64, 32);
+ s5.mirror = true;
+ setRotation(s5, 0F, 0F, 0F);
+ s6 = new ModelRenderer(this, 0, 16);
+ s6.addBox(0F, 0F, 0F, 1, 1, 1);
+ s6.setRotationPoint(5F, 18F, 0F);
+ s6.setTextureSize(64, 32);
+ s6.mirror = true;
+ setRotation(s6, 0F, 0F, 0F);
+ s7 = new ModelRenderer(this, 0, 16);
+ s7.addBox(0F, 0F, 0F, 1, 1, 1);
+ s7.setRotationPoint(5F, 14F, 0F);
+ s7.setTextureSize(64, 32);
+ s7.mirror = true;
+ setRotation(s7, 0F, 0F, 0F);
+ s8 = new ModelRenderer(this, 0, 16);
+ s8.addBox(0F, 0F, 0F, 1, 1, 1);
+ s8.setRotationPoint(-2F, 22F, 0F);
+ s8.setTextureSize(64, 32);
+ s8.mirror = true;
+ setRotation(s8, 0F, 0F, 0F);
+ s9 = new ModelRenderer(this, 0, 16);
+ s9.addBox(0F, 0F, 0F, 1, 1, 1);
+ s9.setRotationPoint(-2F, 13F, 0F);
+ s9.setTextureSize(64, 32);
+ s9.mirror = true;
+ setRotation(s9, 0F, 0F, 0F);
+ s10 = new ModelRenderer(this, 0, 16);
+ s10.addBox(0F, 0F, 0F, 1, 1, 1);
+ s10.setRotationPoint(-6F, 18F, 0F);
+ s10.setTextureSize(64, 32);
+ s10.mirror = true;
+ setRotation(s10, 0F, 0F, 0F);
+ s11 = new ModelRenderer(this, 0, 16);
+ s11.addBox(0F, 0F, 0F, 2, 1, 1);
+ s11.setRotationPoint(-4F, 12F, 0F);
+ s11.setTextureSize(64, 32);
+ s11.mirror = true;
+ setRotation(s11, 0F, 0F, 0F);
+ s12 = new ModelRenderer(this, 0, 16);
+ s12.addBox(0F, 0F, 0F, 1, 1, 1);
+ s12.setRotationPoint(-3F, 21F, 0F);
+ s12.setTextureSize(64, 32);
+ s12.mirror = true;
+ setRotation(s12, 0F, 0F, 0F);
+ s13 = new ModelRenderer(this, 0, 16);
+ s13.addBox(0F, 0F, 0F, 1, 1, 1);
+ s13.setRotationPoint(-5F, 13F, 0F);
+ s13.setTextureSize(64, 32);
+ s13.mirror = true;
+ setRotation(s13, 0F, 0F, 0F);
+ s14 = new ModelRenderer(this, 0, 16);
+ s14.addBox(0F, 0F, 0F, 1, 1, 1);
+ s14.setRotationPoint(-4F, 20F, 0F);
+ s14.setTextureSize(64, 32);
+ s14.mirror = true;
+ setRotation(s14, 0F, 0F, 0F);
+ s15 = new ModelRenderer(this, 0, 16);
+ s15.addBox(0F, 0F, 0F, 1, 1, 1);
+ s15.setRotationPoint(-6F, 14F, 0F);
+ s15.setTextureSize(64, 32);
+ s15.mirror = true;
+ setRotation(s15, 0F, 0F, 0F);
+ s16 = new ModelRenderer(this, 0, 16);
+ s16.addBox(0F, 0F, 0F, 1, 1, 1);
+ s16.setRotationPoint(-5F, 19F, 0F);
+ s16.setTextureSize(64, 32);
+ s16.mirror = true;
+ setRotation(s16, 0F, 0F, 0F);
+ s17 = new ModelRenderer(this, 0, 16);
+ s17.addBox(0F, 0F, 0F, 2, 1, 1);
+ s17.setRotationPoint(-1F, 14F, 0F);
+ s17.setTextureSize(64, 32);
+ s17.mirror = true;
+ setRotation(s17, 0F, 0F, 0F);
+ s18 = new ModelRenderer(this, 0, 16);
+ s18.addBox(0F, 0F, 0F, 1, 1, 1);
+ s18.setRotationPoint(2F, 21F, 0F);
+ s18.setTextureSize(64, 32);
+ s18.mirror = true;
+ setRotation(s18, 0F, 0F, 0F);
+ s19 = new ModelRenderer(this, 0, 16);
+ s19.addBox(0F, 0F, 0F, 1, 3, 1);
+ s19.setRotationPoint(6F, 15F, 0F);
+ s19.setTextureSize(64, 32);
+ s19.mirror = true;
+ setRotation(s19, 0F, 0F, 0F);
+ s20 = new ModelRenderer(this, 0, 16);
+ s20.addBox(0F, 0F, 0F, 1, 1, 1);
+ s20.setRotationPoint(3F, 20F, 0F);
+ s20.setTextureSize(64, 32);
+ s20.mirror = true;
+ setRotation(s20, 0F, 0F, 0F);
+ s21 = new ModelRenderer(this, 0, 16);
+ s21.addBox(0F, 0F, 0F, 1, 3, 1);
+ s21.setRotationPoint(-7F, 15F, 0F);
+ s21.setTextureSize(64, 32);
+ s21.mirror = true;
+ setRotation(s21, 0F, 0F, 0F);
+ s22 = new ModelRenderer(this, 0, 16);
+ s22.addBox(0F, 0F, 0F, 1, 1, 1);
+ s22.setRotationPoint(4F, 19F, 0F);
+ s22.setTextureSize(64, 32);
+ s22.mirror = true;
+ setRotation(s22, 0F, 0F, 0F);
+ f1 = new ModelRenderer(this, 0, 0);
+ f1.addBox(0F, 0F, 0F, 2, 1, 1);
+ f1.setRotationPoint(-1F, 22F, 1F);
+ f1.setTextureSize(64, 32);
+ f1.mirror = true;
+ setRotation(f1, 0F, 0F, 0F);
+ f2 = new ModelRenderer(this, 0, 0);
+ f2.addBox(0F, 0F, 0F, 2, 1, 1);
+ f2.setRotationPoint(2F, 13F, 1F);
+ f2.setTextureSize(64, 32);
+ f2.mirror = true;
+ setRotation(f2, 0F, 0F, 0F);
+ f3 = new ModelRenderer(this, 0, 0);
+ f3.addBox(0F, 0F, 0F, 12, 3, 1);
+ f3.setRotationPoint(-6F, 15F, 1F);
+ f3.setTextureSize(64, 32);
+ f3.mirror = true;
+ setRotation(f3, 0F, 0F, 0F);
+ f4 = new ModelRenderer(this, 0, 0);
+ f4.addBox(0F, 0F, 0F, 10, 1, 1);
+ f4.setRotationPoint(-5F, 18F, 1F);
+ f4.setTextureSize(64, 32);
+ f4.mirror = true;
+ setRotation(f4, 0F, 0F, 0F);
+ f5 = new ModelRenderer(this, 0, 0);
+ f5.addBox(0F, 0F, 0F, 8, 1, 1);
+ f5.setRotationPoint(-4F, 19F, 1F);
+ f5.setTextureSize(64, 32);
+ f5.mirror = true;
+ setRotation(f5, 0F, 0F, 0F);
+ f6 = new ModelRenderer(this, 0, 0);
+ f6.addBox(0F, 0F, 0F, 6, 1, 1);
+ f6.setRotationPoint(-3F, 20F, 1F);
+ f6.setTextureSize(64, 32);
+ f6.mirror = true;
+ setRotation(f6, 0F, 0F, 0F);
+ f7 = new ModelRenderer(this, 0, 0);
+ f7.addBox(0F, 0F, 0F, 4, 1, 1);
+ f7.setRotationPoint(-2F, 21F, 1F);
+ f7.setTextureSize(64, 32);
+ f7.mirror = true;
+ setRotation(f7, 0F, 0F, 0F);
+ f8 = new ModelRenderer(this, 0, 0);
+ f8.addBox(0F, 0F, 0F, 4, 1, 1);
+ f8.setRotationPoint(-5F, 14F, 1F);
+ f8.setTextureSize(64, 32);
+ f8.mirror = true;
+ setRotation(f8, 0F, 0F, 0F);
+ f9 = new ModelRenderer(this, 0, 0);
+ f9.addBox(0F, 0F, 0F, 2, 1, 1);
+ f9.setRotationPoint(-4F, 13F, 1F);
+ f9.setTextureSize(64, 32);
+ f9.mirror = true;
+ setRotation(f9, 0F, 0F, 0F);
+ f10 = new ModelRenderer(this, 0, 0);
+ f10.addBox(0F, 0F, 0F, 4, 1, 1);
+ f10.setRotationPoint(1F, 14F, 1F);
+ f10.setTextureSize(64, 32);
+ f10.mirror = true;
+ setRotation(f10, 0F, 0F, 0F);
+ f11 = new ModelRenderer(this, 0, 0);
+ f11.addBox(0F, 0F, 0F, 1, 1, 1);
+ f11.setRotationPoint(2F, 15F, 3F);
+ f11.setTextureSize(64, 32);
+ f11.mirror = true;
+ setRotation(f11, 0F, 0F, 0F);
+ f12 = new ModelRenderer(this, 0, 0);
+ f12.addBox(0F, 0F, 0F, 1, 1, 1);
+ f12.setRotationPoint(2F, 14F, 2F);
+ f12.setTextureSize(64, 32);
+ f12.mirror = true;
+ setRotation(f12, 0F, 0F, 0F);
+ f13 = new ModelRenderer(this, 0, 0);
+ f13.addBox(0F, 0F, 0F, 3, 1, 1);
+ f13.setRotationPoint(1F, 15F, 2F);
+ f13.setTextureSize(64, 32);
+ f13.mirror = true;
+ setRotation(f13, 0F, 0F, 0F);
+ f14 = new ModelRenderer(this, 0, 0);
+ f14.addBox(0F, 0F, 0F, 10, 1, 1);
+ f14.setRotationPoint(-5F, 16F, 2F);
+ f14.setTextureSize(64, 32);
+ f14.mirror = true;
+ setRotation(f14, 0F, 0F, 0F);
+ f15 = new ModelRenderer(this, 0, 0);
+ f15.addBox(0F, 0F, 0F, 10, 1, 1);
+ f15.setRotationPoint(-5F, 17F, 2F);
+ f15.setTextureSize(64, 32);
+ f15.mirror = true;
+ setRotation(f15, 0F, 0F, 0F);
+ f16 = new ModelRenderer(this, 0, 0);
+ f16.addBox(0F, 0F, 0F, 3, 1, 1);
+ f16.setRotationPoint(-4F, 15F, 2F);
+ f16.setTextureSize(64, 32);
+ f16.mirror = true;
+ setRotation(f16, 0F, 0F, 0F);
+ f17 = new ModelRenderer(this, 0, 0);
+ f17.addBox(0F, 0F, 0F, 1, 1, 1);
+ f17.setRotationPoint(-3F, 14F, 2F);
+ f17.setTextureSize(64, 32);
+ f17.mirror = true;
+ setRotation(f17, 0F, 0F, 0F);
+ f18 = new ModelRenderer(this, 0, 0);
+ f18.addBox(0F, 0F, 0F, 3, 1, 1);
+ f18.setRotationPoint(1F, 16F, 3F);
+ f18.setTextureSize(64, 32);
+ f18.mirror = true;
+ setRotation(f18, 0F, 0F, 0F);
+ f19 = new ModelRenderer(this, 0, 0);
+ f19.addBox(0F, 0F, 0F, 1, 1, 1);
+ f19.setRotationPoint(-3F, 15F, 3F);
+ f19.setTextureSize(64, 32);
+ f19.mirror = true;
+ setRotation(f19, 0F, 0F, 0F);
+ f20 = new ModelRenderer(this, 0, 0);
+ f20.addBox(0F, 0F, 0F, 3, 1, 1);
+ f20.setRotationPoint(-4F, 16F, 3F);
+ f20.setTextureSize(64, 32);
+ f20.mirror = true;
+ setRotation(f20, 0F, 0F, 0F);
+ f21 = new ModelRenderer(this, 0, 0);
+ f21.addBox(0F, 0F, 0F, 4, 1, 1);
+ f21.setRotationPoint(-2F, 20F, 2F);
+ f21.setTextureSize(64, 32);
+ f21.mirror = true;
+ setRotation(f21, 0F, 0F, 0F);
+ f22 = new ModelRenderer(this, 0, 0);
+ f22.addBox(0F, 0F, 0F, 6, 1, 1);
+ f22.setRotationPoint(-3F, 19F, 2F);
+ f22.setTextureSize(64, 32);
+ f22.mirror = true;
+ setRotation(f22, 0F, 0F, 0F);
+ f23 = new ModelRenderer(this, 0, 0);
+ f23.addBox(0F, 0F, 0F, 8, 1, 1);
+ f23.setRotationPoint(-4F, 18F, 2F);
+ f23.setTextureSize(64, 32);
+ f23.mirror = true;
+ setRotation(f23, 0F, 0F, 0F);
+ f24 = new ModelRenderer(this, 0, 0);
+ f24.addBox(0F, 0F, 0F, 6, 1, 1);
+ f24.setRotationPoint(-3F, 17F, 3F);
+ f24.setTextureSize(64, 32);
+ f24.mirror = true;
+ setRotation(f24, 0F, 0F, 0F);
+ f25 = new ModelRenderer(this, 0, 0);
+ f25.addBox(0F, 0F, 0F, 4, 1, 1);
+ f25.setRotationPoint(-2F, 18F, 3F);
+ f25.setTextureSize(64, 32);
+ f25.mirror = true;
+ setRotation(f25, 0F, 0F, 0F);
+ f26 = new ModelRenderer(this, 0, 0);
+ f26.addBox(0F, 0F, 0F, 2, 1, 1);
+ f26.setRotationPoint(-1F, 19F, 3F);
+ f26.setTextureSize(64, 32);
+ f26.mirror = true;
+ setRotation(f26, 0F, 0F, 0F);
+ b1 = new ModelRenderer(this, 0, 0);
+ b1.addBox(0F, 0F, 0F, 4, 1, 1);
+ b1.setRotationPoint(-2F, 20F, -2F);
+ b1.setTextureSize(64, 32);
+ b1.mirror = true;
+ setRotation(b1, 0F, 0F, 0F);
+ b2 = new ModelRenderer(this, 0, 0);
+ b2.addBox(0F, 0F, 0F, 1, 1, 1);
+ b2.setRotationPoint(-3F, 14F, -2F);
+ b2.setTextureSize(64, 32);
+ b2.mirror = true;
+ setRotation(b2, 0F, 0F, 0F);
+ b3 = new ModelRenderer(this, 0, 0);
+ b3.addBox(0F, 0F, 0F, 10, 1, 1);
+ b3.setRotationPoint(-5F, 17F, -2F);
+ b3.setTextureSize(64, 32);
+ b3.mirror = true;
+ setRotation(b3, 0F, 0F, 0F);
+ b4 = new ModelRenderer(this, 0, 0);
+ b4.addBox(0F, 0F, 0F, 8, 1, 1);
+ b4.setRotationPoint(-4F, 18F, -2F);
+ b4.setTextureSize(64, 32);
+ b4.mirror = true;
+ setRotation(b4, 0F, 0F, 0F);
+ b5 = new ModelRenderer(this, 0, 0);
+ b5.addBox(0F, 0F, 0F, 6, 1, 1);
+ b5.setRotationPoint(-3F, 19F, -2F);
+ b5.setTextureSize(64, 32);
+ b5.mirror = true;
+ setRotation(b5, 0F, 0F, 0F);
+ b6 = new ModelRenderer(this, 0, 0);
+ b6.addBox(0F, 0F, 0F, 3, 1, 1);
+ b6.setRotationPoint(-4F, 15F, -2F);
+ b6.setTextureSize(64, 32);
+ b6.mirror = true;
+ setRotation(b6, 0F, 0F, 0F);
+ b7 = new ModelRenderer(this, 0, 0);
+ b7.addBox(0F, 0F, 0F, 3, 1, 1);
+ b7.setRotationPoint(1F, 15F, -2F);
+ b7.setTextureSize(64, 32);
+ b7.mirror = true;
+ setRotation(b7, 0F, 0F, 0F);
+ b8 = new ModelRenderer(this, 0, 0);
+ b8.addBox(0F, 0F, 0F, 1, 1, 1);
+ b8.setRotationPoint(2F, 14F, -2F);
+ b8.setTextureSize(64, 32);
+ b8.mirror = true;
+ setRotation(b8, 0F, 0F, 0F);
+ b9 = new ModelRenderer(this, 0, 0);
+ b9.addBox(0F, 0F, 0F, 1, 1, 1);
+ b9.setRotationPoint(-3F, 15F, -3F);
+ b9.setTextureSize(64, 32);
+ b9.mirror = true;
+ setRotation(b9, 0F, 0F, 0F);
+ b10 = new ModelRenderer(this, 0, 0);
+ b10.addBox(0F, 0F, 0F, 4, 1, 1);
+ b10.setRotationPoint(-2F, 18F, -3F);
+ b10.setTextureSize(64, 32);
+ b10.mirror = true;
+ setRotation(b10, 0F, 0F, 0F);
+ b11 = new ModelRenderer(this, 0, 0);
+ b11.addBox(0F, 0F, 0F, 10, 1, 1);
+ b11.setRotationPoint(-5F, 16F, -2F);
+ b11.setTextureSize(64, 32);
+ b11.mirror = true;
+ setRotation(b11, 0F, 0F, 0F);
+ b12 = new ModelRenderer(this, 0, 0);
+ b12.addBox(0F, 0F, 0F, 3, 1, 1);
+ b12.setRotationPoint(-4F, 16F, -3F);
+ b12.setTextureSize(64, 32);
+ b12.mirror = true;
+ setRotation(b12, 0F, 0F, 0F);
+ b13 = new ModelRenderer(this, 0, 0);
+ b13.addBox(0F, 0F, 0F, 3, 1, 1);
+ b13.setRotationPoint(1F, 16F, -3F);
+ b13.setTextureSize(64, 32);
+ b13.mirror = true;
+ setRotation(b13, 0F, 0F, 0F);
+ b14 = new ModelRenderer(this, 0, 0);
+ b14.addBox(0F, 0F, 0F, 1, 1, 1);
+ b14.setRotationPoint(2F, 15F, -3F);
+ b14.setTextureSize(64, 32);
+ b14.mirror = true;
+ setRotation(b14, 0F, 0F, 0F);
+ b15 = new ModelRenderer(this, 0, 0);
+ b15.addBox(0F, 0F, 0F, 6, 1, 1);
+ b15.setRotationPoint(-3F, 17F, -3F);
+ b15.setTextureSize(64, 32);
+ b15.mirror = true;
+ setRotation(b15, 0F, 0F, 0F);
+ b16 = new ModelRenderer(this, 0, 0);
+ b16.addBox(0F, 0F, 0F, 2, 1, 1);
+ b16.setRotationPoint(-1F, 19F, -3F);
+ b16.setTextureSize(64, 32);
+ b16.mirror = true;
+ setRotation(b16, 0F, 0F, 0F);
+ b17 = new ModelRenderer(this, 0, 0);
+ b17.addBox(0F, 0F, 0F, 2, 1, 1);
+ b17.setRotationPoint(2F, 13F, -1F);
+ b17.setTextureSize(64, 32);
+ b17.mirror = true;
+ setRotation(b17, 0F, 0F, 0F);
+ b18 = new ModelRenderer(this, 0, 0);
+ b18.addBox(0F, 0F, 0F, 4, 1, 1);
+ b18.setRotationPoint(1F, 14F, -1F);
+ b18.setTextureSize(64, 32);
+ b18.mirror = true;
+ setRotation(b18, 0F, 0F, 0F);
+ b19 = new ModelRenderer(this, 0, 0);
+ b19.addBox(0F, 0F, 0F, 2, 1, 1);
+ b19.setRotationPoint(-4F, 13F, -1F);
+ b19.setTextureSize(64, 32);
+ b19.mirror = true;
+ setRotation(b19, 0F, 0F, 0F);
+ b20 = new ModelRenderer(this, 0, 0);
+ b20.addBox(0F, 0F, 0F, 2, 1, 1);
+ b20.setRotationPoint(-1F, 22F, -1F);
+ b20.setTextureSize(64, 32);
+ b20.mirror = true;
+ setRotation(b20, 0F, 0F, 0F);
+ b21 = new ModelRenderer(this, 0, 0);
+ b21.addBox(0F, 0F, 0F, 4, 1, 1);
+ b21.setRotationPoint(-5F, 14F, -1F);
+ b21.setTextureSize(64, 32);
+ b21.mirror = true;
+ setRotation(b21, 0F, 0F, 0F);
+ b22 = new ModelRenderer(this, 0, 0);
+ b22.addBox(0F, 0F, 0F, 12, 3, 1);
+ b22.setRotationPoint(-6F, 15F, -1F);
+ b22.setTextureSize(64, 32);
+ b22.mirror = true;
+ setRotation(b22, 0F, 0F, 0F);
+ b23 = new ModelRenderer(this, 0, 0);
+ b23.addBox(0F, 0F, 0F, 10, 1, 1);
+ b23.setRotationPoint(-5F, 18F, -1F);
+ b23.setTextureSize(64, 32);
+ b23.mirror = true;
+ setRotation(b23, 0F, 0F, 0F);
+ b24 = new ModelRenderer(this, 0, 0);
+ b24.addBox(0F, 0F, 0F, 8, 1, 1);
+ b24.setRotationPoint(-4F, 19F, -1F);
+ b24.setTextureSize(64, 32);
+ b24.mirror = true;
+ setRotation(b24, 0F, 0F, 0F);
+ b25 = new ModelRenderer(this, 0, 0);
+ b25.addBox(0F, 0F, 0F, 6, 1, 1);
+ b25.setRotationPoint(-3F, 20F, -1F);
+ b25.setTextureSize(64, 32);
+ b25.mirror = true;
+ setRotation(b25, 0F, 0F, 0F);
+ b26 = new ModelRenderer(this, 0, 0);
+ b26.addBox(0F, 0F, 0F, 4, 1, 1);
+ b26.setRotationPoint(-2F, 21F, -1F);
+ b26.setTextureSize(64, 32);
+ b26.mirror = true;
+ setRotation(b26, 0F, 0F, 0F);
+ }
+
+ public void render(Entity entity, float angle1, float angle2, float angle3, float angle4, float angle5, float angle6)
+ {
+ super.render(entity, angle1, angle2, angle3, angle4, angle5, angle6);
+ setRotationAngles(angle1, angle2, angle3, angle4, angle5, angle6);
+ s1.render(angle6); s2.render(angle6); s3.render(angle6); s4.render(angle6); s5.render(angle6); s6.render(angle6); s7.render(angle6); s8.render(angle6); s9.render(angle6); s10.render(angle6); s11.render(angle6); s12.render(angle6); s13.render(angle6); s14.render(angle6); s15.render(angle6); s16.render(angle6); s17.render(angle6); s18.render(angle6); s19.render(angle6); s20.render(angle6); s21.render(angle6); s22.render(angle6);
+ f1.render(angle6);
+ f2.render(angle6);
+ f3.render(angle6);
+ f4.render(angle6);
+ f5.render(angle6);
+ f6.render(angle6);
+ f7.render(angle6);
+ f8.render(angle6);
+ f9.render(angle6);
+ f10.render(angle6);
+ f11.render(angle6);
+ f12.render(angle6);
+ f13.render(angle6);
+ f14.render(angle6);
+ f15.render(angle6);
+ f16.render(angle6);
+ f17.render(angle6);
+ f18.render(angle6);
+ f19.render(angle6);
+ f20.render(angle6);
+ f21.render(angle6);
+ f22.render(angle6);
+ f23.render(angle6);
+ f24.render(angle6);
+ f25.render(angle6);
+ f26.render(angle6);
+ b1.render(angle6);
+ b2.render(angle6);
+ b3.render(angle6);
+ b4.render(angle6);
+ b5.render(angle6);
+ b6.render(angle6);
+ b7.render(angle6);
+ b8.render(angle6);
+ b9.render(angle6);
+ b10.render(angle6);
+ b11.render(angle6);
+ b12.render(angle6);
+ b13.render(angle6);
+ b14.render(angle6);
+ b15.render(angle6);
+ b16.render(angle6);
+ b17.render(angle6);
+ b18.render(angle6);
+ b19.render(angle6);
+ b20.render(angle6);
+ b21.render(angle6);
+ b22.render(angle6);
+ b23.render(angle6);
+ b24.render(angle6);
+ b25.render(angle6);
+ b26.render(angle6);
+ }
+
+ private void setRotation(ModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
+ {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
+ }
+}
diff --git a/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java b/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java
index 8724040..66be543 100644
--- a/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java
+++ b/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java
@@ -21,11 +21,13 @@ public class ModelJewlersCraftingBench extends ModelBase
ModelRenderer Support7;
ModelRenderer Support8;
+ /**
+ *
+ */
public ModelJewlersCraftingBench()
{
textureWidth = 64;
textureHeight = 32;
-
Leg1 = new ModelRenderer(this, 0, 0);
Leg1.addBox(0F, 0F, 0F, 2, 10, 2);
Leg1.setRotationPoint(-6F, 14F, 4F);
@@ -106,6 +108,16 @@ public class ModelJewlersCraftingBench extends ModelBase
setRotation(Support8, 0F, 0F, 0F);
}
+ /**
+ * @param entity
+ * @param f
+ * @param f1
+ * @param f2
+ * @param f3
+ * @param f4
+ * @param f5
+ */
+ @Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
@@ -125,6 +137,12 @@ public class ModelJewlersCraftingBench extends ModelBase
Support8.render(f5);
}
+ /**
+ * @param model
+ * @param x
+ * @param y
+ * @param z
+ */
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
@@ -132,9 +150,16 @@ public class ModelJewlersCraftingBench extends ModelBase
model.rotateAngleZ = z;
}
+ /**
+ * @param f
+ * @param f1
+ * @param f2
+ * @param f3
+ * @param f4
+ * @param f5
+ */
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
}
-
}
diff --git a/java/darkknight/jewelrycraft/model/ModelMask.java b/java/darkknight/jewelrycraft/model/ModelMask.java
new file mode 100644
index 0000000..7cf70ac
--- /dev/null
+++ b/java/darkknight/jewelrycraft/model/ModelMask.java
@@ -0,0 +1,1134 @@
+package darkknight.jewelrycraft.model;
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+public class ModelMask extends ModelBase
+{
+ ModelRenderer p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31, p32, p33, p34, p35, p36, p37, p38, p39, p40, p41, p42, p43, p44, p45, p46, p47, p48, p49, p50, p51, p52, p53, p54, p55, p56, p57, p58, p59, p60, p61, p62, p63, p64, p65, p66, p67, p68, p69, p70, p71, p72, p73, p74, p75, p76, p77, p78, p79, p80, p81, p82, p83, p84, p85, p86, p87, p88, p89, p90, p91, p92, p93, p94, p95, p96, p97, p98, p99, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111, p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127, p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143, p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157;
+ public ModelMask()
+ {
+ textureWidth = 32;
+ textureHeight = 32;
+ p0 = new ModelRenderer(this, 9, 1);
+ p0.addBox(0F, 0F, 0F, 2, 1, 1);
+ p0.setRotationPoint(10F, 2F, 3F);
+ p0.setTextureSize(32, 32);
+ p0.mirror = true;
+
+ p1 = new ModelRenderer(this, 11, 1);
+ p1.addBox(0F, 0F, 0F, 9, 1, 1);
+ p1.setRotationPoint(12F, 2F, 2F);
+ p1.setTextureSize(32, 32);
+ p1.mirror = true;
+
+ p2 = new ModelRenderer(this, 20, 1);
+ p2.addBox(0F, 0F, 0F, 2, 1, 1);
+ p2.setRotationPoint(21F, 2F, 3F);
+ p2.setTextureSize(32, 32);
+ p2.mirror = true;
+
+ p3 = new ModelRenderer(this, 6, 2);
+ p3.addBox(0F, 0F, 0F, 4, 1, 1);
+ p3.setRotationPoint(7F, 3F, 3F);
+ p3.setTextureSize(32, 32);
+ p3.mirror = true;
+
+ p4 = new ModelRenderer(this, 10, 2);
+ p4.addBox(0F, 0F, 0F, 11, 1, 1);
+ p4.setRotationPoint(11F, 3F, 2F);
+ p4.setTextureSize(32, 32);
+ p4.mirror = true;
+
+ p5 = new ModelRenderer(this, 21, 2);
+ p5.addBox(0F, 0F, 0F, 4, 1, 1);
+ p5.setRotationPoint(22F, 3F, 3F);
+ p5.setTextureSize(32, 32);
+ p5.mirror = true;
+
+ p6 = new ModelRenderer(this, 5, 3);
+ p6.addBox(0F, 0F, 0F, 1, 1, 1);
+ p6.setRotationPoint(6F, 4F, 4F);
+ p6.setTextureSize(32, 32);
+ p6.mirror = true;
+
+ p7 = new ModelRenderer(this, 6, 3);
+ p7.addBox(0F, 0F, 0F, 4, 1, 1);
+ p7.setRotationPoint(7F, 4F, 3F);
+ p7.setTextureSize(32, 32);
+ p7.mirror = true;
+
+ p8 = new ModelRenderer(this, 10, 3);
+ p8.addBox(0F, 0F, 0F, 11, 1, 1);
+ p8.setRotationPoint(11F, 4F, 2F);
+ p8.setTextureSize(32, 32);
+ p8.mirror = true;
+
+ p9 = new ModelRenderer(this, 21, 3);
+ p9.addBox(0F, 0F, 0F, 4, 1, 1);
+ p9.setRotationPoint(22F, 4F, 3F);
+ p9.setTextureSize(32, 32);
+ p9.mirror = true;
+
+ p10 = new ModelRenderer(this, 25, 3);
+ p10.addBox(0F, 0F, 0F, 1, 1, 1);
+ p10.setRotationPoint(26F, 4F, 4F);
+ p10.setTextureSize(32, 32);
+ p10.mirror = true;
+
+ p11 = new ModelRenderer(this, 4, 4);
+ p11.addBox(0F, 0F, 0F, 1, 1, 1);
+ p11.setRotationPoint(5F, 5F, 4F);
+ p11.setTextureSize(32, 32);
+ p11.mirror = true;
+
+ p12 = new ModelRenderer(this, 5, 4);
+ p12.addBox(0F, 0F, 0F, 4, 1, 1);
+ p12.setRotationPoint(6F, 5F, 3F);
+ p12.setTextureSize(32, 32);
+ p12.mirror = true;
+
+ p13 = new ModelRenderer(this, 9, 4);
+ p13.addBox(0F, 0F, 0F, 12, 1, 1);
+ p13.setRotationPoint(10F, 5F, 2F);
+ p13.setTextureSize(32, 32);
+ p13.mirror = true;
+
+ p14 = new ModelRenderer(this, 21, 4);
+ p14.addBox(0F, 0F, 0F, 4, 1, 1);
+ p14.setRotationPoint(22F, 5F, 3F);
+ p14.setTextureSize(32, 32);
+ p14.mirror = true;
+
+ p15 = new ModelRenderer(this, 25, 4);
+ p15.addBox(0F, 0F, 0F, 1, 1, 1);
+ p15.setRotationPoint(26F, 5F, 4F);
+ p15.setTextureSize(32, 32);
+ p15.mirror = true;
+
+ p16 = new ModelRenderer(this, 4, 5);
+ p16.addBox(0F, 0F, 0F, 1, 1, 1);
+ p16.setRotationPoint(5F, 6F, 4F);
+ p16.setTextureSize(32, 32);
+ p16.mirror = true;
+
+ p17 = new ModelRenderer(this, 5, 5);
+ p17.addBox(0F, 0F, 0F, 3, 1, 1);
+ p17.setRotationPoint(6F, 6F, 3F);
+ p17.setTextureSize(32, 32);
+ p17.mirror = true;
+
+ p18 = new ModelRenderer(this, 8, 5);
+ p18.addBox(0F, 0F, 0F, 14, 1, 1);
+ p18.setRotationPoint(9F, 6F, 2F);
+ p18.setTextureSize(32, 32);
+ p18.mirror = true;
+
+ p19 = new ModelRenderer(this, 22, 5);
+ p19.addBox(0F, 0F, 0F, 3, 1, 1);
+ p19.setRotationPoint(23F, 6F, 3F);
+ p19.setTextureSize(32, 32);
+ p19.mirror = true;
+
+ p20 = new ModelRenderer(this, 25, 5);
+ p20.addBox(0F, 0F, 0F, 1, 1, 1);
+ p20.setRotationPoint(26F, 6F, 4F);
+ p20.setTextureSize(32, 32);
+ p20.mirror = true;
+
+ p21 = new ModelRenderer(this, 4, 6);
+ p21.addBox(0F, 0F, 0F, 1, 1, 1);
+ p21.setRotationPoint(5F, 7F, 4F);
+ p21.setTextureSize(32, 32);
+ p21.mirror = true;
+
+ p22 = new ModelRenderer(this, 5, 6);
+ p22.addBox(0F, 0F, 0F, 3, 1, 1);
+ p22.setRotationPoint(6F, 7F, 3F);
+ p22.setTextureSize(32, 32);
+ p22.mirror = true;
+
+ p23 = new ModelRenderer(this, 8, 6);
+ p23.addBox(0F, 0F, 0F, 14, 1, 1);
+ p23.setRotationPoint(9F, 7F, 2F);
+ p23.setTextureSize(32, 32);
+ p23.mirror = true;
+
+ p24 = new ModelRenderer(this, 22, 6);
+ p24.addBox(0F, 0F, 0F, 4, 1, 1);
+ p24.setRotationPoint(23F, 7F, 3F);
+ p24.setTextureSize(32, 32);
+ p24.mirror = true;
+
+ p25 = new ModelRenderer(this, 26, 6);
+ p25.addBox(0F, 0F, 0F, 1, 1, 1);
+ p25.setRotationPoint(27F, 7F, 4F);
+ p25.setTextureSize(32, 32);
+ p25.mirror = true;
+
+ p26 = new ModelRenderer(this, 4, 7);
+ p26.addBox(0F, 0F, 0F, 3, 1, 1);
+ p26.setRotationPoint(5F, 8F, 3F);
+ p26.setTextureSize(32, 32);
+ p26.mirror = true;
+
+ p27 = new ModelRenderer(this, 7, 7);
+ p27.addBox(0F, 0F, 0F, 17, 1, 1);
+ p27.setRotationPoint(8F, 8F, 2F);
+ p27.setTextureSize(32, 32);
+ p27.mirror = true;
+
+ p28 = new ModelRenderer(this, 24, 7);
+ p28.addBox(0F, 0F, 0F, 2, 1, 1);
+ p28.setRotationPoint(25F, 8F, 3F);
+ p28.setTextureSize(32, 32);
+ p28.mirror = true;
+
+ p29 = new ModelRenderer(this, 26, 7);
+ p29.addBox(0F, 0F, 0F, 1, 1, 1);
+ p29.setRotationPoint(27F, 8F, 4F);
+ p29.setTextureSize(32, 32);
+ p29.mirror = true;
+
+ p30 = new ModelRenderer(this, 4, 8);
+ p30.addBox(0F, 0F, 0F, 1, 1, 1);
+ p30.setRotationPoint(5F, 9F, 3F);
+ p30.setTextureSize(32, 32);
+ p30.mirror = true;
+
+ p31 = new ModelRenderer(this, 5, 8);
+ p31.addBox(0F, 0F, 0F, 3, 1, 1);
+ p31.setRotationPoint(6F, 9F, 2F);
+ p31.setTextureSize(32, 32);
+ p31.mirror = true;
+
+ p32 = new ModelRenderer(this, 8, 8);
+ p32.addBox(0F, 0F, 0F, 1, 1, 1);
+ p32.setRotationPoint(9F, 9F, 1F);
+ p32.setTextureSize(32, 32);
+ p32.mirror = true;
+
+ p33 = new ModelRenderer(this, 9, 8);
+ p33.addBox(0F, 0F, 0F, 12, 1, 1);
+ p33.setRotationPoint(10F, 9F, 2F);
+ p33.setTextureSize(32, 32);
+ p33.mirror = true;
+
+ p34 = new ModelRenderer(this, 21, 8);
+ p34.addBox(0F, 0F, 0F, 2, 1, 1);
+ p34.setRotationPoint(22F, 9F, 1F);
+ p34.setTextureSize(32, 32);
+ p34.mirror = true;
+
+ p35 = new ModelRenderer(this, 23, 8);
+ p35.addBox(0F, 0F, 0F, 2, 1, 1);
+ p35.setRotationPoint(24F, 9F, 2F);
+ p35.setTextureSize(32, 32);
+ p35.mirror = true;
+
+ p36 = new ModelRenderer(this, 25, 8);
+ p36.addBox(0F, 0F, 0F, 1, 1, 1);
+ p36.setRotationPoint(26F, 9F, 3F);
+ p36.setTextureSize(32, 32);
+ p36.mirror = true;
+
+ p37 = new ModelRenderer(this, 26, 8);
+ p37.addBox(0F, 0F, 0F, 1, 1, 1);
+ p37.setRotationPoint(27F, 9F, 4F);
+ p37.setTextureSize(32, 32);
+ p37.mirror = true;
+
+ p38 = new ModelRenderer(this, 4, 9);
+ p38.addBox(0F, 0F, 0F, 1, 1, 1);
+ p38.setRotationPoint(5F, 10F, 3F);
+ p38.setTextureSize(32, 32);
+ p38.mirror = true;
+
+ p39 = new ModelRenderer(this, 5, 9);
+ p39.addBox(0F, 0F, 0F, 1, 1, 1);
+ p39.setRotationPoint(6F, 10F, 2F);
+ p39.setTextureSize(32, 32);
+ p39.mirror = true;
+
+ p40 = new ModelRenderer(this, 6, 9);
+ p40.addBox(0F, 0F, 0F, 5, 1, 1);
+ p40.setRotationPoint(7F, 10F, 1F);
+ p40.setTextureSize(32, 32);
+ p40.mirror = true;
+
+ p41 = new ModelRenderer(this, 11, 9);
+ p41.addBox(0F, 0F, 0F, 9, 1, 1);
+ p41.setRotationPoint(12F, 10F, 2F);
+ p41.setTextureSize(32, 32);
+ p41.mirror = true;
+
+ p42 = new ModelRenderer(this, 20, 9);
+ p42.addBox(0F, 0F, 0F, 4, 1, 1);
+ p42.setRotationPoint(21F, 10F, 1F);
+ p42.setTextureSize(32, 32);
+ p42.mirror = true;
+
+ p43 = new ModelRenderer(this, 24, 9);
+ p43.addBox(0F, 0F, 0F, 1, 1, 1);
+ p43.setRotationPoint(25F, 10F, 2F);
+ p43.setTextureSize(32, 32);
+ p43.mirror = true;
+
+ p44 = new ModelRenderer(this, 25, 9);
+ p44.addBox(0F, 0F, 0F, 2, 1, 1);
+ p44.setRotationPoint(26F, 10F, 3F);
+ p44.setTextureSize(32, 32);
+ p44.mirror = true;
+
+ p45 = new ModelRenderer(this, 3, 10);
+ p45.addBox(0F, 0F, 0F, 1, 1, 1);
+ p45.setRotationPoint(4F, 11F, 4F);
+ p45.setTextureSize(32, 32);
+ p45.mirror = true;
+
+ p46 = new ModelRenderer(this, 4, 10);
+ p46.addBox(0F, 0F, 0F, 1, 1, 1);
+ p46.setRotationPoint(5F, 11F, 3F);
+ p46.setTextureSize(32, 32);
+ p46.mirror = true;
+
+ p47 = new ModelRenderer(this, 5, 10);
+ p47.addBox(0F, 0F, 0F, 1, 1, 1);
+ p47.setRotationPoint(6F, 11F, 2F);
+ p47.setTextureSize(32, 32);
+ p47.mirror = true;
+
+ p48 = new ModelRenderer(this, 6, 10);
+ p48.addBox(0F, 0F, 0F, 5, 1, 1);
+ p48.setRotationPoint(7F, 11F, 1F);
+ p48.setTextureSize(32, 32);
+ p48.mirror = true;
+
+ p49 = new ModelRenderer(this, 11, 10);
+ p49.addBox(0F, 0F, 0F, 9, 1, 1);
+ p49.setRotationPoint(12F, 11F, 2F);
+ p49.setTextureSize(32, 32);
+ p49.mirror = true;
+
+ p50 = new ModelRenderer(this, 20, 10);
+ p50.addBox(0F, 0F, 0F, 4, 1, 1);
+ p50.setRotationPoint(21F, 11F, 1F);
+ p50.setTextureSize(32, 32);
+ p50.mirror = true;
+
+ p51 = new ModelRenderer(this, 24, 10);
+ p51.addBox(0F, 0F, 0F, 2, 1, 1);
+ p51.setRotationPoint(25F, 11F, 2F);
+ p51.setTextureSize(32, 32);
+ p51.mirror = true;
+
+ p52 = new ModelRenderer(this, 26, 10);
+ p52.addBox(0F, 0F, 0F, 1, 1, 1);
+ p52.setRotationPoint(27F, 11F, 3F);
+ p52.setTextureSize(32, 32);
+ p52.mirror = true;
+
+ p53 = new ModelRenderer(this, 3, 11);
+ p53.addBox(0F, 0F, 0F, 1, 1, 1);
+ p53.setRotationPoint(4F, 12F, 4F);
+ p53.setTextureSize(32, 32);
+ p53.mirror = true;
+
+ p54 = new ModelRenderer(this, 4, 11);
+ p54.addBox(0F, 0F, 0F, 1, 1, 1);
+ p54.setRotationPoint(5F, 12F, 3F);
+ p54.setTextureSize(32, 32);
+ p54.mirror = true;
+
+ p55 = new ModelRenderer(this, 5, 11);
+ p55.addBox(0F, 0F, 0F, 1, 1, 1);
+ p55.setRotationPoint(6F, 12F, 2F);
+ p55.setTextureSize(32, 32);
+ p55.mirror = true;
+
+ p56 = new ModelRenderer(this, 6, 11);
+ p56.addBox(0F, 0F, 0F, 5, 1, 1);
+ p56.setRotationPoint(7F, 12F, 1F);
+ p56.setTextureSize(32, 32);
+ p56.mirror = true;
+
+ p57 = new ModelRenderer(this, 11, 11);
+ p57.addBox(0F, 0F, 0F, 3, 1, 1);
+ p57.setRotationPoint(12F, 12F, 2F);
+ p57.setTextureSize(32, 32);
+ p57.mirror = true;
+
+ p58 = new ModelRenderer(this, 14, 11);
+ p58.addBox(0F, 0F, 0F, 3, 1, 1);
+ p58.setRotationPoint(15F, 12F, 1F);
+ p58.setTextureSize(32, 32);
+ p58.mirror = true;
+
+ p59 = new ModelRenderer(this, 17, 11);
+ p59.addBox(0F, 0F, 0F, 2, 1, 1);
+ p59.setRotationPoint(18F, 12F, 2F);
+ p59.setTextureSize(32, 32);
+ p59.mirror = true;
+
+ p60 = new ModelRenderer(this, 19, 11);
+ p60.addBox(0F, 0F, 0F, 6, 1, 1);
+ p60.setRotationPoint(20F, 12F, 1F);
+ p60.setTextureSize(32, 32);
+ p60.mirror = true;
+
+ p61 = new ModelRenderer(this, 25, 11);
+ p61.addBox(0F, 0F, 0F, 1, 1, 1);
+ p61.setRotationPoint(26F, 12F, 2F);
+ p61.setTextureSize(32, 32);
+ p61.mirror = true;
+
+ p62 = new ModelRenderer(this, 26, 11);
+ p62.addBox(0F, 0F, 0F, 1, 1, 1);
+ p62.setRotationPoint(27F, 12F, 3F);
+ p62.setTextureSize(32, 32);
+ p62.mirror = true;
+
+ p63 = new ModelRenderer(this, 3, 12);
+ p63.addBox(0F, 0F, 0F, 1, 1, 1);
+ p63.setRotationPoint(4F, 13F, 4F);
+ p63.setTextureSize(32, 32);
+ p63.mirror = true;
+
+ p64 = new ModelRenderer(this, 4, 12);
+ p64.addBox(0F, 0F, 0F, 1, 1, 1);
+ p64.setRotationPoint(5F, 13F, 3F);
+ p64.setTextureSize(32, 32);
+ p64.mirror = true;
+
+ p65 = new ModelRenderer(this, 5, 12);
+ p65.addBox(0F, 0F, 0F, 1, 1, 1);
+ p65.setRotationPoint(6F, 13F, 2F);
+ p65.setTextureSize(32, 32);
+ p65.mirror = true;
+
+ p66 = new ModelRenderer(this, 6, 12);
+ p66.addBox(0F, 0F, 0F, 5, 1, 1);
+ p66.setRotationPoint(7F, 13F, 1F);
+ p66.setTextureSize(32, 32);
+ p66.mirror = true;
+
+ p67 = new ModelRenderer(this, 11, 12);
+ p67.addBox(0F, 0F, 0F, 1, 1, 1);
+ p67.setRotationPoint(12F, 13F, 2F);
+ p67.setTextureSize(32, 32);
+ p67.mirror = true;
+
+ p68 = new ModelRenderer(this, 12, 12);
+ p68.addBox(0F, 0F, 0F, 6, 1, 1);
+ p68.setRotationPoint(13F, 13F, 1F);
+ p68.setTextureSize(32, 32);
+ p68.mirror = true;
+
+ p69 = new ModelRenderer(this, 18, 12);
+ p69.addBox(0F, 0F, 0F, 1, 1, 1);
+ p69.setRotationPoint(19F, 13F, 2F);
+ p69.setTextureSize(32, 32);
+ p69.mirror = true;
+
+ p70 = new ModelRenderer(this, 19, 12);
+ p70.addBox(0F, 0F, 0F, 5, 1, 1);
+ p70.setRotationPoint(20F, 13F, 1F);
+ p70.setTextureSize(32, 32);
+ p70.mirror = true;
+
+ p71 = new ModelRenderer(this, 24, 12);
+ p71.addBox(0F, 0F, 0F, 2, 1, 1);
+ p71.setRotationPoint(25F, 13F, 2F);
+ p71.setTextureSize(32, 32);
+ p71.mirror = true;
+
+ p72 = new ModelRenderer(this, 26, 12);
+ p72.addBox(0F, 0F, 0F, 1, 1, 1);
+ p72.setRotationPoint(27F, 13F, 3F);
+ p72.setTextureSize(32, 32);
+ p72.mirror = true;
+
+ p73 = new ModelRenderer(this, 3, 13);
+ p73.addBox(0F, 0F, 0F, 1, 1, 1);
+ p73.setRotationPoint(4F, 14F, 4F);
+ p73.setTextureSize(32, 32);
+ p73.mirror = true;
+
+ p74 = new ModelRenderer(this, 4, 13);
+ p74.addBox(0F, 0F, 0F, 1, 1, 1);
+ p74.setRotationPoint(5F, 14F, 3F);
+ p74.setTextureSize(32, 32);
+ p74.mirror = true;
+
+ p75 = new ModelRenderer(this, 5, 13);
+ p75.addBox(0F, 0F, 0F, 2, 1, 1);
+ p75.setRotationPoint(6F, 14F, 2F);
+ p75.setTextureSize(32, 32);
+ p75.mirror = true;
+
+ p76 = new ModelRenderer(this, 7, 13);
+ p76.addBox(0F, 0F, 0F, 3, 1, 1);
+ p76.setRotationPoint(8F, 14F, 1F);
+ p76.setTextureSize(32, 32);
+ p76.mirror = true;
+
+ p77 = new ModelRenderer(this, 10, 13);
+ p77.addBox(0F, 0F, 0F, 2, 1, 1);
+ p77.setRotationPoint(11F, 14F, 2F);
+ p77.setTextureSize(32, 32);
+ p77.mirror = true;
+
+ p78 = new ModelRenderer(this, 12, 13);
+ p78.addBox(0F, 0F, 0F, 6, 1, 1);
+ p78.setRotationPoint(13F, 14F, 1F);
+ p78.setTextureSize(32, 32);
+ p78.mirror = true;
+
+ p79 = new ModelRenderer(this, 18, 13);
+ p79.addBox(0F, 0F, 0F, 2, 1, 1);
+ p79.setRotationPoint(19F, 14F, 2F);
+ p79.setTextureSize(32, 32);
+ p79.mirror = true;
+
+ p80 = new ModelRenderer(this, 20, 13);
+ p80.addBox(0F, 0F, 0F, 4, 1, 1);
+ p80.setRotationPoint(21F, 14F, 1F);
+ p80.setTextureSize(32, 32);
+ p80.mirror = true;
+
+ p81 = new ModelRenderer(this, 24, 13);
+ p81.addBox(0F, 0F, 0F, 1, 1, 1);
+ p81.setRotationPoint(25F, 14F, 2F);
+ p81.setTextureSize(32, 32);
+ p81.mirror = true;
+
+ p82 = new ModelRenderer(this, 25, 13);
+ p82.addBox(0F, 0F, 0F, 2, 1, 1);
+ p82.setRotationPoint(26F, 14F, 3F);
+ p82.setTextureSize(32, 32);
+ p82.mirror = true;
+
+ p83 = new ModelRenderer(this, 3, 14);
+ p83.addBox(0F, 0F, 0F, 1, 1, 1);
+ p83.setRotationPoint(4F, 15F, 4F);
+ p83.setTextureSize(32, 32);
+ p83.mirror = true;
+
+ p84 = new ModelRenderer(this, 4, 14);
+ p84.addBox(0F, 0F, 0F, 2, 1, 1);
+ p84.setRotationPoint(5F, 15F, 3F);
+ p84.setTextureSize(32, 32);
+ p84.mirror = true;
+
+ p85 = new ModelRenderer(this, 6, 14);
+ p85.addBox(0F, 0F, 0F, 6, 1, 1);
+ p85.setRotationPoint(7F, 15F, 2F);
+ p85.setTextureSize(32, 32);
+ p85.mirror = true;
+
+ p86 = new ModelRenderer(this, 12, 14);
+ p86.addBox(0F, 0F, 0F, 7, 1, 1);
+ p86.setRotationPoint(13F, 15F, 1F);
+ p86.setTextureSize(32, 32);
+ p86.mirror = true;
+
+ p87 = new ModelRenderer(this, 19, 14);
+ p87.addBox(0F, 0F, 0F, 6, 1, 1);
+ p87.setRotationPoint(20F, 15F, 2F);
+ p87.setTextureSize(32, 32);
+ p87.mirror = true;
+
+ p88 = new ModelRenderer(this, 25, 14);
+ p88.addBox(0F, 0F, 0F, 1, 1, 1);
+ p88.setRotationPoint(26F, 15F, 3F);
+ p88.setTextureSize(32, 32);
+ p88.mirror = true;
+
+ p89 = new ModelRenderer(this, 26, 14);
+ p89.addBox(0F, 0F, 0F, 1, 1, 1);
+ p89.setRotationPoint(27F, 15F, 4F);
+ p89.setTextureSize(32, 32);
+ p89.mirror = true;
+
+ p90 = new ModelRenderer(this, 3, 15);
+ p90.addBox(0F, 0F, 0F, 1, 1, 1);
+ p90.setRotationPoint(4F, 16F, 4F);
+ p90.setTextureSize(32, 32);
+ p90.mirror = true;
+
+ p91 = new ModelRenderer(this, 4, 15);
+ p91.addBox(0F, 0F, 0F, 3, 1, 1);
+ p91.setRotationPoint(5F, 16F, 3F);
+ p91.setTextureSize(32, 32);
+ p91.mirror = true;
+
+ p92 = new ModelRenderer(this, 7, 15);
+ p92.addBox(0F, 0F, 0F, 4, 1, 1);
+ p92.setRotationPoint(8F, 16F, 2F);
+ p92.setTextureSize(32, 32);
+ p92.mirror = true;
+
+ p93 = new ModelRenderer(this, 11, 15);
+ p93.addBox(0F, 0F, 0F, 8, 1, 1);
+ p93.setRotationPoint(12F, 16F, 1F);
+ p93.setTextureSize(32, 32);
+ p93.mirror = true;
+
+ p94 = new ModelRenderer(this, 19, 15);
+ p94.addBox(0F, 0F, 0F, 4, 1, 1);
+ p94.setRotationPoint(20F, 16F, 2F);
+ p94.setTextureSize(32, 32);
+ p94.mirror = true;
+
+ p95 = new ModelRenderer(this, 23, 15);
+ p95.addBox(0F, 0F, 0F, 3, 1, 1);
+ p95.setRotationPoint(24F, 16F, 3F);
+ p95.setTextureSize(32, 32);
+ p95.mirror = true;
+
+ p96 = new ModelRenderer(this, 26, 15);
+ p96.addBox(0F, 0F, 0F, 1, 1, 1);
+ p96.setRotationPoint(27F, 16F, 4F);
+ p96.setTextureSize(32, 32);
+ p96.mirror = true;
+
+ p97 = new ModelRenderer(this, 3, 16);
+ p97.addBox(0F, 0F, 0F, 1, 1, 1);
+ p97.setRotationPoint(4F, 17F, 4F);
+ p97.setTextureSize(32, 32);
+ p97.mirror = true;
+
+ p98 = new ModelRenderer(this, 4, 16);
+ p98.addBox(0F, 0F, 0F, 3, 1, 1);
+ p98.setRotationPoint(5F, 17F, 3F);
+ p98.setTextureSize(32, 32);
+ p98.mirror = true;
+
+ p99 = new ModelRenderer(this, 7, 16);
+ p99.addBox(0F, 0F, 0F, 4, 1, 1);
+ p99.setRotationPoint(8F, 17F, 2F);
+ p99.setTextureSize(32, 32);
+ p99.mirror = true;
+
+ p100 = new ModelRenderer(this, 11, 16);
+ p100.addBox(0F, 0F, 0F, 8, 1, 1);
+ p100.setRotationPoint(12F, 17F, 1F);
+ p100.setTextureSize(32, 32);
+ p100.mirror = true;
+
+ p101 = new ModelRenderer(this, 19, 16);
+ p101.addBox(0F, 0F, 0F, 4, 1, 1);
+ p101.setRotationPoint(20F, 17F, 2F);
+ p101.setTextureSize(32, 32);
+ p101.mirror = true;
+
+ p102 = new ModelRenderer(this, 23, 16);
+ p102.addBox(0F, 0F, 0F, 3, 1, 1);
+ p102.setRotationPoint(24F, 17F, 3F);
+ p102.setTextureSize(32, 32);
+ p102.mirror = true;
+
+ p103 = new ModelRenderer(this, 26, 16);
+ p103.addBox(0F, 0F, 0F, 1, 1, 1);
+ p103.setRotationPoint(27F, 17F, 4F);
+ p103.setTextureSize(32, 32);
+ p103.mirror = true;
+
+ p104 = new ModelRenderer(this, 4, 17);
+ p104.addBox(0F, 0F, 0F, 1, 1, 1);
+ p104.setRotationPoint(5F, 18F, 4F);
+ p104.setTextureSize(32, 32);
+ p104.mirror = true;
+
+ p105 = new ModelRenderer(this, 5, 17);
+ p105.addBox(0F, 0F, 0F, 3, 1, 1);
+ p105.setRotationPoint(6F, 18F, 3F);
+ p105.setTextureSize(32, 32);
+ p105.mirror = true;
+
+ p106 = new ModelRenderer(this, 8, 17);
+ p106.addBox(0F, 0F, 0F, 3, 1, 1);
+ p106.setRotationPoint(9F, 18F, 2F);
+ p106.setTextureSize(32, 32);
+ p106.mirror = true;
+
+ p107 = new ModelRenderer(this, 11, 17);
+ p107.addBox(0F, 0F, 0F, 9, 1, 1);
+ p107.setRotationPoint(12F, 18F, 1F);
+ p107.setTextureSize(32, 32);
+ p107.mirror = true;
+
+ p108 = new ModelRenderer(this, 20, 17);
+ p108.addBox(0F, 0F, 0F, 3, 1, 1);
+ p108.setRotationPoint(21F, 18F, 2F);
+ p108.setTextureSize(32, 32);
+ p108.mirror = true;
+
+ p109 = new ModelRenderer(this, 23, 17);
+ p109.addBox(0F, 0F, 0F, 3, 1, 1);
+ p109.setRotationPoint(24F, 18F, 3F);
+ p109.setTextureSize(32, 32);
+ p109.mirror = true;
+
+ p110 = new ModelRenderer(this, 26, 17);
+ p110.addBox(0F, 0F, 0F, 1, 1, 1);
+ p110.setRotationPoint(27F, 18F, 4F);
+ p110.setTextureSize(32, 32);
+ p110.mirror = true;
+
+ p111 = new ModelRenderer(this, 4, 18);
+ p111.addBox(0F, 0F, 0F, 1, 1, 1);
+ p111.setRotationPoint(5F, 19F, 4F);
+ p111.setTextureSize(32, 32);
+ p111.mirror = true;
+
+ p112 = new ModelRenderer(this, 5, 18);
+ p112.addBox(0F, 0F, 0F, 3, 1, 1);
+ p112.setRotationPoint(6F, 19F, 3F);
+ p112.setTextureSize(32, 32);
+ p112.mirror = true;
+
+ p113 = new ModelRenderer(this, 8, 18);
+ p113.addBox(0F, 0F, 0F, 3, 1, 1);
+ p113.setRotationPoint(9F, 19F, 2F);
+ p113.setTextureSize(32, 32);
+ p113.mirror = true;
+
+ p114 = new ModelRenderer(this, 11, 18);
+ p114.addBox(0F, 0F, 0F, 9, 1, 1);
+ p114.setRotationPoint(12F, 19F, 1F);
+ p114.setTextureSize(32, 32);
+ p114.mirror = true;
+
+ p115 = new ModelRenderer(this, 20, 18);
+ p115.addBox(0F, 0F, 0F, 3, 1, 1);
+ p115.setRotationPoint(21F, 19F, 2F);
+ p115.setTextureSize(32, 32);
+ p115.mirror = true;
+
+ p116 = new ModelRenderer(this, 23, 18);
+ p116.addBox(0F, 0F, 0F, 2, 1, 1);
+ p116.setRotationPoint(24F, 19F, 3F);
+ p116.setTextureSize(32, 32);
+ p116.mirror = true;
+
+ p117 = new ModelRenderer(this, 25, 18);
+ p117.addBox(0F, 0F, 0F, 1, 1, 1);
+ p117.setRotationPoint(26F, 19F, 4F);
+ p117.setTextureSize(32, 32);
+ p117.mirror = true;
+
+ p118 = new ModelRenderer(this, 5, 19);
+ p118.addBox(0F, 0F, 0F, 1, 1, 1);
+ p118.setRotationPoint(6F, 20F, 4F);
+ p118.setTextureSize(32, 32);
+ p118.mirror = true;
+
+ p119 = new ModelRenderer(this, 6, 19);
+ p119.addBox(0F, 0F, 0F, 2, 1, 1);
+ p119.setRotationPoint(7F, 20F, 3F);
+ p119.setTextureSize(32, 32);
+ p119.mirror = true;
+
+ p120 = new ModelRenderer(this, 8, 19);
+ p120.addBox(0F, 0F, 0F, 3, 1, 1);
+ p120.setRotationPoint(9F, 20F, 2F);
+ p120.setTextureSize(32, 32);
+ p120.mirror = true;
+
+ p121 = new ModelRenderer(this, 11, 19);
+ p121.addBox(0F, 0F, 0F, 9, 1, 1);
+ p121.setRotationPoint(12F, 20F, 1F);
+ p121.setTextureSize(32, 32);
+ p121.mirror = true;
+
+ p122 = new ModelRenderer(this, 20, 19);
+ p122.addBox(0F, 0F, 0F, 2, 1, 1);
+ p122.setRotationPoint(21F, 20F, 2F);
+ p122.setTextureSize(32, 32);
+ p122.mirror = true;
+
+ p123 = new ModelRenderer(this, 22, 19);
+ p123.addBox(0F, 0F, 0F, 3, 1, 1);
+ p123.setRotationPoint(23F, 20F, 3F);
+ p123.setTextureSize(32, 32);
+ p123.mirror = true;
+
+ p124 = new ModelRenderer(this, 25, 19);
+ p124.addBox(0F, 0F, 0F, 1, 1, 1);
+ p124.setRotationPoint(26F, 20F, 4F);
+ p124.setTextureSize(32, 32);
+ p124.mirror = true;
+
+ p125 = new ModelRenderer(this, 5, 20);
+ p125.addBox(0F, 0F, 0F, 1, 1, 1);
+ p125.setRotationPoint(6F, 21F, 4F);
+ p125.setTextureSize(32, 32);
+ p125.mirror = true;
+
+ p126 = new ModelRenderer(this, 6, 20);
+ p126.addBox(0F, 0F, 0F, 3, 1, 1);
+ p126.setRotationPoint(7F, 21F, 3F);
+ p126.setTextureSize(32, 32);
+ p126.mirror = true;
+
+ p127 = new ModelRenderer(this, 9, 20);
+ p127.addBox(0F, 0F, 0F, 1, 1, 1);
+ p127.setRotationPoint(10F, 21F, 2F);
+ p127.setTextureSize(32, 32);
+ p127.mirror = true;
+
+ p128 = new ModelRenderer(this, 10, 20);
+ p128.addBox(0F, 0F, 0F, 10, 1, 1);
+ p128.setRotationPoint(11F, 21F, 1F);
+ p128.setTextureSize(32, 32);
+ p128.mirror = true;
+
+ p129 = new ModelRenderer(this, 20, 20);
+ p129.addBox(0F, 0F, 0F, 2, 1, 1);
+ p129.setRotationPoint(21F, 21F, 2F);
+ p129.setTextureSize(32, 32);
+ p129.mirror = true;
+
+ p130 = new ModelRenderer(this, 22, 20);
+ p130.addBox(0F, 0F, 0F, 2, 1, 1);
+ p130.setRotationPoint(23F, 21F, 3F);
+ p130.setTextureSize(32, 32);
+ p130.mirror = true;
+
+ p131 = new ModelRenderer(this, 24, 20);
+ p131.addBox(0F, 0F, 0F, 1, 1, 1);
+ p131.setRotationPoint(25F, 21F, 4F);
+ p131.setTextureSize(32, 32);
+ p131.mirror = true;
+
+ p132 = new ModelRenderer(this, 6, 21);
+ p132.addBox(0F, 0F, 0F, 3, 1, 1);
+ p132.setRotationPoint(7F, 22F, 3F);
+ p132.setTextureSize(32, 32);
+ p132.mirror = true;
+
+ p133 = new ModelRenderer(this, 9, 21);
+ p133.addBox(0F, 0F, 0F, 1, 1, 1);
+ p133.setRotationPoint(10F, 22F, 2F);
+ p133.setTextureSize(32, 32);
+ p133.mirror = true;
+
+ p134 = new ModelRenderer(this, 10, 21);
+ p134.addBox(0F, 0F, 0F, 10, 1, 1);
+ p134.setRotationPoint(11F, 22F, 1F);
+ p134.setTextureSize(32, 32);
+ p134.mirror = true;
+
+ p135 = new ModelRenderer(this, 20, 21);
+ p135.addBox(0F, 0F, 0F, 2, 1, 1);
+ p135.setRotationPoint(21F, 22F, 2F);
+ p135.setTextureSize(32, 32);
+ p135.mirror = true;
+
+ p136 = new ModelRenderer(this, 22, 21);
+ p136.addBox(0F, 0F, 0F, 2, 1, 1);
+ p136.setRotationPoint(23F, 22F, 3F);
+ p136.setTextureSize(32, 32);
+ p136.mirror = true;
+
+ p137 = new ModelRenderer(this, 24, 21);
+ p137.addBox(0F, 0F, 0F, 1, 1, 1);
+ p137.setRotationPoint(25F, 22F, 4F);
+ p137.setTextureSize(32, 32);
+ p137.mirror = true;
+
+ p138 = new ModelRenderer(this, 7, 22);
+ p138.addBox(0F, 0F, 0F, 2, 1, 1);
+ p138.setRotationPoint(8F, 23F, 3F);
+ p138.setTextureSize(32, 32);
+ p138.mirror = true;
+
+ p139 = new ModelRenderer(this, 9, 22);
+ p139.addBox(0F, 0F, 0F, 1, 1, 1);
+ p139.setRotationPoint(10F, 23F, 2F);
+ p139.setTextureSize(32, 32);
+ p139.mirror = true;
+
+ p140 = new ModelRenderer(this, 10, 22);
+ p140.addBox(0F, 0F, 0F, 10, 1, 1);
+ p140.setRotationPoint(11F, 23F, 1F);
+ p140.setTextureSize(32, 32);
+ p140.mirror = true;
+
+ p141 = new ModelRenderer(this, 20, 22);
+ p141.addBox(0F, 0F, 0F, 1, 1, 1);
+ p141.setRotationPoint(21F, 23F, 2F);
+ p141.setTextureSize(32, 32);
+ p141.mirror = true;
+
+ p142 = new ModelRenderer(this, 21, 22);
+ p142.addBox(0F, 0F, 0F, 3, 1, 1);
+ p142.setRotationPoint(22F, 23F, 3F);
+ p142.setTextureSize(32, 32);
+ p142.mirror = true;
+
+ p143 = new ModelRenderer(this, 8, 23);
+ p143.addBox(0F, 0F, 0F, 1, 1, 1);
+ p143.setRotationPoint(9F, 24F, 3F);
+ p143.setTextureSize(32, 32);
+ p143.mirror = true;
+
+ p144 = new ModelRenderer(this, 9, 23);
+ p144.addBox(0F, 0F, 0F, 2, 1, 1);
+ p144.setRotationPoint(10F, 24F, 2F);
+ p144.setTextureSize(32, 32);
+ p144.mirror = true;
+
+ p145 = new ModelRenderer(this, 11, 23);
+ p145.addBox(0F, 0F, 0F, 9, 1, 1);
+ p145.setRotationPoint(12F, 24F, 1F);
+ p145.setTextureSize(32, 32);
+ p145.mirror = true;
+
+ p146 = new ModelRenderer(this, 20, 23);
+ p146.addBox(0F, 0F, 0F, 1, 1, 1);
+ p146.setRotationPoint(21F, 24F, 2F);
+ p146.setTextureSize(32, 32);
+ p146.mirror = true;
+
+ p147 = new ModelRenderer(this, 21, 23);
+ p147.addBox(0F, 0F, 0F, 2, 1, 1);
+ p147.setRotationPoint(22F, 24F, 3F);
+ p147.setTextureSize(32, 32);
+ p147.mirror = true;
+
+ p148 = new ModelRenderer(this, 8, 24);
+ p148.addBox(0F, 0F, 0F, 2, 1, 1);
+ p148.setRotationPoint(9F, 25F, 3F);
+ p148.setTextureSize(32, 32);
+ p148.mirror = true;
+
+ p149 = new ModelRenderer(this, 10, 24);
+ p149.addBox(0F, 0F, 0F, 11, 1, 1);
+ p149.setRotationPoint(11F, 25F, 2F);
+ p149.setTextureSize(32, 32);
+ p149.mirror = true;
+
+ p150 = new ModelRenderer(this, 21, 24);
+ p150.addBox(0F, 0F, 0F, 1, 1, 1);
+ p150.setRotationPoint(22F, 25F, 3F);
+ p150.setTextureSize(32, 32);
+ p150.mirror = true;
+
+ p151 = new ModelRenderer(this, 9, 25);
+ p151.addBox(0F, 0F, 0F, 2, 1, 1);
+ p151.setRotationPoint(10F, 26F, 3F);
+ p151.setTextureSize(32, 32);
+ p151.mirror = true;
+
+ p152 = new ModelRenderer(this, 11, 25);
+ p152.addBox(0F, 0F, 0F, 9, 1, 1);
+ p152.setRotationPoint(12F, 26F, 2F);
+ p152.setTextureSize(32, 32);
+ p152.mirror = true;
+
+ p153 = new ModelRenderer(this, 20, 25);
+ p153.addBox(0F, 0F, 0F, 1, 1, 1);
+ p153.setRotationPoint(21F, 26F, 3F);
+ p153.setTextureSize(32, 32);
+ p153.mirror = true;
+
+ p154 = new ModelRenderer(this, 11, 26);
+ p154.addBox(0F, 0F, 0F, 1, 1, 1);
+ p154.setRotationPoint(12F, 27F, 3F);
+ p154.setTextureSize(32, 32);
+ p154.mirror = true;
+
+ p155 = new ModelRenderer(this, 12, 26);
+ p155.addBox(0F, 0F, 0F, 7, 1, 1);
+ p155.setRotationPoint(13F, 27F, 2F);
+ p155.setTextureSize(32, 32);
+ p155.mirror = true;
+
+ p156 = new ModelRenderer(this, 19, 26);
+ p156.addBox(0F, 0F, 0F, 1, 1, 1);
+ p156.setRotationPoint(20F, 27F, 3F);
+ p156.setTextureSize(32, 32);
+ p156.mirror = true;
+
+ p157 = new ModelRenderer(this, 13, 27);
+ p157.addBox(0F, 0F, 0F, 4, 1, 1);
+ p157.setRotationPoint(14F, 28F, 2F);
+ p157.setTextureSize(32, 32);
+ p157.mirror = true;
+
+ }
+ public void render(Entity entity, float f1, float f2, float f3, float f4, float f5, float f6)
+ {
+ super.render(entity, f1, f2, f3, f4, f5, f6);
+ setRotationAngles(f1, f2, f3, f4, f5, f6);
+ p0.render(f6);
+ p1.render(f6);
+ p2.render(f6);
+ p3.render(f6);
+ p4.render(f6);
+ p5.render(f6);
+ p6.render(f6);
+ p7.render(f6);
+ p8.render(f6);
+ p9.render(f6);
+ p10.render(f6);
+ p11.render(f6);
+ p12.render(f6);
+ p13.render(f6);
+ p14.render(f6);
+ p15.render(f6);
+ p16.render(f6);
+ p17.render(f6);
+ p18.render(f6);
+ p19.render(f6);
+ p20.render(f6);
+ p21.render(f6);
+ p22.render(f6);
+ p23.render(f6);
+ p24.render(f6);
+ p25.render(f6);
+ p26.render(f6);
+ p27.render(f6);
+ p28.render(f6);
+ p29.render(f6);
+ p30.render(f6);
+ p31.render(f6);
+ p32.render(f6);
+ p33.render(f6);
+ p34.render(f6);
+ p35.render(f6);
+ p36.render(f6);
+ p37.render(f6);
+ p38.render(f6);
+ p39.render(f6);
+ p40.render(f6);
+ p41.render(f6);
+ p42.render(f6);
+ p43.render(f6);
+ p44.render(f6);
+ p45.render(f6);
+ p46.render(f6);
+ p47.render(f6);
+ p48.render(f6);
+ p49.render(f6);
+ p50.render(f6);
+ p51.render(f6);
+ p52.render(f6);
+ p53.render(f6);
+ p54.render(f6);
+ p55.render(f6);
+ p56.render(f6);
+ p57.render(f6);
+ p58.render(f6);
+ p59.render(f6);
+ p60.render(f6);
+ p61.render(f6);
+ p62.render(f6);
+ p63.render(f6);
+ p64.render(f6);
+ p65.render(f6);
+ p66.render(f6);
+ p67.render(f6);
+ p68.render(f6);
+ p69.render(f6);
+ p70.render(f6);
+ p71.render(f6);
+ p72.render(f6);
+ p73.render(f6);
+ p74.render(f6);
+ p75.render(f6);
+ p76.render(f6);
+ p77.render(f6);
+ p78.render(f6);
+ p79.render(f6);
+ p80.render(f6);
+ p81.render(f6);
+ p82.render(f6);
+ p83.render(f6);
+ p84.render(f6);
+ p85.render(f6);
+ p86.render(f6);
+ p87.render(f6);
+ p88.render(f6);
+ p89.render(f6);
+ p90.render(f6);
+ p91.render(f6);
+ p92.render(f6);
+ p93.render(f6);
+ p94.render(f6);
+ p95.render(f6);
+ p96.render(f6);
+ p97.render(f6);
+ p98.render(f6);
+ p99.render(f6);
+ p100.render(f6);
+ p101.render(f6);
+ p102.render(f6);
+ p103.render(f6);
+ p104.render(f6);
+ p105.render(f6);
+ p106.render(f6);
+ p107.render(f6);
+ p108.render(f6);
+ p109.render(f6);
+ p110.render(f6);
+ p111.render(f6);
+ p112.render(f6);
+ p113.render(f6);
+ p114.render(f6);
+ p115.render(f6);
+ p116.render(f6);
+ p117.render(f6);
+ p118.render(f6);
+ p119.render(f6);
+ p120.render(f6);
+ p121.render(f6);
+ p122.render(f6);
+ p123.render(f6);
+ p124.render(f6);
+ p125.render(f6);
+ p126.render(f6);
+ p127.render(f6);
+ p128.render(f6);
+ p129.render(f6);
+ p130.render(f6);
+ p131.render(f6);
+ p132.render(f6);
+ p133.render(f6);
+ p134.render(f6);
+ p135.render(f6);
+ p136.render(f6);
+ p137.render(f6);
+ p138.render(f6);
+ p139.render(f6);
+ p140.render(f6);
+ p141.render(f6);
+ p142.render(f6);
+ p143.render(f6);
+ p144.render(f6);
+ p145.render(f6);
+ p146.render(f6);
+ p147.render(f6);
+ p148.render(f6);
+ p149.render(f6);
+ p150.render(f6);
+ p151.render(f6);
+ p152.render(f6);
+ p153.render(f6);
+ p154.render(f6);
+ p155.render(f6);
+ p156.render(f6);
+ p157.render(f6);
+ }
+ private void setRotation(ModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
+ {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
+ }
+}
diff --git a/java/darkknight/jewelrycraft/model/ModelMolder.java b/java/darkknight/jewelrycraft/model/ModelMolder.java
index 9e719ea..f2bc335 100644
--- a/java/darkknight/jewelrycraft/model/ModelMolder.java
+++ b/java/darkknight/jewelrycraft/model/ModelMolder.java
@@ -13,11 +13,13 @@ public class ModelMolder extends ModelBase
ModelRenderer Side2;
ModelRenderer Side3;
+ /**
+ *
+ */
public ModelMolder()
{
textureWidth = 64;
textureHeight = 32;
-
Base = new ModelRenderer(this, 0, 0);
Base.addBox(0F, 0F, 0F, 10, 1, 10);
Base.setRotationPoint(-5F, 23F, -5F);
@@ -50,6 +52,16 @@ public class ModelMolder extends ModelBase
setRotation(Side3, 0F, 0F, 0F);
}
+ /**
+ * @param entity
+ * @param f
+ * @param f1
+ * @param f2
+ * @param f3
+ * @param f4
+ * @param f5
+ */
+ @Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
@@ -61,6 +73,12 @@ public class ModelMolder extends ModelBase
Side3.render(f5);
}
+ /**
+ * @param model
+ * @param x
+ * @param y
+ * @param z
+ */
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
@@ -68,9 +86,16 @@ public class ModelMolder extends ModelBase
model.rotateAngleZ = z;
}
+ /**
+ * @param f
+ * @param f1
+ * @param f2
+ * @param f3
+ * @param f4
+ * @param f5
+ */
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
}
-
}
diff --git a/java/darkknight/jewelrycraft/model/ModelShadowEye.java b/java/darkknight/jewelrycraft/model/ModelShadowEye.java
index 3f48b79..e396f72 100644
--- a/java/darkknight/jewelrycraft/model/ModelShadowEye.java
+++ b/java/darkknight/jewelrycraft/model/ModelShadowEye.java
@@ -3,15 +3,11 @@
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
-
package darkknight.jewelrycraft.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.boss.EntityWither;
-import net.minecraft.util.MathHelper;
public class ModelShadowEye extends ModelBase
{
@@ -27,11 +23,13 @@ public class ModelShadowEye extends ModelBase
ModelRenderer Cable4;
float field_82221_e, field_82220_d;
+ /**
+ *
+ */
public ModelShadowEye()
{
textureWidth = 64;
textureHeight = 32;
-
Eye = new ModelRenderer(this, 0, 0);
Eye.addBox(-3.5F, -3.5F, -3.5F, 7, 7, 7);
Eye.setRotationPoint(0F, 17.5F, 0F);
@@ -88,6 +86,16 @@ public class ModelShadowEye extends ModelBase
setRotation(Cable4, 2.792527F, 0F, 0F);
}
+ /**
+ * @param entity
+ * @param f
+ * @param f1
+ * @param f2
+ * @param f3
+ * @param f4
+ * @param f5
+ */
+ @Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
Eye.render(f5);
@@ -99,74 +107,52 @@ public class ModelShadowEye extends ModelBase
Cable2.render(f5);
Cable3.render(f5);
Cable4.render(f5);
- if (entity != null)
- {
- float x = (float) (f - entity.posX);
- float y = (float) (f1 - entity.posY);
- float z = (float) (f2 - entity.posZ);
- if (f4 == 4)
- {
- if (f3 == 0)
- {
- if (z < 0)
- {
- Eye.rotateAngleY = (float) Math.asin(x / (Math.sqrt(x * x + z * z))) + 135f;
- Eye.rotateAngleZ = (float) -Math.asin((y + 1) / (Math.sqrt(y * y + 4 * 4)));
- }
- else
- {
- Eye.rotateAngleY = (float) -Math.asin(x / (Math.sqrt(x * x + z * z)));
- Eye.rotateAngleZ = (float) Math.asin((y + 1) / (Math.sqrt(y * y + 4 * 4)));
- }
+ if (entity != null){
+ float x = (float)(f - entity.posX);
+ float y = (float)(f1 - entity.posY);
+ float z = (float)(f2 - entity.posZ);
+ if (f4 == 4){
+ if (f3 == 0) if (z < 0){
+ Eye.rotateAngleY = (float)Math.asin(x / Math.sqrt(x * x + z * z)) + 135f;
+ Eye.rotateAngleZ = (float)-Math.asin((y + 1) / Math.sqrt(y * y + 4 * 4));
+ }else{
+ Eye.rotateAngleY = (float)-Math.asin(x / Math.sqrt(x * x + z * z));
+ Eye.rotateAngleZ = (float)Math.asin((y + 1) / Math.sqrt(y * y + 4 * 4));
}
- if (f3 == 1)
- {
- if (x < 0)
- {
- Eye.rotateAngleY = (float) -Math.asin(z / (Math.sqrt(x * x + z * z)));
- Eye.rotateAngleZ = (float) Math.asin((y + 1) / (Math.sqrt(y * y + 4 * 4)));
- }
- else
- {
- Eye.rotateAngleY = (float) Math.asin(z / (Math.sqrt(x * x + z * z))) + 135f;
- Eye.rotateAngleZ = (float) -Math.asin((y + 1) / (Math.sqrt(y * y + 4 * 4)));
- }
+ if (f3 == 1) if (x < 0){
+ Eye.rotateAngleY = (float)-Math.asin(z / Math.sqrt(x * x + z * z));
+ Eye.rotateAngleZ = (float)Math.asin((y + 1) / Math.sqrt(y * y + 4 * 4));
+ }else{
+ Eye.rotateAngleY = (float)Math.asin(z / Math.sqrt(x * x + z * z)) + 135f;
+ Eye.rotateAngleZ = (float)-Math.asin((y + 1) / Math.sqrt(y * y + 4 * 4));
}
- if (f3 == 2)
- {
- if (z < 0)
- {
- Eye.rotateAngleY = (float) Math.asin(x / (Math.sqrt(x * x + z * z)));
- Eye.rotateAngleZ = (float) Math.asin((y + 1) / (Math.sqrt(y * y + 4 * 4)));
- }
- else
- {
- Eye.rotateAngleY = (float) -Math.asin(x / (Math.sqrt(x * x + z * z))) + 135f;
- Eye.rotateAngleZ = (float) -Math.asin((y + 1) / (Math.sqrt(y * y + 4 * 4)));
- }
+ if (f3 == 2) if (z < 0){
+ Eye.rotateAngleY = (float)Math.asin(x / Math.sqrt(x * x + z * z));
+ Eye.rotateAngleZ = (float)Math.asin((y + 1) / Math.sqrt(y * y + 4 * 4));
+ }else{
+ Eye.rotateAngleY = (float)-Math.asin(x / Math.sqrt(x * x + z * z)) + 135f;
+ Eye.rotateAngleZ = (float)-Math.asin((y + 1) / Math.sqrt(y * y + 4 * 4));
}
- if (f3 == 3)
- {
- if (x < 0)
- {
- Eye.rotateAngleY = (float) -Math.asin(z / (Math.sqrt(x * x + z * z))) + 135f;
- Eye.rotateAngleZ = (float) -Math.asin((y + 1) / (Math.sqrt(y * y + 4 * 4)));
- }
- else
- {
- Eye.rotateAngleY = (float) Math.asin(z / (Math.sqrt(x * x + z * z)));
- Eye.rotateAngleZ = (float) Math.asin((y + 1) / (Math.sqrt(y * y + 4 * 4)));
- }
+ if (f3 == 3) if (x < 0){
+ Eye.rotateAngleY = (float)-Math.asin(z / Math.sqrt(x * x + z * z)) + 135f;
+ Eye.rotateAngleZ = (float)-Math.asin((y + 1) / Math.sqrt(y * y + 4 * 4));
+ }else{
+ Eye.rotateAngleY = (float)Math.asin(z / Math.sqrt(x * x + z * z));
+ Eye.rotateAngleZ = (float)Math.asin((y + 1) / Math.sqrt(y * y + 4 * 4));
}
- }
- else
- {
+ }else{
Eye.rotateAngleY = 0f;
Eye.rotateAngleZ = 0f;
}
}
}
+ /**
+ * @param model
+ * @param x
+ * @param y
+ * @param z
+ */
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
diff --git a/java/darkknight/jewelrycraft/model/ModelShadowHand.java b/java/darkknight/jewelrycraft/model/ModelShadowHand.java
index 4e187f0..02d7eea 100644
--- a/java/darkknight/jewelrycraft/model/ModelShadowHand.java
+++ b/java/darkknight/jewelrycraft/model/ModelShadowHand.java
@@ -1,161 +1,29 @@
package darkknight.jewelrycraft.model;
-import org.lwjgl.opengl.GL11;
+import net.minecraft.util.ResourceLocation;
-import net.minecraft.client.model.ModelBase;
-import net.minecraft.client.model.ModelRenderer;
-import net.minecraft.entity.Entity;
-
-public class ModelShadowHand extends ModelBase
+/**
+ * @author Paul Fulham (pau101)
+ */
+public class ModelShadowHand extends ModelHandPedestal
{
- //fields
- ModelRenderer finger1;
- ModelRenderer finger2;
- ModelRenderer finger3;
- ModelRenderer finger4;
- ModelRenderer finger5;
- ModelRenderer finger6;
- ModelRenderer finger7;
- ModelRenderer finger8;
- ModelRenderer finger9;
- ModelRenderer finger10;
- ModelRenderer Base;
- ModelRenderer Base2;
- ModelRenderer Base3;
- ModelRenderer Palm;
-
- public ModelShadowHand()
- {
- textureWidth = 64;
- textureHeight = 32;
-
- finger1 = new ModelRenderer(this, 0, 0);
- finger1.addBox(-1.5F, -4.5F, -9F, 2, 4, 3);
- finger1.setRotationPoint(0F, 10F, 0F);
- finger1.setTextureSize(64, 32);
- finger1.mirror = true;
- setRotation(finger1, -0.2094395F, 0.7853982F, 0F);
- finger2 = new ModelRenderer(this, 0, 0);
- finger2.addBox(-2.5F, -4.5F, -9F, 2, 4, 3);
- finger2.setRotationPoint(0F, 10F, 0F);
- finger2.setTextureSize(64, 32);
- finger2.mirror = true;
- setRotation(finger2, -0.2094395F, 0.0872665F, 0F);
- finger3 = new ModelRenderer(this, 0, 0);
- finger3.addBox(0.5F, -4.5F, -9F, 2, 4, 3);
- finger3.setRotationPoint(0F, 10F, 0F);
- finger3.setTextureSize(64, 32);
- finger3.mirror = true;
- setRotation(finger3, -0.2094395F, -0.0872665F, 0F);
- finger4 = new ModelRenderer(this, 0, 0);
- finger4.addBox(-0.5F, -4.5F, -9F, 2, 4, 3);
- finger4.setRotationPoint(0F, 10F, 0F);
- finger4.setTextureSize(64, 32);
- finger4.mirror = true;
- setRotation(finger4, -0.2094395F, -0.7853982F, 0F);
- finger5 = new ModelRenderer(this, 0, 0);
- finger5.addBox(-1F, -4.5F, 5F, 2, 4, 3);
- finger5.setRotationPoint(0F, 10F, 0F);
- finger5.setTextureSize(64, 32);
- finger5.mirror = true;
- setRotation(finger5, 0.2094395F, 0F, 0F);
- finger6 = new ModelRenderer(this, 0, 0);
- finger6.addBox(-1.5F, -0.5F, -9F, 2, 3, 5);
- finger6.setRotationPoint(0F, 10F, 0F);
- finger6.setTextureSize(64, 32);
- finger6.mirror = true;
- setRotation(finger6, -0.2094395F, 0.7853982F, 0F);
- finger7 = new ModelRenderer(this, 0, 0);
- finger7.addBox(-2.5F, -0.5F, -9F, 2, 3, 5);
- finger7.setRotationPoint(0F, 10F, 0F);
- finger7.setTextureSize(64, 32);
- finger7.mirror = true;
- setRotation(finger7, -0.2094395F, 0.0872665F, 0F);
- finger8 = new ModelRenderer(this, 0, 0);
- finger8.addBox(0.5F, -0.5F, -9F, 2, 3, 5);
- finger8.setRotationPoint(0F, 10F, 0F);
- finger8.setTextureSize(64, 32);
- finger8.mirror = true;
- setRotation(finger8, -0.2094395F, -0.0872665F, 0F);
- finger9 = new ModelRenderer(this, 0, 0);
- finger9.addBox(-0.5F, -0.5F, -9F, 2, 3, 5);
- finger9.setRotationPoint(0F, 10F, 0F);
- finger9.setTextureSize(64, 32);
- finger9.mirror = true;
- setRotation(finger9, -0.2094395F, -0.7853982F, 0F);
- finger10 = new ModelRenderer(this, 0, 0);
- finger10.addBox(-1F, -0.5F, 3F, 2, 3, 5);
- finger10.setRotationPoint(0F, 10F, 0F);
- finger10.setTextureSize(64, 32);
- finger10.mirror = true;
- setRotation(finger10, 0.2094395F, 0F, 0F);
- Base = new ModelRenderer(this, 0, 0);
- Base.addBox(-3F, 6F, -3F, 6, 2, 6);
- Base.setRotationPoint(0F, 16F, 0F);
- Base.setTextureSize(64, 32);
- Base.mirror = true;
- setRotation(Base, 0F, 0F, 0F);
- Base2 = new ModelRenderer(this, 0, 15);
- Base2.addBox(-2F, 0F, -2F, 4, 6, 4);
- Base2.setRotationPoint(0F, 16F, 0F);
- Base2.setTextureSize(64, 32);
- Base2.mirror = true;
- setRotation(Base2, 0F, 0F, 0F);
- Base3 = new ModelRenderer(this, 28, 0);
- Base3.addBox(-3F, -4F, -3F, 6, 4, 6);
- Base3.setRotationPoint(0F, 16F, 0F);
- Base3.setTextureSize(64, 32);
- Base3.mirror = true;
- setRotation(Base3, 0F, 0F, 0F);
- Palm = new ModelRenderer(this, 0, 0);
- Palm.addBox(-4F, -8F, -4F, 8, 4, 8);
- Palm.setRotationPoint(0F, 16F, 0F);
- Palm.setTextureSize(64, 32);
- Palm.mirror = true;
- setRotation(Palm, 0F, 0F, 0F);
- }
- public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
+ /**
+ * @param resetResourceLocation
+ */
+ public ModelShadowHand(ResourceLocation resetResourceLocation)
{
- GL11.glPushMatrix();
- switch ((int)f)
- {
- default:
- GL11.glTranslatef(0.15f, 0.0f, 0.0f);
- GL11.glTranslatef(0.0f, 0.25f, 0.0f);
- GL11.glTranslatef(0.0f, 0.0f, 0.06f);
- GL11.glRotatef(35f, 0, 0, 1);
- GL11.glRotatef(-15f, 1, 0, 1);
- break;
- //case 1: GL11.glRotatef(10f, 0, 0, 1);
- }
- finger1.render(f5);
- GL11.glPopMatrix();
- finger2.render(f5);
- finger3.render(f5);
- finger4.render(f5);
- finger5.render(f5);
- finger6.render(f5);
- finger7.render(f5);
- finger8.render(f5);
- finger9.render(f5);
- finger10.render(f5);
- Base.render(f5);
- Base2.render(f5);
- Base3.render(f5);
- Palm.render(f5);
+ super(resetResourceLocation);
}
- private void setRotation(ModelRenderer model, float x, float y, float z)
+ /**
+ *
+ */
+ @Override
+ protected void initPedestalRenderers()
{
- model.rotateAngleX = x;
- model.rotateAngleY = y;
- model.rotateAngleZ = z;
+ plinth = createModelRenderer(0, 0).addBox(-3, 6, -3, 6, 2, 6);
+ base = createModelRenderer(0, 15).addBox(-2, 0, -2, 4, 6, 4);
+ shaft = createModelRenderer(28, 0).addBox(-3, -4, -3, 6, 4, 6);
}
-
- public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
- {
- super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
- }
-
-}
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/model/ModelSmelter.java b/java/darkknight/jewelrycraft/model/ModelSmelter.java
index 8abcd3d..8fc9c11 100644
--- a/java/darkknight/jewelrycraft/model/ModelSmelter.java
+++ b/java/darkknight/jewelrycraft/model/ModelSmelter.java
@@ -38,11 +38,13 @@ public class ModelSmelter extends ModelBase
ModelRenderer HeatSourceSide11;
ModelRenderer HeatSourceSide12;
+ /**
+ *
+ */
public ModelSmelter()
{
textureWidth = 64;
textureHeight = 32;
-
Support1 = new ModelRenderer(this, 0, 0);
Support1.addBox(0F, 0F, 0F, 2, 15, 3);
Support1.setRotationPoint(6F, 9F, -1F);
@@ -225,6 +227,16 @@ public class ModelSmelter extends ModelBase
setRotation(HeatSourceSide12, 0F, 0F, 0F);
}
+ /**
+ * @param entity
+ * @param f
+ * @param f1
+ * @param f2
+ * @param f3
+ * @param f4
+ * @param f5
+ */
+ @Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
@@ -261,6 +273,12 @@ public class ModelSmelter extends ModelBase
HeatSourceSide12.render(f5);
}
+ /**
+ * @param model
+ * @param x
+ * @param y
+ * @param z
+ */
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
@@ -268,9 +286,16 @@ public class ModelSmelter extends ModelBase
model.rotateAngleZ = z;
}
+ /**
+ * @param f
+ * @param f1
+ * @param f2
+ * @param f3
+ * @param f4
+ * @param f5
+ */
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
}
-
}
diff --git a/java/darkknight/jewelrycraft/network/PacketClearColorCache.java b/java/darkknight/jewelrycraft/network/PacketClearColorCache.java
index edfcadd..4d8351c 100644
--- a/java/darkknight/jewelrycraft/network/PacketClearColorCache.java
+++ b/java/darkknight/jewelrycraft/network/PacketClearColorCache.java
@@ -1,7 +1,7 @@
package darkknight.jewelrycraft.network;
-import net.minecraft.nbt.NBTTagCompound;
import io.netty.buffer.ByteBuf;
+import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
@@ -9,10 +9,18 @@ import darkknight.jewelrycraft.JewelrycraftMod;
public class PacketClearColorCache implements IMessage, IMessageHandler<PacketClearColorCache, IMessage>
{
+
+ /**
+ *
+ */
public PacketClearColorCache()
- {
- }
+ {}
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
@Override
public IMessage onMessage(PacketClearColorCache message, MessageContext ctx)
{
@@ -20,13 +28,17 @@ public class PacketClearColorCache implements IMessage, IMessageHandler<PacketCl
return null;
}
+ /**
+ * @param buf
+ */
@Override
public void fromBytes(ByteBuf buf)
- {
- }
+ {}
+ /**
+ * @param buf
+ */
@Override
public void toBytes(ByteBuf buf)
- {
- }
+ {}
}
diff --git a/java/darkknight/jewelrycraft/network/PacketHandler.java b/java/darkknight/jewelrycraft/network/PacketHandler.java
index 0ed0843..3cbea83 100644
--- a/java/darkknight/jewelrycraft/network/PacketHandler.java
+++ b/java/darkknight/jewelrycraft/network/PacketHandler.java
@@ -1,6 +1,4 @@
package darkknight.jewelrycraft.network;
public class PacketHandler
-{
-
-}
+{}
diff --git a/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java b/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java
index c810efd..13d0969 100644
--- a/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java
+++ b/java/darkknight/jewelrycraft/network/PacketKeyPressEvent.java
@@ -2,7 +2,6 @@ package darkknight.jewelrycraft.network;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
-import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
@@ -12,32 +11,46 @@ public class PacketKeyPressEvent implements IMessage, IMessageHandler<PacketKeyP
{
public int actionID;
+ /**
+ * @param id
+ */
public PacketKeyPressEvent(int id)
{
actionID = id;
}
+ /**
+ *
+ */
public PacketKeyPressEvent()
- {
- }
-
+ {}
+
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
@Override
public IMessage onMessage(PacketKeyPressEvent message, MessageContext ctx)
{
EntityPlayer sender = ctx.getServerHandler().playerEntity;
-
// Jewelry inventory
if (message.actionID == 0) sender.openGui(JewelrycraftMod.instance, 2, sender.worldObj, (int)sender.posX, (int)sender.posY, (int)sender.posZ);
-
return null;
}
-
+
+ /**
+ * @param buf
+ */
@Override
public void fromBytes(ByteBuf buf)
{
actionID = buf.readInt();
}
-
+
+ /**
+ * @param buf
+ */
@Override
public void toBytes(ByteBuf buf)
{
diff --git a/java/darkknight/jewelrycraft/network/PacketRequestLiquidData.java b/java/darkknight/jewelrycraft/network/PacketRequestLiquidData.java
index 6fd3274..ebcfdf4 100644
--- a/java/darkknight/jewelrycraft/network/PacketRequestLiquidData.java
+++ b/java/darkknight/jewelrycraft/network/PacketRequestLiquidData.java
@@ -1,23 +1,27 @@
package darkknight.jewelrycraft.network;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
import io.netty.buffer.ByteBuf;
-import cpw.mods.fml.common.network.handshake.NetworkDispatcher;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.util.JewelryNBT;
public class PacketRequestLiquidData implements IMessage, IMessageHandler<PacketRequestLiquidData, IMessage>
{
int dimID, x, y, z;
+ /**
+ *
+ */
public PacketRequestLiquidData()
- {
- }
+ {}
+ /**
+ * @param dimID
+ * @param x
+ * @param y
+ * @param z
+ */
public PacketRequestLiquidData(int dimID, int x, int y, int z)
{
this.dimID = dimID;
@@ -26,34 +30,35 @@ public class PacketRequestLiquidData implements IMessage, IMessageHandler<Packet
this.z = z;
}
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
@Override
public IMessage onMessage(PacketRequestLiquidData message, MessageContext ctx)
{
String data = JewelrycraftMod.saveData.getString(message.x + " " + message.y + " " + message.z + " " + message.dimID);
String[] splitData = data.split(":");
-
IMessage replyPacket = null;
-
- if (splitData.length == 3)
- {
+ if (splitData.length == 3){
int itemID, itemDamage, color;
- try
- {
+ try{
itemID = Integer.parseInt(splitData[0]);
itemDamage = Integer.parseInt(splitData[1]);
color = Integer.parseInt(splitData[2]);
-
- replyPacket = (IMessage) new PacketSendLiquidData(message, itemID, itemDamage, color);
+ replyPacket = new PacketSendLiquidData(message, itemID, itemDamage, color);
}
- catch (Exception e)
- {
+ catch(Exception e){
e.printStackTrace();
}
}
-
return replyPacket;
}
+ /**
+ * @param buf
+ */
@Override
public void fromBytes(ByteBuf buf)
{
@@ -63,6 +68,9 @@ public class PacketRequestLiquidData implements IMessage, IMessageHandler<Packet
z = buf.readInt();
}
+ /**
+ * @param buf
+ */
@Override
public void toBytes(ByteBuf buf)
{
diff --git a/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java b/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java
index ca74675..8491132 100644
--- a/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java
+++ b/java/darkknight/jewelrycraft/network/PacketRequestPlayerInfo.java
@@ -1,11 +1,6 @@
package darkknight.jewelrycraft.network;
-import java.util.HashMap;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.nbt.NBTTagCompound;
import io.netty.buffer.ByteBuf;
-import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
@@ -13,23 +8,35 @@ import darkknight.jewelrycraft.util.PlayerUtils;
public class PacketRequestPlayerInfo implements IMessage, IMessageHandler<PacketRequestPlayerInfo, IMessage>
{
+
+ /**
+ *
+ */
public PacketRequestPlayerInfo()
- {
- }
+ {}
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
@Override
public IMessage onMessage(PacketRequestPlayerInfo message, MessageContext ctx)
{
return new PacketSendPlayerInfo(PlayerUtils.getModPlayerPersistTag(ctx.getServerHandler().playerEntity, "Jewelrycraft"));
}
+ /**
+ * @param buf
+ */
@Override
public void fromBytes(ByteBuf buf)
- {
- }
-
+ {}
+
+ /**
+ * @param buf
+ */
@Override
public void toBytes(ByteBuf buf)
- {
- }
+ {}
}
diff --git a/java/darkknight/jewelrycraft/network/PacketSendLiquidData.java b/java/darkknight/jewelrycraft/network/PacketSendLiquidData.java
index 436daba..bad14e7 100644
--- a/java/darkknight/jewelrycraft/network/PacketSendLiquidData.java
+++ b/java/darkknight/jewelrycraft/network/PacketSendLiquidData.java
@@ -1,22 +1,28 @@
package darkknight.jewelrycraft.network;
-import net.minecraft.block.Block;
+import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.block.BlockMoltenMetal;
-import io.netty.buffer.ByteBuf;
public class PacketSendLiquidData implements IMessage, IMessageHandler<PacketSendLiquidData, IMessage>
{
int dimID, x, y, z, itemID, itemMeta, color;
+ /**
+ *
+ */
public PacketSendLiquidData()
- {
- }
+ {}
+ /**
+ * @param packet
+ * @param itemID
+ * @param itemMeta
+ * @param color
+ */
public PacketSendLiquidData(PacketRequestLiquidData packet, int itemID, int itemMeta, int color)
{
dimID = packet.dimID;
@@ -28,6 +34,15 @@ public class PacketSendLiquidData implements IMessage, IMessageHandler<PacketSen
this.color = color;
}
+ /**
+ * @param dimID
+ * @param x
+ * @param y
+ * @param z
+ * @param itemID
+ * @param itemMeta
+ * @param color
+ */
public PacketSendLiquidData(int dimID, int x, int y, int z, int itemID, int itemMeta, int color)
{
this.dimID = dimID;
@@ -39,6 +54,9 @@ public class PacketSendLiquidData implements IMessage, IMessageHandler<PacketSen
this.color = color;
}
+ /**
+ * @param buf
+ */
@Override
public void fromBytes(ByteBuf buf)
{
@@ -51,6 +69,9 @@ public class PacketSendLiquidData implements IMessage, IMessageHandler<PacketSen
color = buf.readInt();
}
+ /**
+ * @param buf
+ */
@Override
public void toBytes(ByteBuf buf)
{
@@ -63,14 +84,17 @@ public class PacketSendLiquidData implements IMessage, IMessageHandler<PacketSen
buf.writeInt(color);
}
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
@Override
public IMessage onMessage(PacketSendLiquidData message, MessageContext ctx)
{
JewelrycraftMod.clientData.setString(message.x + " " + message.y + " " + message.z + " " + message.dimID, message.itemID + ":" + message.itemMeta + ":" + message.color);
-
- Block block = Minecraft.getMinecraft().theWorld.getBlock(message.x, message.y, message.z);
+ Minecraft.getMinecraft().theWorld.getBlock(message.x, message.y, message.z);
Minecraft.getMinecraft().theWorld.markBlockForUpdate(message.x, message.y, message.z);
-
return null;
}
}
diff --git a/java/darkknight/jewelrycraft/network/PacketSendPlayerInfo.java b/java/darkknight/jewelrycraft/network/PacketSendPlayerInfo.java
index 77d0b74..e2f66a0 100644
--- a/java/darkknight/jewelrycraft/network/PacketSendPlayerInfo.java
+++ b/java/darkknight/jewelrycraft/network/PacketSendPlayerInfo.java
@@ -12,29 +12,44 @@ public class PacketSendPlayerInfo implements IMessage, IMessageHandler<PacketSen
{
public NBTTagCompound tagCompound;
+ /**
+ * @param tagCompound
+ */
public PacketSendPlayerInfo(NBTTagCompound tagCompound)
{
- this.tagCompound = tagCompound;
+ this.tagCompound = tagCompound;
}
+ /**
+ *
+ */
public PacketSendPlayerInfo()
- {
- }
-
+ {}
+
+ /**
+ * @param message
+ * @param ctx
+ * @return
+ */
@Override
public IMessage onMessage(PacketSendPlayerInfo message, MessageContext ctx)
{
- ScreenHandler.tagCache = message.tagCompound;
-
+ ScreenHandler.tagCache = message.tagCompound;
return null;
}
-
+
+ /**
+ * @param buf
+ */
@Override
public void fromBytes(ByteBuf buf)
{
tagCompound = ByteBufUtils.readTag(buf);
}
-
+
+ /**
+ * @param buf
+ */
@Override
public void toBytes(ByteBuf buf)
{
diff --git a/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java b/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java
index 923947e..70e47b0 100644
--- a/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java
+++ b/java/darkknight/jewelrycraft/particles/EntityFlatShadowFX.java
@@ -1,53 +1,60 @@
package darkknight.jewelrycraft.particles;
-import java.util.Iterator;
-import java.util.List;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLiving;
-import net.minecraft.entity.projectile.EntityThrowable;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.DamageSource;
-import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-
import org.lwjgl.opengl.GL11;
public class EntityFlatShadowFX extends EntityFX
{
float moteParticleScale;
+ ResourceLocation texture;
- public EntityFlatShadowFX(World world, double x, double y, double z, float size, float maxAge)
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param size
+ * @param maxAge
+ * @param texture
+ */
+ public EntityFlatShadowFX(World world, double x, double y, double z, float size, float maxAge, ResourceLocation texture)
{
- super(world, x, y, z, 0D, 0D, 0D);
- particleMaxAge = (int) (28D / (Math.random() * 0.3D + 0.7D) * maxAge);
+ super(world, x, y, z, 0D, 0D, 0D);
+ particleMaxAge = (int)(28D / (Math.random() * 0.3D + 0.7D) * maxAge);
particleGravity = 0F;
motionX = motionY = motionZ = 0;
particleScale = size;
noClip = true;
+ this.texture = texture;
setSize(0.1F, 0.1F);
}
+ /**
+ * @param tessellator
+ * @param partialTicks
+ * @param minX
+ * @param minY
+ * @param minZ
+ * @param maxX
+ * @param maxZ
+ */
@Override
public void renderParticle(Tessellator tessellator, float partialTicks, float minX, float minY, float minZ, float maxX, float maxZ)
{
tessellator.draw();
- ResourceLocation particle = new ResourceLocation("jewelrycraft", "textures/particle/shadows.png");
- Minecraft.getMinecraft().renderEngine.bindTexture(particle);
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
tessellator.startDrawingQuads();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthMask(false);
float scale = 1F * particleScale;
- float x = (float) (posX - interpPosX);
- float y = (float) (posX - interpPosY);
- float z = (float) (posZ - interpPosZ);
+ float x = (float)(posX - interpPosX);
+ float y = (float)(posX - interpPosY);
+ float z = (float)(posZ - interpPosZ);
tessellator.setColorRGBA_F(0F, 0F, 0F, 1F);
tessellator.addVertexWithUV(x - minX * scale - maxX * scale, y + minY * scale, z - minZ * scale - maxZ * scale, 0, 0);
tessellator.addVertexWithUV(x - minX * scale + maxX * scale, y + minY * scale, z - minZ * scale + maxZ * scale, 1, 0);
@@ -60,23 +67,25 @@ public class EntityFlatShadowFX extends EntityFX
tessellator.startDrawingQuads();
}
+ /**
+ *
+ */
@Override
public void onUpdate()
{
- this.prevPosX = this.posX;
- this.prevPosY = this.posY;
- this.prevPosZ = this.posZ;
+ prevPosX = posX;
+ prevPosY = posY;
+ prevPosZ = posZ;
motionX = motionY = motionZ = 0;
-
- if (this.particleAge++ >= this.particleMaxAge)
- {
- this.setDead();
- }
+ if (particleAge++ >= particleMaxAge) setDead();
}
+ /**
+ * @return
+ */
+ @Override
public int getFXLayer()
{
return 0;
}
-
}
diff --git a/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java b/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java
index dea107b..85dfae5 100644
--- a/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java
+++ b/java/darkknight/jewelrycraft/particles/EntityShadowsFX.java
@@ -2,48 +2,65 @@ package darkknight.jewelrycraft.particles;
import java.util.Iterator;
import java.util.List;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-
import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.damage.DamageSourceList;
public class EntityShadowsFX extends EntityFX
{
float moteParticleScale;
+ ResourceLocation texture;
- public EntityShadowsFX(World world, double x, double y, double z, float size, float maxAge)
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param size
+ * @param maxAge
+ * @param texture
+ */
+ public EntityShadowsFX(World world, double x, double y, double z, float size, float maxAge, ResourceLocation texture)
{
super(world, x, y, z, 0D, 0D, 0D);
- particleMaxAge = (int) (28D / (Math.random() * 0.3D + 0.7D) * maxAge);
+ particleMaxAge = (int)(28D / (Math.random() * 0.3D + 0.7D) * maxAge);
particleGravity = 0F;
motionX = motionY = motionZ = 0;
particleScale *= size;
moteParticleScale = particleScale;
noClip = true;
+ this.texture = texture;
setSize(0.01F, 0.01F);
}
+ /**
+ * @param tessellator
+ * @param partialTicks
+ * @param minX
+ * @param minY
+ * @param minZ
+ * @param maxX
+ * @param maxZ
+ */
@Override
public void renderParticle(Tessellator tessellator, float partialTicks, float minX, float minY, float minZ, float maxX, float maxZ)
{
tessellator.draw();
- ResourceLocation particle = new ResourceLocation("jewelrycraft", "textures/particle/shadows.png");
- Minecraft.getMinecraft().renderEngine.bindTexture(particle);
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glColor4f(1, 1, 1, 1);
tessellator.startDrawingQuads();
- tessellator.setBrightness(this.getBrightnessForRender(0));
+ tessellator.setBrightness(getBrightnessForRender(0));
float scale = 0.1F * particleScale;
- float x = (float) (posX - interpPosX);
- float y = (float) (posY - interpPosY);
- float z = (float) (posZ - interpPosZ);
+ float x = (float)(posX - interpPosX);
+ float y = (float)(posY - interpPosY);
+ float z = (float)(posZ - interpPosZ);
tessellator.setColorRGBA_F(0F, 0F, 0F, 0.5F);
tessellator.addVertexWithUV(x - minX * scale - maxX * scale, y - minY * scale, z - minZ * scale - maxZ * scale, 0, 0);
tessellator.addVertexWithUV(x - minX * scale + maxX * scale, y + minY * scale, z - minZ * scale + maxZ * scale, 1, 0);
@@ -53,35 +70,35 @@ public class EntityShadowsFX extends EntityFX
tessellator.startDrawingQuads();
}
+ /**
+ *
+ */
+ @Override
public void onUpdate()
{
- this.prevPosX = this.posX;
- this.prevPosY = this.posY;
- this.prevPosZ = this.posZ;
+ prevPosX = posX;
+ prevPosY = posY;
+ prevPosZ = posZ;
motionX = motionY = motionZ = 0;
-
- if (this.particleAge++ >= this.particleMaxAge)
- {
- this.setDead();
- }
- AxisAlignedBB axisalignedbb = this.boundingBox.expand(16.0D, 16.0D, 16.0D);
- List list1 = this.worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
- if (!this.worldObj.isRemote && list1 != null && !list1.isEmpty())
- {
+ if (particleAge++ >= particleMaxAge) setDead();
+ AxisAlignedBB axisalignedbb = boundingBox.expand(16.0D, 16.0D, 16.0D);
+ List list1 = worldObj.getEntitiesWithinAABB(Entity.class, axisalignedbb);
+ if (!worldObj.isRemote && list1 != null && !list1.isEmpty()){
Iterator iterator = list1.iterator();
-
- while (iterator.hasNext())
- {
- Entity entity = (Entity) iterator.next();
- if (entity != null && this.posX <= entity.posX + 0.5F && this.posX >= entity.posX - 0.5F && this.posZ <= entity.posZ + 0.5F && this.posZ >= entity.posZ - 0.5F) entity.attackEntityFrom(DamageSource.anvil, 100F);
+ while (iterator.hasNext()){
+ Entity entity = (Entity)iterator.next();
+ if (entity != null && posX <= entity.posX + 0.5F && posX >= entity.posX - 0.5F && posZ <= entity.posZ + 0.5F && posZ >= entity.posZ - 0.5F) entity.attackEntityFrom(DamageSourceList.shadows, 100F);
if (entity instanceof EntityThrowable) ((EntityThrowable)entity).setDead();
}
}
}
+ /**
+ * @return
+ */
+ @Override
public int getFXLayer()
{
return 2;
}
-
}
diff --git a/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java b/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java
index 10246ef..ce88f5f 100644
--- a/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java
+++ b/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java
@@ -3,7 +3,6 @@ package darkknight.jewelrycraft.recipes;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
-import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -14,10 +13,12 @@ public class CraftingRecipes
{
private static boolean isInitialized = false;
+ /**
+ * @param e
+ */
public static void preInit(FMLPreInitializationEvent e)
{
- if (!isInitialized)
- {
+ if (!isInitialized){
// Items
GameRegistry.addRecipe(new ItemStack(ItemList.thiefGloves), "x x", "yxy", "yxy", 'x', ItemList.shadowIngot, 'y', new ItemStack(Blocks.wool, 1, 15));
GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 0), "xx", 'x', Items.clay_ball);
@@ -25,27 +26,19 @@ public class CraftingRecipes
GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 2), "x x", "x x", " x ", 'x', Items.clay_ball);
GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 3), "xxx", "x x", "xxx", 'x', Items.clay_ball);
GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 4), "x x", 'x', Items.clay_ball);
+ GameRegistry.addRecipe(new ItemStack(BlockList.handPedestal, 1, 4), "bbb", " x ", "yxy", 'x', Blocks.stonebrick, 'y', new ItemStack(Blocks.stone_slab, 1, 5), 'b', Blocks.cobblestone_wall);
+ GameRegistry.addRecipe(new ItemStack(BlockList.shadowEye, 1, 4), "bcb", "cec", "bcb", 'b', Blocks.stonebrick, 'c', new ItemStack(Blocks.stained_hardened_clay, 1, 15), 'e', Items.ender_eye);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ItemList.crystal, 1, 15), " x ", "x x", " x ", 'x', Blocks.glass));
- for (int i = 0; i < 15; i++)
- {
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.crystal, 1, i), new Object[]
- { new ItemStack(ItemList.crystal, 1, 15), new ItemStack(Items.dye, 1, i) });
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.crystal, 1, 15), new Object[]
- { new ItemStack(ItemList.crystal, 1, i), new ItemStack(Items.dye, 1, 15) });
+ for(int i = 0; i < 15; i++){
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.crystal, 1, i), new Object[]{new ItemStack(ItemList.crystal, 1, 15), new ItemStack(Items.dye, 1, i)});
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.crystal, 1, 15), new Object[]{new ItemStack(ItemList.crystal, 1, i), new ItemStack(Items.dye, 1, 15)});
}
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.shadowIngot, 9), new Object[]
- { new ItemStack(BlockList.shadowBlock) });
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]
- { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 0) });
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]
- { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 1) });
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]
- { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 2) });
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]
- { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 3) });
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]
- { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 4) });
-
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.shadowIngot, 9), new Object[]{new ItemStack(BlockList.shadowBlock)});
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 0)});
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 1)});
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 2)});
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 3)});
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 4)});
// Blocks
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.molder), "x x", "xxx", 'x', Blocks.cobblestone));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.smelter), "xyx", "x x", "xzx", 'x', Blocks.cobblestone, 'y', Items.bucket, 'z', Items.lava_bucket));
@@ -53,7 +46,6 @@ public class CraftingRecipes
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.displayer, 2), " x ", "xxx", "yyy", 'x', Items.iron_ingot, 'y', Blocks.emerald_block));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.shadowBlock, 1), "xxx", "xxx", "xxx", 'x', ItemList.shadowIngot));
GameRegistry.addRecipe(new ItemStack(BlockList.jewelAltar, 1), "sws", "bwb", "bbb", 's', Blocks.end_stone, 'w', new ItemStack(Blocks.wool, 1, 5), 'b', Blocks.nether_brick);
-
// Smelting
GameRegistry.addSmelting(BlockList.shadowOre, new ItemStack(ItemList.shadowIngot), 1.5f);
GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(ItemList.molds, 1, 0), 0.2F);
@@ -61,7 +53,6 @@ public class CraftingRecipes
GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(ItemList.molds, 1, 2), 0.2F);
GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 3), new ItemStack(ItemList.molds, 1, 3), 0.2F);
GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 4), new ItemStack(ItemList.molds, 1, 4), 0.2F);
-
isInitialized = true;
}
}
diff --git a/java/darkknight/jewelrycraft/renders/TileEntityHandPedestalRender.java b/java/darkknight/jewelrycraft/renders/TileEntityHandPedestalRender.java
deleted file mode 100644
index 2721966..0000000
--- a/java/darkknight/jewelrycraft/renders/TileEntityHandPedestalRender.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package darkknight.jewelrycraft.renders;
-
-import java.awt.Color;
-
-import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemMap;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.world.World;
-
-import org.lwjgl.opengl.GL11;
-
-import darkknight.jewelrycraft.model.ModelDisplayer;
-import darkknight.jewelrycraft.model.ModelHandPedestal;
-import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
-
-public class TileEntityHandPedestalRender extends TileEntitySpecialRenderer
-{
- ModelHandPedestal model = new ModelHandPedestal();
- String texture = "textures/tileentities/BricksPedestal.png";
-
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
- TileEntityHandPedestal tile = (TileEntityHandPedestal) te;
-
- ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
-
- GL11.glPushMatrix();
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try
- {
- int block = tile.getBlockMetadata();
- if (block == 0) GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
- else if (block == 1) GL11.glRotatef(225F, 0.0F, 1.0F, 0.0F);
- else if (block == 2) GL11.glRotatef(270F, 0.0F, 1.0F, 0.0F);
- else if (block == 3) GL11.glRotatef(315F, 0.0F, 1.0F, 0.0F);
- else if (block == 4) GL11.glRotatef(0F, 0.0F, 1.0F, 0.0F);
- else if (block == 5) GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
- else if (block == 6) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
- else if (block == 7) GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F);
- }
- catch (Exception e)
- {
- }
- model.render((Entity) null, 0, 0, 0, 0.0F, 0.0F, 0.0625F);
- if (tile != null && tile.hasObject && tile.object != null && tile.object != new ItemStack(Item.getItemById(0), 0, 0))
- {
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, tile.object);
- entityitem.hoverStart = 0.0F;
- tile.object.stackSize = 1;
- GL11.glTranslatef(0.0F, 0.4F, 0.2F);
- GL11.glRotatef(180F, 1F, 0F, 0F);
- GL11.glRotatef(90F, 1F, 0F, 0F);
- if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
- GL11.glRotatef(180F, 0F, 1F, 0F);
- RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.options.fancyGraphics = false;
- }
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
- GL11.glPopMatrix();
- GL11.glPopMatrix();
- }
-
- public void adjustLightFixture(World world, int i, int j, int k, Block block)
- {
- Tessellator tess = Tessellator.instance;
- float brightness = block.getLightOpacity(world, i, j, k);
- int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
- int modulousModifier = skyLight % 65536;
- int divModifier = skyLight / 65536;
- tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
- }
-} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/renders/TileEntityShadowHandRender.java b/java/darkknight/jewelrycraft/renders/TileEntityShadowHandRender.java
deleted file mode 100644
index c6595a4..0000000
--- a/java/darkknight/jewelrycraft/renders/TileEntityShadowHandRender.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package darkknight.jewelrycraft.renders;
-
-import net.minecraft.block.Block;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.world.World;
-
-import org.lwjgl.opengl.GL11;
-
-import darkknight.jewelrycraft.model.ModelShadowHand;
-import darkknight.jewelrycraft.tileentity.TileEntityShadowHand;
-
-public class TileEntityShadowHandRender extends TileEntitySpecialRenderer
-{
- ModelShadowHand model = new ModelShadowHand();
- String texture = "textures/tileentities/ShadowHand.png";
-
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
- {
- GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
- TileEntityShadowHand tile = (TileEntityShadowHand) te;
-
- ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
- Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
-
- GL11.glPushMatrix();
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try
- {
- int block = tile.getBlockMetadata();
- if (block == 0) GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
- else if (block == 1) GL11.glRotatef(225F, 0.0F, 1.0F, 0.0F);
- else if (block == 2) GL11.glRotatef(270F, 0.0F, 1.0F, 0.0F);
- else if (block == 3) GL11.glRotatef(315F, 0.0F, 1.0F, 0.0F);
- else if (block == 4) GL11.glRotatef(0F, 0.0F, 1.0F, 0.0F);
- else if (block == 5) GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
- else if (block == 6) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
- else if (block == 7) GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F);
- }
- catch (Exception e)
- {
- }
- if (tile != null) model.render((Entity) null, tile.grip, 0, 0, 0.0F, 0.0F, 0.0625F);
- if (tile != null && tile.hasObject && tile.object != null && tile.object != new ItemStack(Item.getItemById(0), 0, 0))
- {
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
- EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, tile.object);
- entityitem.hoverStart = 0.0F;
- tile.object.stackSize = 1;
- GL11.glTranslatef(0.0F, 0.4F, 0.2F);
- GL11.glRotatef(180F, 1F, 0F, 0F);
- GL11.glRotatef(90F, 1F, 0F, 0F);
- if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
- GL11.glRotatef(180F, 0F, 1F, 0F);
- RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.options.fancyGraphics = false;
- }
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
- GL11.glPopMatrix();
- GL11.glPopMatrix();
- }
-
- public void adjustLightFixture(World world, int i, int j, int k, Block block)
- {
- Tessellator tess = Tessellator.instance;
- float brightness = block.getLightOpacity(world, i, j, k);
- int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
- int modulousModifier = skyLight % 65536;
- int divModifier = skyLight / 65536;
- tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
- }
-} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java b/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
index 6a43cb3..f490456 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
@@ -1,11 +1,5 @@
package darkknight.jewelrycraft.tileentity;
-import java.util.List;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -13,8 +7,6 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import darkknight.jewelrycraft.util.JewelryNBT;
public class TileEntityAltar extends TileEntity
{
@@ -22,144 +14,73 @@ public class TileEntityAltar extends TileEntity
public boolean isDirty, hasObject;
public String playerName;
+ /**
+ *
+ */
public TileEntityAltar()
{
- this.hasObject = false;
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- this.isDirty = false;
- this.playerName = "";
+ hasObject = false;
+ object = new ItemStack(Item.getItemById(0), 0, 0);
+ isDirty = false;
+ playerName = "";
}
+ /**
+ * @param nbt
+ */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
NBTTagCompound tag = new NBTTagCompound();
- this.object.writeToNBT(tag);
+ object.writeToNBT(tag);
nbt.setTag("object", tag);
nbt.setBoolean("hasObject", hasObject);
nbt.setString("playerName", playerName);
}
+ /**
+ * @param nbt
+ */
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- this.object.readFromNBT(nbt.getCompoundTag("object"));
- this.hasObject = nbt.getBoolean("hasObject");
- this.playerName = nbt.getString("playerName");
+ object = new ItemStack(Item.getItemById(0), 0, 0);
+ object.readFromNBT(nbt.getCompoundTag("object"));
+ hasObject = nbt.getBoolean("hasObject");
+ playerName = nbt.getString("playerName");
}
- @SuppressWarnings("rawtypes")
+ /**
+ *
+ */
+ @SuppressWarnings ("rawtypes")
@Override
public void updateEntity()
{
super.updateEntity();
-
- if (isDirty)
- {
+ if (isDirty){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
- 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.isGemX(object, new ItemStack(Items.ender_pearl)) && 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(Items.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(Items.dye, 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.getBlock(xCoord + i, yCoord + j, zCoord + k) == Blocks.farmland) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
- if (worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) != Blocks.farmland) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(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.isGemX(object, new ItemStack(Items.ender_pearl)) && 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(Items.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(Items.dye, 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.getBlock(xCoord + i, yCoord + j, zCoord + k) == Blocks.farmland) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
- if (worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) != Blocks.farmland) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k), 5);
- // JewelrycraftUtil.applyBonemeal(object,
- // worldObj, xCoord + i, yCoord + j, zCoord + k,
- // player);
- }
- }
- }
- }
}
+ /**
+ * @return
+ */
+ @Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
+ /**
+ * @param net
+ * @param packet
+ */
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java b/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
index 88ae7e3..b16ce31 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
@@ -12,11 +12,17 @@ public class TileEntityBlockShadow extends TileEntity
{
public int metadata;
+ /**
+ *
+ */
public TileEntityBlockShadow()
{
- this.metadata = -1;
+ metadata = -1;
}
+ /**
+ * @param nbt
+ */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -24,13 +30,19 @@ public class TileEntityBlockShadow extends TileEntity
nbt.setInteger("metadata", metadata);
}
+ /**
+ * @param nbt
+ */
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.metadata = nbt.getInteger("metadata");
+ metadata = nbt.getInteger("metadata");
}
+ /**
+ *
+ */
@Override
public void updateEntity()
{
@@ -38,33 +50,35 @@ public class TileEntityBlockShadow extends TileEntity
int blockLight, realLight;
int lightValue = worldObj.getSavedLightValue(EnumSkyBlock.Sky, xCoord, yCoord, zCoord) - worldObj.skylightSubtracted;
float sunPosAngle = worldObj.getCelestialAngleRadians(1.0F);
-
- if (sunPosAngle < (float) Math.PI) sunPosAngle += (0.0F - sunPosAngle) * 0.2F;
- else sunPosAngle += (((float) Math.PI * 2F) - sunPosAngle) * 0.2F;
-
- lightValue = Math.round((float) lightValue * MathHelper.cos(sunPosAngle));
-
+ if (sunPosAngle < (float)Math.PI) sunPosAngle += (0.0F - sunPosAngle) * 0.2F;
+ else sunPosAngle += ((float)Math.PI * 2F - sunPosAngle) * 0.2F;
+ lightValue = Math.round(lightValue * MathHelper.cos(sunPosAngle));
if (lightValue < 0) lightValue = 0;
if (lightValue > 15) lightValue = 15;
-
blockLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getSavedLightValue(EnumSkyBlock.Block, xCoord & 15, yCoord, zCoord & 15);
realLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getBlockLightValue(xCoord & 15, yCoord, zCoord & 15, 0);
-
- if ((blockLight == 0 && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) || (lightValue >= blockLight)) metadata = 15 - lightValue;
+ if (blockLight == 0 && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) || lightValue >= blockLight) metadata = 15 - lightValue;
else if (!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) metadata = 15 - realLight;
else if (lightValue < blockLight) metadata = 15 - blockLight;
-
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 2);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
}
+ /**
+ * @return
+ */
+ @Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
+ /**
+ * @param net
+ * @param packet
+ */
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java b/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
index 7a678e2..047f254 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
@@ -1,7 +1,5 @@
package darkknight.jewelrycraft.tileentity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -17,22 +15,28 @@ public class TileEntityDisplayer extends TileEntity
public ItemStack object;
public int quantity, infoIndex, timer = 0;
+ /**
+ *
+ */
public TileEntityDisplayer()
{
- this.ringTranslation1 = 0.6f;
- this.ringTranslation2 = 0.3f;
- this.ringTranslation3 = 0.0f;
- this.rotAngle = 0;
- this.quantity = 0;
- this.infoIndex = 1;
- this.isDescending1 = false;
- this.isDescending2 = false;
- this.isDescending3 = false;
- this.isDirty = false;
- this.hasObject = false;
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
+ ringTranslation1 = 0.6f;
+ ringTranslation2 = 0.3f;
+ ringTranslation3 = 0.0f;
+ rotAngle = 0;
+ quantity = 0;
+ infoIndex = 1;
+ isDescending1 = false;
+ isDescending2 = false;
+ isDescending3 = false;
+ isDirty = false;
+ hasObject = false;
+ object = new ItemStack(Item.getItemById(0), 0, 0);
}
+ /**
+ * @param nbt
+ */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -48,34 +52,39 @@ public class TileEntityDisplayer extends TileEntity
nbt.setBoolean("descending3", isDescending3);
nbt.setBoolean("hasObject", hasObject);
NBTTagCompound tag = new NBTTagCompound();
- this.object.writeToNBT(tag);
+ object.writeToNBT(tag);
nbt.setTag("object", tag);
}
+ /**
+ * @param nbt
+ */
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.ringTranslation1 = nbt.getFloat("translation1");
- this.ringTranslation2 = nbt.getFloat("translation2");
- this.ringTranslation3 = nbt.getFloat("translation3");
- this.rotAngle = nbt.getFloat("angle");
- this.quantity = nbt.getInteger("quantity");
- this.infoIndex = nbt.getInteger("infoIndex");
- this.isDescending1 = nbt.getBoolean("descending1");
- this.isDescending2 = nbt.getBoolean("descending2");
- this.isDescending3 = nbt.getBoolean("descending3");
- this.hasObject = nbt.getBoolean("hasObject");
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- this.object.readFromNBT(nbt.getCompoundTag("object"));
+ ringTranslation1 = nbt.getFloat("translation1");
+ ringTranslation2 = nbt.getFloat("translation2");
+ ringTranslation3 = nbt.getFloat("translation3");
+ rotAngle = nbt.getFloat("angle");
+ quantity = nbt.getInteger("quantity");
+ infoIndex = nbt.getInteger("infoIndex");
+ isDescending1 = nbt.getBoolean("descending1");
+ isDescending2 = nbt.getBoolean("descending2");
+ isDescending3 = nbt.getBoolean("descending3");
+ hasObject = nbt.getBoolean("hasObject");
+ object = new ItemStack(Item.getItemById(0), 0, 0);
+ object.readFromNBT(nbt.getCompoundTag("object"));
}
+ /**
+ *
+ */
@Override
public void updateEntity()
{
super.updateEntity();
- if (isDirty)
- {
+ if (isDirty){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
@@ -83,12 +92,10 @@ public class TileEntityDisplayer extends TileEntity
if (ringTranslation1 <= 0) isDescending1 = false;
if (!isDescending1) ringTranslation1 += 0.05;
if (isDescending1) ringTranslation1 -= 0.05;
-
if (ringTranslation2 >= 0.6) isDescending2 = true;
if (ringTranslation2 <= 0) isDescending2 = false;
if (!isDescending2) ringTranslation2 += 0.04;
if (isDescending2) ringTranslation2 -= 0.04;
-
if (ringTranslation3 >= 0.6) isDescending3 = true;
if (ringTranslation3 <= 0) isDescending3 = false;
if (!isDescending3) ringTranslation3 += 0.03;
@@ -96,19 +103,27 @@ public class TileEntityDisplayer extends TileEntity
if (rotAngle < 360F) rotAngle += 6F;
if (rotAngle >= 360F) rotAngle = 0F;
timer++;
- if(timer >= 20){
+ if (timer >= 20){
infoIndex++;
timer = 0;
}
}
+ /**
+ * @return
+ */
+ @Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
+ /**
+ * @param net
+ * @param packet
+ */
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java b/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java
index f42ad75..ee48d08 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityHandPedestal.java
@@ -1,8 +1,6 @@
package darkknight.jewelrycraft.tileentity;
-import java.util.List;
-
-import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
@@ -10,59 +8,175 @@ import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
+/**
+ * @author Paul Fulham (pau101)
+ */
public class TileEntityHandPedestal extends TileEntity
{
- public boolean isDirty, hasObject;
- public ItemStack object = new ItemStack(Item.getItemById(0), 0, 0);
+ protected boolean isDirty;
+ protected ItemStack heldItemStack;
+ /**
+ * When the hand is open the grip is 0 and is 20 when closed.
+ */
+ private float grip;
+ private float prevGrip;
+ private float gripMax;
+ private float gripScale;
+ private boolean isHandOpen;
+ /**
+ *
+ */
public TileEntityHandPedestal()
{
- this.isDirty = false;
- this.hasObject = false;
+ isDirty = false;
+ heldItemStack = null;
+ grip = 0;
+ gripMax = 20;
+ gripScale = 1;
+ isHandOpen = true;
}
+ /**
+ * @param tagCompound
+ */
@Override
- public void writeToNBT(NBTTagCompound nbt)
+ public void writeToNBT(NBTTagCompound tagCompound)
{
- super.writeToNBT(nbt);
- nbt.setBoolean("hasObject", hasObject);
- NBTTagCompound tag = new NBTTagCompound();
- this.object.writeToNBT(tag);
- nbt.setTag("object", tag);
+ super.writeToNBT(tagCompound);
+ if (heldItemStack != null){
+ NBTTagCompound objectCompound = new NBTTagCompound();
+ heldItemStack.writeToNBT(objectCompound);
+ tagCompound.setTag("object", objectCompound);
+ }
+ tagCompound.setBoolean("isHandOpen", isHandOpen);
}
+ /**
+ * @param tagCompound
+ */
@Override
- public void readFromNBT(NBTTagCompound nbt)
+ public void readFromNBT(NBTTagCompound tagCompound)
{
- super.readFromNBT(nbt);
- this.hasObject = nbt.getBoolean("hasObject");
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- this.object.readFromNBT(nbt.getCompoundTag("object"));
+ super.readFromNBT(tagCompound);
+ if (tagCompound.hasKey("object", 10)) setHeldItemStack(ItemStack.loadItemStackFromNBT(tagCompound.getCompoundTag("object")));
+ else removeHeldItemStack();
+ isHandOpen = tagCompound.getBoolean("isHandOpen");
}
+ /**
+ *
+ */
@Override
public void updateEntity()
{
super.updateEntity();
- if (isDirty)
- {
+ updateGrip();
+ if (isDirty){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
- //System.out.println(Item.getIdFromItem(object.getItem()));
}
+ /**
+ *
+ */
+ private void updateGrip()
+ {
+ prevGrip = grip;
+ if (grip > 0 && isHandOpen) grip -= 1 / gripScale;
+ else if (grip < gripMax && !isHandOpen) grip += 1 / gripScale;
+ }
+
+ /**
+ * @return
+ */
+ @Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound);
}
+ /**
+ * @param networkManager
+ * @param packet
+ */
@Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
+ public void onDataPacket(NetworkManager networkManager, S35PacketUpdateTileEntity packet)
{
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
-}
+
+ /**
+ *
+ */
+ @Override
+ public void markDirty()
+ {
+ super.markDirty();
+ isDirty = true;
+ }
+
+ /**
+ * @return
+ */
+ public ItemStack getHeldItemStack()
+ {
+ return heldItemStack;
+ }
+
+ /**
+ * @param heldItemStack
+ */
+ public void setHeldItemStack(ItemStack heldItemStack)
+ {
+ heldItemStack.stackSize = 1;
+ this.heldItemStack = heldItemStack;
+ if (heldItemStack.getItem() instanceof ItemBlock) gripScale = 0.5f;
+ else gripScale = 1;
+ }
+
+ /**
+ *
+ */
+ public void removeHeldItemStack()
+ {
+ heldItemStack = null;
+ }
+
+ /**
+ *
+ */
+ public void openHand()
+ {
+ isHandOpen = true;
+ }
+
+ /**
+ *
+ */
+ public void closeHand()
+ {
+ isHandOpen = false;
+ }
+
+ /**
+ * @param t
+ * @return
+ */
+ public float getGrip(float t)
+ {
+ return (prevGrip * (1 - t) + grip * t) / gripMax;
+ }
+
+ /**
+ * @return
+ */
+ public float getGripScale()
+ {
+ return gripScale;
+ }
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java b/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
index 8fcf62f..c148bd0 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
@@ -1,21 +1,13 @@
package darkknight.jewelrycraft.tileentity;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.multiplayer.WorldClient;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.potion.Potion;
-import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.MathHelper;
import darkknight.jewelrycraft.config.ConfigHandler;
-import darkknight.jewelrycraft.particles.EntityShadowsFX;
import darkknight.jewelrycraft.util.JewelryNBT;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
@@ -26,21 +18,27 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
public int carving, effect;
public float angle;
+ /**
+ *
+ */
public TileEntityJewelrsCraftingTable()
{
- this.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- this.endItem = new ItemStack(Item.getItemById(0), 0, 0);
- this.gem = new ItemStack(Item.getItemById(0), 0, 0);
- this.hasJewelry = false;
- this.hasEndItem = false;
- this.hasGem = false;
- this.crafting = false;
- this.carving = 0;
- this.effect = 0;
- this.angle = 0;
- this.isDirty = false;
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ hasJewelry = false;
+ hasEndItem = false;
+ hasGem = false;
+ crafting = false;
+ carving = 0;
+ effect = 0;
+ angle = 0;
+ isDirty = false;
}
+ /**
+ * @param nbt
+ */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -52,92 +50,79 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
nbt.setInteger("timer", carving);
nbt.setInteger("effect", effect);
nbt.setFloat("angle", angle);
-
NBTTagCompound tag1 = new NBTTagCompound();
NBTTagCompound tag2 = new NBTTagCompound();
NBTTagCompound tag3 = new NBTTagCompound();
-
- this.jewelry.writeToNBT(tag1);
+ jewelry.writeToNBT(tag1);
nbt.setTag("jewelry", tag1);
- this.endItem.writeToNBT(tag2);
+ endItem.writeToNBT(tag2);
nbt.setTag("endItem", tag2);
- this.gem.writeToNBT(tag3);
+ gem.writeToNBT(tag3);
nbt.setTag("jewel", tag3);
}
+ /**
+ * @param nbt
+ */
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.hasJewelry = nbt.getBoolean("hasJewelry");
- this.hasEndItem = nbt.getBoolean("hasEndItem");
- this.hasGem = nbt.getBoolean("hasJewel");
- this.crafting = nbt.getBoolean("crafting");
-
- this.carving = nbt.getInteger("timer");
- this.effect = nbt.getInteger("effect");
- this.angle = nbt.getFloat("angle");
- this.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
- this.jewelry.readFromNBT(nbt.getCompoundTag("jewelry"));
- this.endItem = new ItemStack(Item.getItemById(0), 0, 0);
- this.endItem.readFromNBT(nbt.getCompoundTag("endItem"));
- this.gem = new ItemStack(Item.getItemById(0), 0, 0);
- this.gem.readFromNBT(nbt.getCompoundTag("jewel"));
+ hasJewelry = nbt.getBoolean("hasJewelry");
+ hasEndItem = nbt.getBoolean("hasEndItem");
+ hasGem = nbt.getBoolean("hasJewel");
+ crafting = nbt.getBoolean("crafting");
+ carving = nbt.getInteger("timer");
+ effect = nbt.getInteger("effect");
+ angle = nbt.getFloat("angle");
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ jewelry.readFromNBT(nbt.getCompoundTag("jewelry"));
+ endItem = new ItemStack(Item.getItemById(0), 0, 0);
+ endItem.readFromNBT(nbt.getCompoundTag("endItem"));
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ gem.readFromNBT(nbt.getCompoundTag("jewel"));
}
+ /**
+ *
+ */
@Override
public void updateEntity()
{
super.updateEntity();
- if (isDirty)
- {
+ if (isDirty){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
if (angle < 360F) angle += 3F;
else angle = 0F;
-
- if (this.hasJewelry && this.hasGem && !this.hasEndItem && crafting)
- {
+ if (hasJewelry && hasGem && !hasEndItem && crafting){
if (carving > 0) carving--;
- if (crafting)
- {
- for (int l = 0; l < ConfigHandler.jewelryCraftingTime / (carving + 2); ++l)
- {
- if (worldObj.rand.nextInt(10) == 0) this.worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.orb", 0.05F, 1F);
- if (this.getBlockMetadata() == 0) this.worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
- if (this.getBlockMetadata() == 1) this.worldObj.spawnParticle("instantSpell", xCoord + 0.8F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
- if (this.getBlockMetadata() == 2) this.worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.8F, 0.0D, 0.0D, 0.0D);
- if (this.getBlockMetadata() == 3) this.worldObj.spawnParticle("instantSpell", xCoord + 0.2F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
-
- }
+ if (crafting) for(int l = 0; l < ConfigHandler.jewelryCraftingTime / (carving + 2); ++l){
+ if (worldObj.rand.nextInt(10) == 0) worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.orb", 0.05F, 1F);
+ if (getBlockMetadata() == 0) worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double)yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
+ if (getBlockMetadata() == 1) worldObj.spawnParticle("instantSpell", xCoord + 0.8F, (double)yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
+ if (getBlockMetadata() == 2) worldObj.spawnParticle("instantSpell", xCoord + 0.5F, (double)yCoord + 0.8F, zCoord + 0.8F, 0.0D, 0.0D, 0.0D);
+ if (getBlockMetadata() == 3) worldObj.spawnParticle("instantSpell", xCoord + 0.2F, (double)yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
}
- if (carving == 0)
- {
- this.hasEndItem = true;
- this.endItem = jewelry.copy();
- if (hasGem && gem != new ItemStack(Item.getItemById(0), 0, 0))
- {
- if (!JewelryNBT.hasTag(jewelry, "gem"))
- {
- JewelryNBT.addGem(endItem, gem);
- this.hasGem = false;
- this.gem = new ItemStack(Item.getItemById(0), 0, 0);
- }
- else
- {
- ItemStack aux = JewelryNBT.gem(jewelry);
- JewelryNBT.addGem(endItem, gem);
- if(JewelrycraftUtil.rand.nextBoolean()) gem = aux.copy();
- else
- {
- this.hasGem = false;
- this.gem = new ItemStack(Item.getItemById(0), 0, 0);
- }
+ if (carving == 0){
+ hasEndItem = true;
+ endItem = jewelry.copy();
+ if (hasGem && gem != new ItemStack(Item.getItemById(0), 0, 0)) if (!JewelryNBT.hasTag(jewelry, "gem")){
+ JewelryNBT.addGem(endItem, gem);
+ hasGem = false;
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
+ }else{
+ ItemStack aux = JewelryNBT.gem(jewelry);
+ JewelryNBT.addGem(endItem, gem);
+ if (JewelrycraftUtil.rand.nextBoolean()) gem = aux.copy();
+ else{
+ hasGem = false;
+ gem = new ItemStack(Item.getItemById(0), 0, 0);
}
}
- this.hasJewelry = false;
- this.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
+ hasJewelry = false;
+ jewelry = new ItemStack(Item.getItemById(0), 0, 0);
carving = -1;
crafting = false;
isDirty = true;
@@ -145,13 +130,21 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
}
}
+ /**
+ * @return
+ */
+ @Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
+ /**
+ * @param net
+ * @param packet
+ */
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
index 62ec130..da8cc19 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
@@ -1,7 +1,5 @@
package darkknight.jewelrycraft.tileentity;
-import net.minecraft.block.Block;
-import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -19,20 +17,26 @@ public class TileEntityMolder extends TileEntity
public ItemStack mold, jewelBase, moltenMetal, ringMetal;
public float quantity;
+ /**
+ *
+ */
public TileEntityMolder()
{
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
- this.mold = new ItemStack(Item.getItemById(0), 0, 0);
- this.ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.cooling = -1;
- this.quantity = 0f;
- this.hasJewelBase = false;
- this.hasMoltenMetal = false;
- this.hasMold = false;
- this.isDirty = false;
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
+ mold = new ItemStack(Item.getItemById(0), 0, 0);
+ ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ cooling = -1;
+ quantity = 0f;
+ hasJewelBase = false;
+ hasMoltenMetal = false;
+ hasMold = false;
+ isDirty = false;
}
+ /**
+ * @param nbt
+ */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -46,67 +50,69 @@ public class TileEntityMolder extends TileEntity
NBTTagCompound tag1 = new NBTTagCompound();
NBTTagCompound tag2 = new NBTTagCompound();
NBTTagCompound tag3 = new NBTTagCompound();
- this.mold.writeToNBT(tag);
+ mold.writeToNBT(tag);
nbt.setTag("mold", tag);
- this.jewelBase.writeToNBT(tag1);
+ jewelBase.writeToNBT(tag1);
nbt.setTag("jewelBase", tag1);
- this.moltenMetal.writeToNBT(tag2);
+ moltenMetal.writeToNBT(tag2);
nbt.setTag("moltenMetal", tag2);
- this.ringMetal.writeToNBT(tag3);
+ ringMetal.writeToNBT(tag3);
nbt.setTag("ringMetal", tag3);
}
+ /**
+ * @param nbt
+ */
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.cooling = nbt.getInteger("cooling");
- this.quantity = nbt.getFloat("quantity");
- this.hasJewelBase = nbt.getBoolean("hasJewelBase");
- this.hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
- this.hasMold = nbt.getBoolean("hasMold");
- this.mold = new ItemStack(Item.getItemById(0), 0, 0);
- this.mold.readFromNBT(nbt.getCompoundTag("mold"));
- this.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
- this.jewelBase.readFromNBT(nbt.getCompoundTag("jewelBase"));
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
- this.ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.ringMetal.readFromNBT(nbt.getCompoundTag("ringMetal"));
+ cooling = nbt.getInteger("cooling");
+ quantity = nbt.getFloat("quantity");
+ hasJewelBase = nbt.getBoolean("hasJewelBase");
+ hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
+ hasMold = nbt.getBoolean("hasMold");
+ mold = new ItemStack(Item.getItemById(0), 0, 0);
+ mold.readFromNBT(nbt.getCompoundTag("mold"));
+ jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
+ jewelBase.readFromNBT(nbt.getCompoundTag("jewelBase"));
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
+ ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ ringMetal.readFromNBT(nbt.getCompoundTag("ringMetal"));
}
+ /**
+ *
+ */
@Override
public void updateEntity()
{
super.updateEntity();
- if (isDirty)
- {
+ if (isDirty){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
- if (this.hasMoltenMetal && moltenMetal.getItem() != Item.getItemById(0) && quantity > 0f)
- {
- if (worldObj.rand.nextInt(20) == 0) this.worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.fizz", 0.5F, 1F);
- for (int l = 0; l < 2; ++l)
- this.worldObj.spawnParticle("reddust", xCoord + Math.random(), (double) yCoord + 0.2F, zCoord + Math.random(), 0.0D, 1.0D, 1.0D);
+ if (hasMoltenMetal && moltenMetal.getItem() != Item.getItemById(0) && quantity > 0f){
+ if (worldObj.rand.nextInt(20) == 0) worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.fizz", 0.5F, 1F);
+ for(int l = 0; l < 2; ++l)
+ worldObj.spawnParticle("reddust", xCoord + Math.random(), (double)yCoord + 0.2F, zCoord + Math.random(), 0.0D, 1.0D, 1.0D);
}
- if (this.hasMoltenMetal && !this.hasJewelBase && quantity >= 0.1f)
- {
+ if (hasMoltenMetal && !hasJewelBase && quantity >= 0.1f){
ringMetal = moltenMetal.copy();
- if (cooling > 0) this.cooling--;
- if (cooling <= 0f)
- {
- if (mold.getItemDamage() == 0) this.jewelBase = moltenMetal;
- else if (mold.getItemDamage() == 1) this.jewelBase = new ItemStack(ItemList.ring);
- else if (mold.getItemDamage() == 2) this.jewelBase = new ItemStack(ItemList.necklace);
- else if (mold.getItemDamage() == 3) this.jewelBase = new ItemStack(ItemList.bracelet);
- else if (mold.getItemDamage() == 4) this.jewelBase = new ItemStack(ItemList.earrings);
+ if (cooling > 0) cooling--;
+ if (cooling <= 0f){
+ if (mold.getItemDamage() == 0) jewelBase = moltenMetal;
+ else if (mold.getItemDamage() == 1) jewelBase = new ItemStack(ItemList.ring);
+ else if (mold.getItemDamage() == 2) jewelBase = new ItemStack(ItemList.necklace);
+ else if (mold.getItemDamage() == 3) jewelBase = new ItemStack(ItemList.bracelet);
+ else if (mold.getItemDamage() == 4) jewelBase = new ItemStack(ItemList.earrings);
ringMetal.stackSize = 1;
jewelBase.stackSize = 1;
if (mold.getItemDamage() != 0 && jewelBase != new ItemStack(Item.getItemById(0), 0, 0)) JewelryNBT.addMetal(jewelBase, ringMetal);
- this.hasMoltenMetal = false;
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.hasJewelBase = true;
+ hasMoltenMetal = false;
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ hasJewelBase = true;
cooling = -1;
quantity = 0f;
isDirty = true;
@@ -114,13 +120,21 @@ public class TileEntityMolder extends TileEntity
}
}
+ /**
+ * @return
+ */
+ @Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
+ /**
+ * @param net
+ * @param packet
+ */
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java b/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java
index 7a7a7c3..e02cac2 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityShadowEye.java
@@ -1,20 +1,17 @@
package darkknight.jewelrycraft.tileentity;
import java.util.ArrayList;
-import java.util.List;
-
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-import cpw.mods.fml.common.registry.GameData;
import darkknight.jewelrycraft.block.BlockHandPedestal;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.particles.EntityShadowsFX;
@@ -25,20 +22,22 @@ public class TileEntityShadowEye extends TileEntity
{
public int opening, timer, t = 20;
public boolean active;
- public int field_145926_a;
- public float field_145933_i;
- public float field_145931_j;
- public float field_145930_m;
- public float field_145927_n;
public ArrayList<ItemStack> pedestalItems = new ArrayList<ItemStack>();
+ ResourceLocation particleTexture = new ResourceLocation("jewelrycraft", "textures/particle/shadows.png");
+ /**
+ *
+ */
public TileEntityShadowEye()
{
- this.opening = 1;
- this.timer = 20;
- this.active = false;
+ opening = 1;
+ timer = 20;
+ active = false;
}
+ /**
+ * @param nbt
+ */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -48,84 +47,83 @@ public class TileEntityShadowEye extends TileEntity
nbt.setBoolean("active", active);
}
+ /**
+ * @param nbt
+ */
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.opening = nbt.getInteger("opening");
- this.timer = nbt.getInteger("timer");
- this.active = nbt.getBoolean("active");
+ opening = nbt.getInteger("opening");
+ timer = nbt.getInteger("timer");
+ active = nbt.getBoolean("active");
}
+ /**
+ *
+ */
@Override
public void updateEntity()
{
super.updateEntity();
boolean valid = isValidStructure(worldObj, xCoord, yCoord, zCoord, blockMetadata);
if (active) timer--;
- if (opening == 4 && timer <= 0)
- {
- active = false;
- }
- if (!active && timer <= 0 && opening != 1)
- {
+ if (opening == 4 && timer <= 0) active = false;
+ if (!active && timer <= 0 && opening != 1){
if (t > 0) t--;
- if (t <= 0)
- {
+ if (t <= 0){
opening--;
t = 20;
}
}
- if (opening == 4)
- {
+ if (opening == 2 && timer <= 0 && t == 10){
addData(worldObj, xCoord, yCoord, zCoord);
- TileEntityHandPedestal target = (TileEntityHandPedestal) worldObj.getTileEntity(xCoord, yCoord - 3, zCoord);
- if (target != null && target.object != null && target.object.getItem() != null) JewelryNBT.addModifiers(target.object, pedestalItems);
+ TileEntityHandPedestal target = (TileEntityHandPedestal)worldObj.getTileEntity(xCoord, yCoord - 3, zCoord);
+ if (target != null && target.getHeldItemStack() != null) JewelryNBT.addModifiers(target.getHeldItemStack(), pedestalItems);
}
- if (active && timer <= 0)
- {
- if (opening < 4)
- {
+ if (active && timer <= 0){
+ if (opening < 4){
opening++;
timer = 20;
}
- if (valid && opening == 4) timer = 200;
- else if (!valid)
- {
+ if (valid && opening == 4) timer = 1000;
+ else if (!valid){
active = false;
timer = -1;
}
}
- EntityPlayer player1 = this.worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 7F);
- if (player1 != null)
- {
+ EntityPlayer player1 = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 7F);
+ if (player1 != null){
NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player1, "Jewelrycraft");
persistTag.setBoolean("nearStartedRitual", false);
}
- if (active && opening == 4)
- {
+ if (active && opening == 4){
float din = 6F;
int i = Minecraft.getMinecraft().gameSettings.particleSetting;
-
- for (float x = -din; x <= din; x += 0.2F)
- for (float z = -din; z <= din; z += 0.2F)
- if (x * x + z * z >= din * din - 1 && x * x + z * z <= din * din + 1) Minecraft.getMinecraft().effectRenderer.addEffect(new EntityShadowsFX(worldObj, xCoord + x + 0.5F, yCoord - 0.5F, zCoord + z + 0.5F, 15F, 0.04F - 0.01F * i));
-
- for (int l = 0; l <= 2 - i; l++)
+ for(float x = -din; x <= din; x += 0.2F)
+ for(float z = -din; z <= din; z += 0.2F)
+ if (x * x + z * z >= din * din - 1 && x * x + z * z <= din * din + 1) Minecraft.getMinecraft().effectRenderer.addEffect(new EntityShadowsFX(worldObj, xCoord + x + 0.5F, yCoord - 0.5F, zCoord + z + 0.5F, 15F, 0.04F - 0.01F * i, particleTexture));
+ for(int l = 0; l <= 2 - i; l++)
worldObj.spawnParticle("depthsuspend", xCoord + 6.5F - worldObj.rand.nextInt(9) - worldObj.rand.nextFloat(), yCoord - 2F + worldObj.rand.nextFloat(), zCoord + 6.5F - worldObj.rand.nextInt(9) - worldObj.rand.nextFloat(), 0, 0, 0);
- EntityPlayer player = this.worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 6F);
- if (player != null)
- {
+ EntityPlayer player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 6F);
+ if (player != null){
NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
persistTag.setBoolean("nearStartedRitual", true);
}
}
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @param metadata
+ * @return
+ */
public boolean isValidStructure(World world, int x, int y, int z, int metadata)
{
- if (world.getBlockMetadata(x, y, z) == 0 || world.getBlockMetadata(x, y, z) == 2)
- {
+ if (world.getBlockMetadata(x, y, z) == 0 || world.getBlockMetadata(x, y, z) == 2){
// Layers from top to bottom
// 1st Layer
if (world.getBlock(x, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z) != 5) return false;
@@ -145,9 +143,7 @@ public class TileEntityShadowEye extends TileEntity
// 5th Layer
if (world.getBlock(x + 2, y - 3, z) != Blocks.stonebrick) return false;
if (world.getBlock(x - 2, y - 3, z) != Blocks.stonebrick) return false;
- }
- else if (world.getBlockMetadata(x, y, z) == 1 || world.getBlockMetadata(x, y, z) == 3)
- {
+ }else if (world.getBlockMetadata(x, y, z) == 1 || world.getBlockMetadata(x, y, z) == 3){
// Layers from top to bottom
// 1st Layer
if (world.getBlock(x, y + 1, z) != Blocks.stone_slab || world.getBlockMetadata(x, y + 1, z) != 5) return false;
@@ -189,74 +185,85 @@ public class TileEntityShadowEye extends TileEntity
if (world.getBlock(x - 4, y - 3, z + 2) != BlockList.handPedestal || world.getBlockMetadata(x - 4, y - 3, z + 2) != 1) return false;
if (world.getBlock(x - 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x - 5, y - 3, z) != 2) return false;
if (world.getBlock(x - 4, y - 3, z - 2) != BlockList.handPedestal || world.getBlockMetadata(x - 4, y - 3, z - 2) != 3) return false;
-
if (world.getBlock(x - 2, y - 3, z - 4) != BlockList.handPedestal || world.getBlockMetadata(x - 2, y - 3, z - 4) != 3) return false;
if (world.getBlock(x, y - 3, z - 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z - 5) != 4) return false;
if (world.getBlock(x + 2, y - 3, z - 4) != BlockList.handPedestal || world.getBlockMetadata(x + 2, y - 3, z - 4) != 5) return false;
-
if (world.getBlock(x + 4, y - 3, z - 2) != BlockList.handPedestal || world.getBlockMetadata(x + 4, y - 3, z - 2) != 5) return false;
if (world.getBlock(x + 5, y - 3, z) != BlockList.handPedestal || world.getBlockMetadata(x + 5, y - 3, z) != 6) return false;
if (world.getBlock(x + 4, y - 3, z + 2) != BlockList.handPedestal || world.getBlockMetadata(x + 4, y - 3, z + 2) != 7) return false;
-
if (world.getBlock(x + 2, y - 3, z + 4) != BlockList.handPedestal || world.getBlockMetadata(x + 2, y - 3, z + 4) != 7) return false;
if (world.getBlock(x, y - 3, z + 5) != BlockList.handPedestal || world.getBlockMetadata(x, y - 3, z + 5) != 0) return false;
if (world.getBlock(x - 2, y - 3, z + 4) != BlockList.handPedestal || world.getBlockMetadata(x - 2, y - 3, z + 4) != 1) return false;
return true;
}
+ /**
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ */
public void addData(World world, int x, int y, int z)
{
pedestalItems.clear();
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3, z - 4));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3, z + 2));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x, y - 3, z - 5));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3, z - 4));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 4, y - 3, z - 2));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 5, y - 3, z));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3, z - 2));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 5, y - 3, z));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 4, y - 3, z + 2));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x + 2, y - 3, z + 4));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x, y - 3, z + 5));
- addPedestalInfo((TileEntityHandPedestal) world.getTileEntity(x - 2, y - 3, z + 4));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 2, y - 3, z - 4));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 4, y - 3, z + 2));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x, y - 3, z - 5));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 2, y - 3, z - 4));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 4, y - 3, z - 2));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 5, y - 3, z));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 4, y - 3, z - 2));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 5, y - 3, z));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 4, y - 3, z + 2));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x + 2, y - 3, z + 4));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x, y - 3, z + 5));
+ addPedestalInfo((TileEntityHandPedestal)world.getTileEntity(x - 2, y - 3, z + 4));
}
+ /**
+ * @param pedestal
+ */
public void addPedestalInfo(TileEntityHandPedestal pedestal)
{
- if (pedestal != null && pedestal.object != null && pedestal.object.getItem() != null)
- {
- if (pedestalItems.isEmpty()) pedestalItems.add(pedestal.object.copy());
- else
- {
+ ItemStack heldItemStack;
+ if (pedestal != null && (heldItemStack = pedestal.getHeldItemStack()) != null){
+ if (pedestalItems.isEmpty()) pedestalItems.add(heldItemStack.copy());
+ else{
boolean hasItem = false;
int index = 0;
- for (int ind = 0; ind < pedestalItems.size() && !hasItem; ind++)
- {
- if (pedestal.object.getItem().equals(pedestalItems.get(ind).getItem()) && pedestal.object.getItemDamage() == pedestalItems.get(ind).getItemDamage())
- {
+ for(int ind = 0; ind < pedestalItems.size() && !hasItem; ind++)
+ if (heldItemStack.getItem().equals(pedestalItems.get(ind).getItem()) && heldItemStack.getItemDamage() == pedestalItems.get(ind).getItemDamage()){
index = ind;
hasItem = true;
- if (pedestal.object.hasTagCompound() && pedestalItems.get(ind).hasTagCompound() && !pedestal.object.getTagCompound().equals(pedestalItems.get(ind).getTagCompound())) hasItem = false;
+ if (heldItemStack.hasTagCompound() && pedestalItems.get(ind).hasTagCompound() && !heldItemStack.getTagCompound().equals(pedestalItems.get(ind).getTagCompound())) hasItem = false;
}
- }
- if (!hasItem) pedestalItems.add(pedestal.object.copy());
- else
- {
+ if (!hasItem) pedestalItems.add(heldItemStack.copy());
+ else{
ItemStack object = pedestalItems.get(index).copy();
object.stackSize++;
pedestalItems.set(index, object);
}
}
+ pedestal.removeHeldItemStack();
+ pedestal.openHand();
}
}
+ /**
+ * @return
+ */
+ @Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
+ /**
+ * @param net
+ * @param packet
+ */
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java b/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java
index 1a274ec..b22602e 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityShadowHand.java
@@ -1,74 +1,7 @@
package darkknight.jewelrycraft.tileentity;
-import java.util.List;
-
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.tileentity.TileEntity;
-
-public class TileEntityShadowHand extends TileEntity
-{
- public boolean isDirty, hasObject;
- public ItemStack object = new ItemStack(Item.getItemById(0), 0, 0);
- public float grip;
-
- public TileEntityShadowHand()
- {
- this.isDirty = false;
- this.hasObject = false;
- this.grip = 0f;
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setBoolean("hasObject", hasObject);
- nbt.setFloat("Grip", grip);
- NBTTagCompound tag = new NBTTagCompound();
- this.object.writeToNBT(tag);
- nbt.setTag("object", tag);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- this.hasObject = nbt.getBoolean("hasObject");
- this.grip = nbt.getFloat("Grip");
- this.object = new ItemStack(Item.getItemById(0), 0, 0);
- this.object.readFromNBT(nbt.getCompoundTag("object"));
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- if (isDirty)
- {
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if(grip <= 10f) grip++;
- else grip = 0;
- //System.out.println(Item.getIdFromItem(object.getItem()));
- }
-
- public Packet getDescriptionPacket()
- {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
- }
-
- @Override
- public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
- {
- readFromNBT(packet.func_148857_g());
- worldObj.func_147479_m(xCoord, yCoord, zCoord);
- }
-}
+/**
+ * @author Paul Fulham (pau101)
+ */
+public class TileEntityShadowHand extends TileEntityHandPedestal
+{} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
index 22d0465..83f2cb2 100644
--- a/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
@@ -1,10 +1,6 @@
package darkknight.jewelrycraft.tileentity;
import java.util.Random;
-
-import darkknight.jewelrycraft.config.ConfigHandler;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -12,6 +8,8 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class TileEntitySmelter extends TileEntity
{
@@ -20,19 +18,25 @@ public class TileEntitySmelter extends TileEntity
public ItemStack metal, moltenMetal;
public float quantity, pouredQuantity = 0.1f;
+ /**
+ *
+ */
public TileEntitySmelter()
{
- this.melting = 0;
- this.pouring = false;
- this.flow = 0;
- this.quantity = 0f;
- this.hasMetal = false;
- this.hasMoltenMetal = false;
- this.metal = new ItemStack(Item.getItemById(0), 0, 0);
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.isDirty = false;
+ melting = 0;
+ pouring = false;
+ flow = 0;
+ quantity = 0f;
+ hasMetal = false;
+ hasMoltenMetal = false;
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ isDirty = false;
}
+ /**
+ * @param nbt
+ */
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -44,121 +48,110 @@ public class TileEntitySmelter extends TileEntity
nbt.setBoolean("pouring", pouring);
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound tag1 = new NBTTagCompound();
- this.metal.writeToNBT(tag);
+ metal.writeToNBT(tag);
nbt.setTag("metal", tag);
- this.moltenMetal.writeToNBT(tag1);
+ moltenMetal.writeToNBT(tag1);
nbt.setTag("moltenMetal", tag1);
}
+ /**
+ * @param nbt
+ */
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
- this.melting = nbt.getInteger("melting");
- this.quantity = nbt.getFloat("quantity");
- this.hasMetal = nbt.getBoolean("hasMetal");
- this.hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
- this.pouring = nbt.getBoolean("pouring");
- this.metal = new ItemStack(Item.getItemById(0), 0, 0);
- this.metal.readFromNBT(nbt.getCompoundTag("metal"));
- this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
+ melting = nbt.getInteger("melting");
+ quantity = nbt.getFloat("quantity");
+ hasMetal = nbt.getBoolean("hasMetal");
+ hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
+ pouring = nbt.getBoolean("pouring");
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
+ metal.readFromNBT(nbt.getCompoundTag("metal"));
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
}
+ /**
+ *
+ */
@Override
public void updateEntity()
{
super.updateEntity();
Random rand = new Random();
- if (isDirty)
- {
+ if (isDirty){
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
if (p > 0) --p;
else p = 5;
- if (n == 0 && p == 0)
- {
+ if (n == 0 && p == 0){
flow += 16;
if (flow >= 16 * 20) n = 1;
}
- if (n == 1 && p == 0)
- {
+ if (n == 1 && p == 0){
flow -= 16;
if (flow <= 0) n = 0;
}
- if (this.hasMetal)
- {
- for (int l = 0; l < 2; ++l)
- this.worldObj.spawnParticle("flame", xCoord + rand.nextFloat(), (double) yCoord + 0.3F, zCoord + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
- }
- if (rand.nextInt(65) == 0)
- {
- double d5 = this.xCoord + rand.nextFloat();
- double d7 = this.yCoord;
- double d6 = this.zCoord + rand.nextFloat();
- this.worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
+ if (hasMetal) for(int l = 0; l < 2; ++l)
+ worldObj.spawnParticle("flame", xCoord + rand.nextFloat(), (double)yCoord + 0.3F, zCoord + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
+ if (rand.nextInt(65) == 0){
+ double d5 = xCoord + rand.nextFloat();
+ double d7 = yCoord;
+ double d6 = zCoord + rand.nextFloat();
+ worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
}
- if (this.hasMetal && !this.hasMoltenMetal)
- {
+ if (hasMetal && !hasMoltenMetal){
boolean isOre = JewelrycraftUtil.isOre(metal);
- if (melting > 0) this.melting--;
- if (melting == 0)
- {
- this.hasMetal = false;
- if (!isOre) this.moltenMetal = metal;
- else
- {
- this.moltenMetal = JewelrycraftUtil.getIngotFromOre(metal.getItem());
+ if (melting > 0) melting--;
+ if (melting == 0){
+ hasMetal = false;
+ if (!isOre) moltenMetal = metal;
+ else{
+ moltenMetal = JewelrycraftUtil.getIngotFromOre(metal.getItem());
moltenMetal.stackSize *= 2;
}
- this.hasMoltenMetal = true;
- if (!isOre) this.quantity = 0.1f * metal.stackSize;
- else this.quantity = 0.2f * metal.stackSize;
- this.metal = new ItemStack(Item.getItemById(0), 0, 0);
+ hasMoltenMetal = true;
+ if (!isOre) quantity = 0.1f * metal.stackSize;
+ else quantity = 0.2f * metal.stackSize;
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
melting = -1;
- this.isDirty = true;
+ isDirty = true;
}
- }
- else if (this.hasMoltenMetal)
- {
+ }else if (hasMoltenMetal){
boolean isOre = JewelrycraftUtil.isOre(metal);
- if (melting > 0) this.melting--;
- if (melting == 0)
- {
- this.hasMetal = false;
- if (!isOre) this.moltenMetal.stackSize += this.metal.stackSize;
- else this.moltenMetal.stackSize += this.metal.stackSize * 2;
- if (!isOre) this.quantity += 0.1f * metal.stackSize;
- else this.quantity += 0.2f * metal.stackSize;
- this.metal = new ItemStack(Item.getItemById(0), 0, 0);
+ if (melting > 0) melting--;
+ if (melting == 0){
+ hasMetal = false;
+ if (!isOre) moltenMetal.stackSize += metal.stackSize;
+ else moltenMetal.stackSize += metal.stackSize * 2;
+ if (!isOre) quantity += 0.1f * metal.stackSize;
+ else quantity += 0.2f * metal.stackSize;
+ metal = new ItemStack(Item.getItemById(0), 0, 0);
melting = -1;
- this.isDirty = true;
+ isDirty = true;
}
}
TileEntityMolder me = null;
- if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0 && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) instanceof TileEntityMolder) me = (TileEntityMolder) worldObj.getTileEntity(xCoord, yCoord, zCoord - 1);
- else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder) worldObj.getTileEntity(xCoord + 1, yCoord, zCoord);
- else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 2 && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) instanceof TileEntityMolder) me = (TileEntityMolder) worldObj.getTileEntity(xCoord, yCoord, zCoord + 1);
- else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 3 && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder) worldObj.getTileEntity(xCoord - 1, yCoord, zCoord);
- if (pouring && pouredQuantity > 0f)
- {
+ if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 0 && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord - 1) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord, yCoord, zCoord - 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1 && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord + 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord + 1, yCoord, zCoord);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 2 && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) != null && worldObj.getTileEntity(xCoord, yCoord, zCoord + 1) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord, yCoord, zCoord + 1);
+ else if (worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 3 && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) != null && worldObj.getTileEntity(xCoord - 1, yCoord, zCoord) instanceof TileEntityMolder) me = (TileEntityMolder)worldObj.getTileEntity(xCoord - 1, yCoord, zCoord);
+ if (pouring && pouredQuantity > 0f){
quantity -= 0.01f;
pouredQuantity -= 0.01f;
me.quantity += 0.01f;
- if (!me.hasMoltenMetal)
- {
+ if (!me.hasMoltenMetal){
me.moltenMetal = moltenMetal;
me.hasMoltenMetal = true;
}
- if (pouredQuantity <= 0f)
- {
+ if (pouredQuantity <= 0f){
pouring = false;
pouredQuantity = 0.1f;
me.cooling = ConfigHandler.ingotCoolingTime;
}
- if (quantity <= 0f)
- {
+ if (quantity <= 0f){
quantity = 0f;
hasMoltenMetal = false;
moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
@@ -169,13 +162,21 @@ public class TileEntitySmelter extends TileEntity
}
}
+ /**
+ * @return
+ */
+ @Override
public Packet getDescriptionPacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
- this.writeToNBT(nbttagcompound);
- return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound);
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
+ /**
+ * @param net
+ * @param packet
+ */
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
diff --git a/java/darkknight/jewelrycraft/renders/ItemRender.java b/java/darkknight/jewelrycraft/tileentity/renders/ItemRender.java
index 847766f..31e5676 100644
--- a/java/darkknight/jewelrycraft/renders/ItemRender.java
+++ b/java/darkknight/jewelrycraft/tileentity/renders/ItemRender.java
@@ -1,12 +1,11 @@
-package darkknight.jewelrycraft.renders;
-
-import org.lwjgl.opengl.GL11;
+package darkknight.jewelrycraft.tileentity.renders;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
+import org.lwjgl.opengl.GL11;
public class ItemRender implements IItemRenderer
{
@@ -14,6 +13,11 @@ public class ItemRender implements IItemRenderer
public TileEntity entity;
ModelBase model;
+ /**
+ * @param render
+ * @param entity
+ * @param model
+ */
public ItemRender(TileEntitySpecialRenderer render, TileEntity entity, ModelBase model)
{
this.entity = entity;
@@ -21,26 +25,41 @@ public class ItemRender implements IItemRenderer
this.model = model;
}
+ /**
+ * @param item
+ * @param type
+ * @return
+ */
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
+ /**
+ * @param type
+ * @param item
+ * @param helper
+ * @return
+ */
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
+ /**
+ * @param type
+ * @param item
+ * @param data
+ */
@Override
- public void renderItem(ItemRenderType type, ItemStack item, Object... data)
+ public void renderItem(ItemRenderType type, ItemStack item, Object ... data)
{
- if (type == IItemRenderer.ItemRenderType.ENTITY) {
+ if (type == IItemRenderer.ItemRenderType.ENTITY){
GL11.glRotatef(180f, 0f, 1f, 0f);
GL11.glTranslatef(-0.5f, -0.5f, -0.4f);
}
- this.render.renderTileEntityAt(this.entity, 0.0D, 0.0D, 0.0D, 0.0F);
+ render.renderTileEntityAt(entity, 0.0D, 0.0D, 0.0D, 0.0F);
}
-
}
diff --git a/java/darkknight/jewelrycraft/tileentity/renders/MaskRender.java b/java/darkknight/jewelrycraft/tileentity/renders/MaskRender.java
new file mode 100644
index 0000000..5f7a4a0
--- /dev/null
+++ b/java/darkknight/jewelrycraft/tileentity/renders/MaskRender.java
@@ -0,0 +1,63 @@
+package darkknight.jewelrycraft.tileentity.renders;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.model.ModelMask;
+import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
+
+public class MaskRender extends TileEntitySpecialRenderer
+{
+ ModelMask mask = new ModelMask();
+ ResourceLocation texture = new ResourceLocation("jewelrycraft", "textures/entities/Mask.png");
+
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
+ {
+ }
+
+ public void doRender(Entity entity, double x, double y, double z, float f, float g)
+ {
+ GL11.glPushMatrix();
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ GL11.glScalef(1.0f, 1.0f, 1.0f);
+ GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef((float)g, 0f, 1f, 0f);
+ GL11.glRotatef((float)f, 1f, 0f, 0f);
+ GL11.glTranslatef(-0.33f, -0.33f, -0.33f);
+ float relY = 0F, relZ = 0F;
+ if (f >-2 && f < 30)
+ {
+ relY = -(float)f / 90 * 0.25F;
+ if(!entity.isSneaking()) relZ = -0.1f;
+ else{
+ relZ = -0.2f;
+ relY += 0.1f;
+ }
+ }
+ else if (f > 0){
+ relY = -(float)f / 90 * 0.25F;
+ relZ = -(float)f / 90 * 0.3F;
+ if(entity.isSneaking()){
+ relZ -= 0.05f;
+ relY += 0.05f;
+ }
+ }
+ else{
+ relY = (float)f / 90 * 0.15F;
+ relZ = -(float)f / 90 * 0.15F;
+ if(entity.isSneaking()){
+ relZ -= 0.05f;
+ relY += 0.05f;
+ }
+ }
+ GL11.glTranslatef(0F, relY, relZ);
+ mask.render(entity, (float)x, (float)y, (float)z, 0F, 0F, 0.02F);
+ GL11.glPopMatrix();
+ }
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java
index 997955e..8cff8bc 100644
--- a/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
+++ b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityDisplayerRender.java
@@ -1,9 +1,8 @@
-package darkknight.jewelrycraft.renders;
+package darkknight.jewelrycraft.tileentity.renders;
import java.awt.Color;
import java.util.HashMap;
import java.util.List;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -19,9 +18,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
-
import org.lwjgl.opengl.GL11;
-
import darkknight.jewelrycraft.model.ModelDisplayer;
import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
@@ -29,8 +26,7 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
{
ModelDisplayer displayer = new ModelDisplayer();
String texture = "textures/tileentities/Displayer.png";
- HashMap<EnumChatFormatting, Integer> colors = new HashMap<EnumChatFormatting, Integer>()
- {
+ HashMap<EnumChatFormatting, Integer> colors = new HashMap<EnumChatFormatting, Integer>(){
{
put(EnumChatFormatting.AQUA, 5636095);
put(EnumChatFormatting.BLACK, 0);
@@ -51,23 +47,27 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
}
};
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
{
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
- TileEntityDisplayer disp = (TileEntityDisplayer) te;
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
+ TileEntityDisplayer disp = (TileEntityDisplayer)te;
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
-
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- displayer.render((Entity) null, disp.ringTranslation1, disp.ringTranslation2, disp.ringTranslation3, 0.0F, 0.0F, 0.0625F);
- try
- {
+ displayer.render((Entity)null, disp.ringTranslation1, disp.ringTranslation2, disp.ringTranslation3, 0.0F, 0.0F, 0.0625F);
+ try{
int block = disp.getBlockMetadata();
- if (disp != null && disp.hasObject && disp.object != null && disp.object.getItem() != null && disp.object != new ItemStack(Item.getItemById(0), 0, 0))
- {
+ if (disp != null && disp.hasObject && disp.object != null && disp.object.getItem() != null && disp.object != new ItemStack(Item.getItemById(0), 0, 0)){
int ind = -3;
GL11.glPushMatrix();
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, disp.object);
@@ -77,74 +77,68 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
GL11.glTranslatef(0.0F, -0.6F + disp.ringTranslation1 / 5, 0F);
GL11.glRotatef(disp.rotAngle, 0F, 1F, 0F);
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
+ else{
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
int i = 15728880;
int j = i % 65536;
int k = i / 65536;
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
EntityPlayer player = te.getWorldObj().getClosestPlayer(te.xCoord, te.yCoord, te.zCoord, 5D);
GL11.glPopMatrix();
GL11.glPushMatrix();
- if (player != null) renderLabel(disp.object.getDisplayName(), 0F, (-0.171F) * ind, 0F, block, disp, colors.get(disp.object.getRarity().rarityColor));
+ if (player != null) renderLabel(disp.object.getDisplayName(), 0F, -0.171F * ind, 0F, block, disp, colors.get(disp.object.getRarity().rarityColor));
GL11.glPopMatrix();
ind++;
- if (player != null && disp.quantity > 1)
- {
+ if (player != null && disp.quantity > 1){
GL11.glPushMatrix();
- renderLabel("x" + Integer.toString(disp.quantity), 0F, (-0.171F) * ind, 0F, block, disp, Color.GRAY.getRGB());
+ renderLabel("x" + Integer.toString(disp.quantity), 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
GL11.glPopMatrix();
ind++;
}
- if (disp.object.getItem() != Items.map && player != null && disp.object.getTooltip(player, true) != null)
- {
+ if (disp.object.getItem() != Items.map && player != null && disp.object.getTooltip(player, true) != null){
List tooltips = disp.object.getTooltip(player, true);
if (disp.infoIndex + 5 > tooltips.size()) disp.infoIndex = 1;
- if (tooltips.size() < 5)
- {
- for (int i = 1; i < tooltips.size(); i++)
- {
- String tooltip = tooltips.get(i).toString();
- FontRenderer fontrenderer = RenderManager.instance.getFontRenderer();
- if (tooltip != "")
- {
- GL11.glPushMatrix();
- renderLabel(tooltip, 0F, (-0.171F) * ind, 0F, block, disp, Color.GRAY.getRGB());
- GL11.glPopMatrix();
- ind++;
- }
+ if (tooltips.size() < 5) for(int i = 1; i < tooltips.size(); i++){
+ String tooltip = tooltips.get(i).toString();
+ RenderManager.instance.getFontRenderer();
+ if (tooltip != ""){
+ GL11.glPushMatrix();
+ renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
+ GL11.glPopMatrix();
+ ind++;
}
}
- else
- {
- for (int i = disp.infoIndex; i < disp.infoIndex + 5; i++)
- {
- String tooltip = tooltips.get(i).toString();
- FontRenderer fontrenderer = RenderManager.instance.getFontRenderer();
- if (tooltip != "")
- {
- GL11.glPushMatrix();
- renderLabel(tooltip, 0F, (-0.171F) * ind, 0F, block, disp, Color.GRAY.getRGB());
- GL11.glPopMatrix();
- ind++;
- }
+ else for(int i = disp.infoIndex; i < disp.infoIndex + 5; i++){
+ String tooltip = tooltips.get(i).toString();
+ RenderManager.instance.getFontRenderer();
+ if (tooltip != ""){
+ GL11.glPushMatrix();
+ renderLabel(tooltip, 0F, -0.171F * ind, 0F, block, disp, Color.GRAY.getRGB());
+ GL11.glPopMatrix();
+ ind++;
}
}
}
}
}
- catch (Exception e)
- {
- }
+ catch(Exception e){}
GL11.glPopMatrix();
GL11.glPopMatrix();
}
+ /**
+ * @param par2Str
+ * @param x
+ * @param y
+ * @param z
+ * @param metadata
+ * @param te
+ * @param color
+ */
protected void renderLabel(String par2Str, double x, double y, double z, int metadata, TileEntity te, int color)
{
FontRenderer fontrenderer = RenderManager.instance.getFontRenderer();
@@ -155,7 +149,7 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
else if (metadata == 1) GL11.glRotatef(270F, 0F, 1F, 0F);
else if (metadata == 2) GL11.glRotatef(180F, 0F, 1F, 0F);
else if (metadata == 3) GL11.glRotatef(90F, 0F, 1F, 0F);
- GL11.glTranslatef((float) x, (float) y, (float) z + 0.45F);
+ GL11.glTranslatef((float)x, (float)y, (float)z + 0.45F);
GL11.glScalef(-0.015F, -var14, 0.015F);
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
@@ -166,27 +160,27 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
int j = fontrenderer.getStringWidth(par2Str) / 2;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(0.0F, 0.2F, 0.2F, 0.9F);
- tessellator.addVertex((double) (-33.333 - 0), 0D, 0.1D);
- tessellator.addVertex((double) (-33.333 - 0), 9D, 0.1D);
- tessellator.addVertex((double) (33.333 + 0), 9D, 0.1D);
- tessellator.addVertex((double) (33.333 + 0), 0D, 0.1D);
+ tessellator.addVertex(-33.333 - 0, 0D, 0.1D);
+ tessellator.addVertex(-33.333 - 0, 9D, 0.1D);
+ tessellator.addVertex(33.333 + 0, 9D, 0.1D);
+ tessellator.addVertex(33.333 + 0, 0D, 0.1D);
tessellator.draw();
- if ((fontrenderer.getStringWidth(par2Str) / 2) > 20) var17 = 0.9F / fontrenderer.getStringWidth(par2Str);
+ 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 red = color >> 16 & 0xFF;
+ int green = color >> 8 & 0xFF;
int blue = color & 0xFF;
- GL11.glTranslatef((float) x + 1f, (float) y + 1f, (float) z);
+ GL11.glTranslatef((float)x + 1f, (float)y + 1f, (float)z);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glScalef(var17 * 70F, 1F, 0F);
int i = 15728880;
int t = i % 65536;
int k = i / 65536;
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) t / 1.0F, (float) k / 1.0F);
- fontrenderer.drawString(par2Str.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 65536 * (red > 170 ? (red - 170) : 0) + 256 * (green > 170 ? (green - 170) : 0) + (blue > 170 ? (blue - 170) : 0));
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, t / 1.0F, k / 1.0F);
+ fontrenderer.drawString(par2Str.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 65536 * (red > 170 ? red - 170 : 0) + 256 * (green > 170 ? green - 170 : 0) + (blue > 170 ? blue - 170 : 0));
GL11.glPopMatrix();
- GL11.glTranslatef((float) x - 1f, (float) y - 1f, (float) z - 1F);
+ GL11.glTranslatef((float)x - 1f, (float)y - 1f, (float)z - 1F);
GL11.glScalef(var17 * 70F, 1F, 0F);
fontrenderer.drawString(par2Str, -j, 0, color);
GL11.glDisable(GL11.GL_BLEND);
@@ -194,85 +188,73 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
GL11.glPopMatrix();
}
+ /**
+ * @param str
+ * @param color
+ */
public void replaceEnumEnchValues(String str, int color)
{
- if (str.contains("§0"))
- {
+ if (str.contains("§0")){
color = Color.BLACK.getRGB();
str.replace("§0", "");
}
- if (str.contains("§1"))
- {
+ if (str.contains("§1")){
color = 85;
str.replace("§1", "");
}
- if (str.contains("§2"))
- {
+ if (str.contains("§2")){
color = 17920;
str.replace("§2", "");
}
- if (str.contains("§3"))
- {
+ if (str.contains("§3")){
color = 1336183;
str.replace("§3", "");
}
- if (str.contains("§4"))
- {
+ if (str.contains("§4")){
color = 4587520;
str.replace("§4", "");
}
- if (str.contains("§5"))
- {
+ if (str.contains("§5")){
color = 5701759;
str.replace("§5", "");
}
- if (str.contains("§6"))
- {
+ if (str.contains("§6")){
color = 16762880;
str.replace("§6", "");
}
- if (str.contains("§7"))
- {
+ if (str.contains("§7")){
color = Color.GRAY.getRGB();
str.replace("§7", "");
}
- if (str.contains("§8"))
- {
+ if (str.contains("§8")){
color = Color.DARK_GRAY.getRGB();
str.replace("§8", "");
}
- if (str.contains("§9"))
- {
+ if (str.contains("§9")){
color = Color.BLUE.getRGB();
str.replace("§9", "");
}
- if (str.contains("§a"))
- {
+ if (str.contains("§a")){
color = Color.GREEN.getRGB();
str.replace("§a", "");
}
- if (str.contains("§b"))
- {
+ if (str.contains("§b")){
color = Color.CYAN.getRGB();
str.replace("§b", "");
}
- if (str.contains("§c"))
- {
+ if (str.contains("§c")){
color = Color.RED.getRGB();
str.replace("§c", "");
}
- if (str.contains("§d"))
- {
+ if (str.contains("§d")){
color = 11665663;
str.replace("§d", "");
}
- if (str.contains("§e"))
- {
+ if (str.contains("§e")){
color = Color.YELLOW.getRGB();
str.replace("§e", "");
}
- if (str.contains("§f"))
- {
+ if (str.contains("§f")){
color = Color.WHITE.getRGB();
str.replace("§f", "");
}
diff --git a/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java
new file mode 100644
index 0000000..ac98ca6
--- /dev/null
+++ b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java
@@ -0,0 +1,47 @@
+package darkknight.jewelrycraft.tileentity.renders;
+
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.model.ModelHandPedestal;
+import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
+
+/**
+ * @author Paul Fulham (pau101)
+ */
+public class TileEntityHandPedestalRender extends TileEntitySpecialRenderer
+{
+ private ModelHandPedestal model;
+ private ResourceLocation texture;
+
+ /**
+ * @param model
+ * @param texture
+ */
+ public TileEntityHandPedestalRender(ModelHandPedestal model, ResourceLocation texture)
+ {
+ this.model = model;
+ this.texture = texture;
+ }
+
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param partialRenderTicks
+ */
+ @Override
+ public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialRenderTicks)
+ {
+ GL11.glPushMatrix();
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
+ TileEntityHandPedestal pedestal = (TileEntityHandPedestal)te;
+ bindTexture(texture);
+ GL11.glRotatef(180, 0, 0, 1);
+ GL11.glRotatef(pedestal.getWorldObj() == null ? 180 : pedestal.getBlockMetadata() % 8 / 8F * 360, 0, 1, 0);
+ model.render(pedestal, partialRenderTicks, 0.0625F);
+ GL11.glPopMatrix();
+ }
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java
index 78d9e50..7a8e35b 100644
--- a/java/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java
+++ b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityJewelrsCraftingTableRender.java
@@ -1,9 +1,5 @@
-package darkknight.jewelrycraft.renders;
+package darkknight.jewelrycraft.tileentity.renders;
-import org.lwjgl.opengl.GL11;
-
-import darkknight.jewelrycraft.model.ModelJewlersCraftingBench;
-import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -15,109 +11,98 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.model.ModelJewlersCraftingBench;
+import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRenderer
{
ModelJewlersCraftingBench modelTable = new ModelJewlersCraftingBench();
String texture = "textures/tileentities/JewelrsCraftingBench.png";
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
{
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
-
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- TileEntityJewelrsCraftingTable jt = (TileEntityJewelrsCraftingTable) te;
-
+ TileEntityJewelrsCraftingTable jt = (TileEntityJewelrsCraftingTable)te;
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try
- {
+ try{
int block = te.getBlockMetadata();
if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
- else if (block == 2)
- {
+ else if (block == 2){
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- }
- else if (block == 3)
- {
+ }else if (block == 3){
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
}
}
- catch (Exception e)
- {
- }
-
- modelTable.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- if (jt != null)
- {
- if (jt.hasJewelry && jt.jewelry.getIconIndex() != null && jt.jewelry.getIconIndex().getIconName() != "")
- {
+ catch(Exception e){}
+ modelTable.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
+ if (jt != null){
+ if (jt.hasJewelry && jt.jewelry.getIconIndex() != null && jt.jewelry.getIconIndex().getIconName() != ""){
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.jewelry);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
-
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(0.55F, -1.5F, -0.45F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
+ else{
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
-
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
- if (jt.hasEndItem && jt.endItem.getIconIndex().getIconName() != "")
- {
+ if (jt.hasEndItem && jt.endItem.getIconIndex().getIconName() != ""){
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.endItem);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
-
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(0.0F, -1.6F, 0.6F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
+ else{
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
-
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
- if (jt.hasGem && jt.gem.getIconIndex().getIconName() != "")
- {
+ if (jt.hasGem && jt.gem.getIconIndex().getIconName() != ""){
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.gem);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
-
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(-0.55F, -1.5F, -0.45F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
+ else{
GL11.glRotatef(180F, 0F, 1F, 0F);
RenderManager.instance.options.fancyGraphics = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
@@ -127,11 +112,17 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
GL11.glPopMatrix();
}
}
-
GL11.glPopMatrix();
GL11.glPopMatrix();
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ */
public void adjustLightFixture(World world, int i, int j, int k, Block block)
{
Tessellator tess = Tessellator.instance;
@@ -140,7 +131,6 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
int modulousModifier = skyLight % 65536;
int divModifier = skyLight / 65536;
tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
}
-
}
diff --git a/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java
index 29598c4..9685e2e 100644
--- a/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
+++ b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityMolderRender.java
@@ -1,12 +1,5 @@
-package darkknight.jewelrycraft.renders;
+package darkknight.jewelrycraft.tileentity.renders;
-import org.lwjgl.opengl.GL11;
-
-import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.item.ItemList;
-import darkknight.jewelrycraft.model.ModelMolder;
-import darkknight.jewelrycraft.tileentity.TileEntityMolder;
-import darkknight.jewelrycraft.util.JewelryNBT;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -22,80 +15,84 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
+import org.lwjgl.opengl.GL11;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.model.ModelMolder;
+import darkknight.jewelrycraft.tileentity.TileEntityMolder;
+import darkknight.jewelrycraft.util.JewelryNBT;
public class TileEntityMolderRender extends TileEntitySpecialRenderer
{
ModelMolder modelMolder = new ModelMolder();
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
{
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
- TileEntityMolder me = (TileEntityMolder) te;
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
+ TileEntityMolder me = (TileEntityMolder)te;
String texture = "textures/tileentities/Molder.png";
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try
- {
+ try{
int block = me.getBlockMetadata();
if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
else if (block == 2){
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- }
- else if (block == 3){
+ }else if (block == 3){
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
}
}
- catch (Exception e)
- {
- }
- modelMolder.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- if (me != null)
- {
- if (me.hasMold)
- {
+ catch(Exception e){}
+ modelMolder.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
+ boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics;
+ if (me != null){
+ if (me.hasMold){
GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.mold);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
- GL11.glTranslatef(0F, 1.312F, -0.25F);
+ GL11.glTranslatef(0F, 1.43F, -0.28F);
GL11.glScalef(1.25F, 1.0F, 1.25F);
GL11.glRotatef(90F, 1F, 0F, 0f);
- RenderItem.renderInFrame = true;
- if (entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderItem.renderInFrame = false;
- GL11.glEnable(GL11.GL_LIGHTING);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
+ if (entityitem != null){
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.03D, 0.0F, 0.0F);
+ }
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
GL11.glPopMatrix();
}
- if (me.hasJewelBase && me.jewelBase.getIconIndex() != null && me.jewelBase.getIconIndex().getIconName() != "")
- {
+ if (me.hasJewelBase && me.jewelBase.getIconIndex() != null && me.jewelBase.getIconIndex().getIconName() != ""){
GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, me.jewelBase);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
- GL11.glTranslatef(0F, 1.312F, -0.25F);
+ GL11.glTranslatef(0F, 1.4F, -0.28F);
GL11.glScalef(1.25F, 1.0F, 1.25F);
GL11.glRotatef(90F, 1F, 0F, 0f);
- RenderItem.renderInFrame = true;
- if (entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderItem.renderInFrame = false;
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
+ if (entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.01D, 0.0F, 0.0F);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
GL11.glColor4f(1, 1F, 1F, 1.0F);
- GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
- if (me.hasMoltenMetal && me.moltenMetal != null && me.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0))
- {
+ if (me.hasMoltenMetal && me.moltenMetal != null && me.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0)){
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
- if (JewelrycraftMod.fancyRender)
- {
+ if (JewelrycraftMod.fancyRender){
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(1, 1, 0, 0);
}
@@ -106,8 +103,7 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal);
moltenMetal.getEntityItem().stackSize = 1;
moltenMetal.hoverStart = 0.0F;
-
- GL11.glTranslatef(-0F, 1.33f - 0.005f * me.quantity, -0.29F);
+ GL11.glTranslatef(-0F, 1.38f - 0.005f * me.quantity, -0.29F);
GL11.glScalef(1.1F, 1.0F, 1.4F);
GL11.glRotatef(90F, 1F, 0F, 0f);
RenderItem.renderInFrame = true;
@@ -122,6 +118,13 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
GL11.glPopMatrix();
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ */
public void adjustLightFixture(World world, int i, int j, int k, Block block)
{
Tessellator tess = Tessellator.instance;
@@ -130,7 +133,6 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
int modulousModifier = skyLight % 65536;
int divModifier = skyLight / 65536;
tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
}
-
}
diff --git a/java/darkknight/jewelrycraft/renders/TileEntityShadowEyeRender.java b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java
index 1365f37..7bf2363 100644
--- a/java/darkknight/jewelrycraft/renders/TileEntityShadowEyeRender.java
+++ b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowEyeRender.java
@@ -1,4 +1,4 @@
-package darkknight.jewelrycraft.renders;
+package darkknight.jewelrycraft.tileentity.renders;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -10,62 +10,62 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-
import org.lwjgl.opengl.GL11;
-
import darkknight.jewelrycraft.model.ModelShadowEye;
-import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
import darkknight.jewelrycraft.tileentity.TileEntityShadowEye;
public class TileEntityShadowEyeRender extends TileEntitySpecialRenderer
{
ModelShadowEye eye = new ModelShadowEye();
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
{
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.6F, (float) z + 0.5F);
-
- TileEntityShadowEye eyeS = (TileEntityShadowEye) te;
-
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.6F, (float)z + 0.5F);
+ TileEntityShadowEye eyeS = (TileEntityShadowEye)te;
String texture = "textures/tileentities/ShadowEye" + eyeS.opening + ".png";
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
-
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try
- {
+ try{
int block = te.getBlockMetadata();
if (block == 0) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
else if (block == 1){
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- }
- else if (block == 2){
+ }else if (block == 2){
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
}
}
- catch (Exception e)
- {
- }
-
- try
- {
+ catch(Exception e){}
+ try{
EntityPlayer player = te.getWorldObj().getClosestPlayer(te.xCoord, te.yCoord, te.zCoord, 16D);
if (player != null) eye.render(player, te.xCoord, te.yCoord, te.zCoord, te.blockMetadata, eyeS.opening, 0.0625F);
}
- catch (Exception e)
- {
- eye.render((Entity) null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
+ catch(Exception e){
+ eye.render((Entity)null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
}
-
GL11.glPopMatrix();
GL11.glPopMatrix();
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param block
+ */
public void adjustLightFixture(World world, int i, int j, int k, Block block)
{
Tessellator tess = Tessellator.instance;
@@ -74,7 +74,6 @@ public class TileEntityShadowEyeRender extends TileEntitySpecialRenderer
int modulousModifier = skyLight % 65536;
int divModifier = skyLight / 65536;
tess.setColorOpaque_F(brightness, brightness, brightness);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, modulousModifier, divModifier);
}
-
}
diff --git a/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java
new file mode 100644
index 0000000..d0e2799
--- /dev/null
+++ b/java/darkknight/jewelrycraft/tileentity/renders/TileEntityShadowHandRender.java
@@ -0,0 +1,20 @@
+package darkknight.jewelrycraft.tileentity.renders;
+
+import net.minecraft.util.ResourceLocation;
+import darkknight.jewelrycraft.model.ModelHandPedestal;
+
+/**
+ * @author Paul Fulham (pau101)
+ */
+public class TileEntityShadowHandRender extends TileEntityHandPedestalRender
+{
+
+ /**
+ * @param model
+ * @param texture
+ */
+ public TileEntityShadowHandRender(ModelHandPedestal model, ResourceLocation texture)
+ {
+ super(model, texture);
+ }
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java b/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java
index 0e51e7f..e6a92a5 100644
--- a/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
+++ b/java/darkknight/jewelrycraft/tileentity/renders/TileEntitySmelterRender.java
@@ -1,9 +1,8 @@
-package darkknight.jewelrycraft.renders;
+package darkknight.jewelrycraft.tileentity.renders;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@@ -13,13 +12,9 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
-
import org.lwjgl.opengl.GL11;
-
import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.model.ModelSmelter;
import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
@@ -28,45 +23,43 @@ import darkknight.jewelrycraft.util.JewelryNBT;
public class TileEntitySmelterRender extends TileEntitySpecialRenderer
{
ModelSmelter modelSmelter = new ModelSmelter();
-
public static final float p = 1 / 16, p3 = 3 * p, p13 = 13 * p, p15 = 15 * p;
+ /**
+ * @param te
+ * @param x
+ * @param y
+ * @param z
+ * @param scale
+ */
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
{
GL11.glPushMatrix();
- GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
+ GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
String texture = "textures/tileentities/Smelter.png";
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- TileEntitySmelter st = (TileEntitySmelter) te;
+ TileEntitySmelter st = (TileEntitySmelter)te;
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- try
- {
+ try{
int block = te.getBlockMetadata();
if (block == 1) GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
- else if (block == 2)
- {
+ else if (block == 2){
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- }
- else if (block == 3)
- {
+ }else if (block == 3){
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
}
}
- catch (Exception e)
- {
- }
- modelSmelter.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
-
- if (scale != 0)
- {
+ catch(Exception e){}
+ boolean fancyGraphics = Minecraft.getMinecraft().gameSettings.fancyGraphics;
+ modelSmelter.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
+ if (scale != 0){
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
- if (JewelrycraftMod.fancyRender)
- {
+ if (JewelrycraftMod.fancyRender){
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(1, 1, 0, 0);
}
@@ -79,45 +72,33 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
int i = 15728880;
int j = i % 65536;
int k = i / 65536;
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
+ OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, j / 1.0F, k / 1.0F);
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
if (JewelrycraftMod.fancyRender) GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
-
- if (st != null)
- {
- if (st.hasMetal && st.metal != null && st.metal.getItem() != null)
- {
+ if (st != null){
+ if (st.hasMetal && st.metal != null && st.metal.getItem() != null){
GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_LIGHTING);
EntityItem metal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, st.metal);
metal.getEntityItem().stackSize = 1;
metal.hoverStart = 0.0F;
-
GL11.glRotatef(-50F, 1F, 0F, 0F);
GL11.glRotatef(-50F, 0F, 0F, 1F);
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(-0.9F, -0.9F, -1.6F);
- if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- else
- {
- RenderManager.instance.options.fancyGraphics = true;
- RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderManager.instance.options.fancyGraphics = false;
- }
- GL11.glEnable(GL11.GL_LIGHTING);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = true;
+ RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ Minecraft.getMinecraft().gameSettings.fancyGraphics = fancyGraphics;
GL11.glPopMatrix();
}
- if (st.hasMoltenMetal && st.moltenMetal != null && st.moltenMetal.getItem() != null)
- {
+ if (st.hasMoltenMetal && st.moltenMetal != null && st.moltenMetal.getItem() != null){
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
- if (JewelrycraftMod.fancyRender)
- {
+ if (JewelrycraftMod.fancyRender){
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(1, 1, 0, 0);
}
@@ -128,7 +109,6 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, metal);
moltenMetal.getEntityItem().stackSize = 1;
moltenMetal.hoverStart = 0.0F;
-
GL11.glTranslatef(-0F, 1.00f - .4F * st.quantity, -0.14F);
GL11.glScalef(0.71F, 1F, 0.84F);
GL11.glRotatef(90F, 1F, 0F, 0f);
diff --git a/java/darkknight/jewelrycraft/util/BlockUtils.java b/java/darkknight/jewelrycraft/util/BlockUtils.java
index 385c175..18cb9eb 100644
--- a/java/darkknight/jewelrycraft/util/BlockUtils.java
+++ b/java/darkknight/jewelrycraft/util/BlockUtils.java
@@ -13,13 +13,18 @@ import net.minecraftforge.common.util.ForgeDirection;
public class BlockUtils
{
-
public static final ForgeDirection DEFAULT_BLOCK_DIRECTION = ForgeDirection.WEST;
+ /**
+ * This method is used to get the direction an entity is facing (NORTH, SOUTH, EAST or WEST) based on the entity's rotationYaw.
+ *
+ * @param entity the living entity
+ * @return a direction
+ */
public static ForgeDirection get2dOrientation(EntityLivingBase entity)
{
int l = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
- switch (l)
+ switch(l)
{
case 0:
return ForgeDirection.SOUTH;
@@ -31,12 +36,17 @@ public class BlockUtils
return ForgeDirection.EAST;
}
return ForgeDirection.SOUTH;
-
}
+ /**
+ * This gets a float value depending on a direction
+ *
+ * @param direction the forge direction
+ * @return value depending on direction
+ */
public static float getRotationFromDirection(ForgeDirection direction)
{
- switch (direction)
+ switch(direction)
{
case NORTH:
return 0F;
@@ -55,16 +65,29 @@ public class BlockUtils
}
}
+ /**
+ * This method is used to get the direction an entity is looking at (UP or DOWN) based on the entitiy's rotationPitch
+ *
+ * @param entity the living entity
+ * @return a forge direction
+ */
public static ForgeDirection get3dOrientation(EntityLivingBase entity)
{
- if (entity.rotationPitch > 45.5F)
- {
- return ForgeDirection.DOWN;
- }
- else if (entity.rotationPitch < -45.5F) { return ForgeDirection.UP; }
+ if (entity.rotationPitch > 45.5F) return ForgeDirection.DOWN;
+ else if (entity.rotationPitch < -45.5F) return ForgeDirection.UP;
return get2dOrientation(entity);
}
+ /**
+ * This spawns the item specified and returns the EntityItem it created
+ *
+ * @param worldObj the world
+ * @param x position of the item to drop on the X axis
+ * @param y position of the item to drop on the Y axis
+ * @param z position of the item to drop on the Z axis
+ * @param stack the item to spawn
+ * @return the EntityItem of the stack
+ */
public static EntityItem dropItemStackInWorld(World worldObj, double x, double y, double z, ItemStack stack)
{
float f = 0.7F;
@@ -73,14 +96,22 @@ public class BlockUtils
float d2 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
EntityItem entityitem = new EntityItem(worldObj, x + d0, y + d1, z + d2, stack);
entityitem.delayBeforeCanPickup = 10;
- if (stack.hasTagCompound())
- {
- entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
- }
+ if (stack.hasTagCompound()) entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
worldObj.spawnEntityInWorld(entityitem);
return entityitem;
}
+ /**
+ * It spawns the item with momentum in a certain direction
+ *
+ * @param world the world to spawn the item
+ * @param x the X coordinate to spawn it in
+ * @param y the Y coordinate to spawn it in
+ * @param z the Z coordinate to spawn it in
+ * @param direction the direction towards which it should eject
+ * @param stack the item to spawn
+ * @return the spawned EntityItem
+ */
public static EntityItem ejectItemInDirection(World world, double x, double y, double z, ForgeDirection direction, ItemStack stack)
{
EntityItem item = BlockUtils.dropItemStackInWorld(world, x, y, z, stack);
@@ -90,51 +121,35 @@ public class BlockUtils
return item;
}
+ /**
+ * Drops the content of an inventory with doubles as coordinates
+ *
+ * @param inventory the inventory the items are contained in
+ * @param world the world in which to spawn
+ * @param x the X coordinate to spawn it in
+ * @param y the Y coordinate to spawn it in
+ * @param z the Z coordinate to spawn it in
+ */
public static void dropInventory(IInventory inventory, World world, double x, double y, double z)
{
- if (inventory == null) { return; }
- for (int i = 0; i < inventory.getSizeInventory(); ++i)
- {
+ if (inventory == null) return;
+ for(int i = 0; i < inventory.getSizeInventory(); ++i){
ItemStack itemStack = inventory.getStackInSlot(i);
- if (itemStack != null)
- {
- dropItemStackInWorld(world, x, y, z, itemStack);
- }
+ if (itemStack != null) dropItemStackInWorld(world, x, y, z, itemStack);
}
}
+ /**
+ * Drops the content of an inventory with integer as coordinates
+ *
+ * @param inventory the inventory the items are contained in
+ * @param world the world in which to spawn
+ * @param x the X coordinate to spawn it in
+ * @param y the Y coordinate to spawn it in
+ * @param z the Z coordinate to spawn it in
+ */
public static void dropInventory(IInventory inventory, World world, int x, int y, int z)
{
dropInventory(inventory, world, x + 0.5, y + 0.5, z + 0.5);
}
-
- public static TileEntity getTileInDirection(TileEntity tile, ForgeDirection direction)
- {
- int targetX = tile.xCoord + direction.offsetX;
- int targetY = tile.yCoord + direction.offsetY;
- int targetZ = tile.zCoord + direction.offsetZ;
- return tile.getWorldObj().getTileEntity(targetX, targetY, targetZ);
- }
-
- public static int getFirstNonAirBlockFromTop(World world, int x, int z)
- {
- int y;
- for (y = world.getActualHeight(); world.isAirBlock(x, y - 1, z) && y > 0; y--)
- {
- }
- return y;
- }
-
- public static boolean isBlockHit(MovingObjectPosition mop, TileEntity tile)
- {
- if (tile == null) return false;
- return isBlockHit(mop, tile.xCoord, tile.yCoord, tile.zCoord);
- }
-
- public static boolean isBlockHit(MovingObjectPosition mop, int x, int y, int z)
- {
- if (mop == null) return false;
- return mop.blockX == x && mop.blockY == y && mop.blockZ == z;
- }
-
} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/util/JewelryNBT.java b/java/darkknight/jewelrycraft/util/JewelryNBT.java
index 3f38f94..9526a4d 100644
--- a/java/darkknight/jewelrycraft/util/JewelryNBT.java
+++ b/java/darkknight/jewelrycraft/util/JewelryNBT.java
@@ -2,14 +2,10 @@ package darkknight.jewelrycraft.util;
import java.util.ArrayList;
import java.util.List;
-import java.util.Random;
-
-import darkknight.jewelrycraft.item.ItemRing;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -28,8 +24,7 @@ public class JewelryNBT
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -44,12 +39,10 @@ public class JewelryNBT
*/
public static void addGem(ItemStack item, ItemStack gem)
{
- if (gem != null)
- {
+ if (gem != null){
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -65,17 +58,14 @@ public class JewelryNBT
*/
public static void addModifiers(ItemStack item, ArrayList<ItemStack> modifier)
{
- if (modifier != null)
- {
+ if (modifier != null){
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
- for (int i = 0; i < modifier.size(); i++)
- {
+ for(int i = 0; i < modifier.size(); i++){
NBTTagCompound modifierNBT = new NBTTagCompound();
modifier.get(i).writeToNBT(modifierNBT);
itemStackData.setTag("modifier" + i, modifierNBT);
@@ -92,8 +82,7 @@ public class JewelryNBT
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -102,12 +91,15 @@ public class JewelryNBT
itemStackData.setTag("entity", entityNBT);
}
+ /**
+ * @param item
+ * @param entity
+ */
public static void addEntityID(ItemStack item, EntityLivingBase entity)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -117,12 +109,17 @@ public class JewelryNBT
itemStackData.setTag("entityID", entityNBT);
}
+ /**
+ * @param item
+ * @param x
+ * @param y
+ * @param z
+ */
public static void addCoordonates(ItemStack item, double x, double y, double z)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -135,12 +132,18 @@ public class JewelryNBT
itemStackData.setTag("z", coords);
}
+ /**
+ * @param item
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ */
public static void addTileEntityBlock(ItemStack item, World world, int x, int y, int z)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -160,12 +163,16 @@ public class JewelryNBT
itemStackData.setTag("blockZ", block);
}
+ /**
+ * @param item
+ * @param block
+ * @param metadata
+ */
public static void addBlock(ItemStack item, int block, int metadata)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -176,12 +183,17 @@ public class JewelryNBT
itemStackData.setTag("metadata", blockNBT);
}
+ /**
+ * @param item
+ * @param x
+ * @param y
+ * @param z
+ */
public static void addBlockCoordonates(ItemStack item, int x, int y, int z)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -194,12 +206,19 @@ public class JewelryNBT
itemStackData.setTag("blockZ", coords);
}
+ /**
+ * @param item
+ * @param x
+ * @param y
+ * @param z
+ * @param dim
+ * @param name
+ */
public static void addCoordonatesAndDimension(ItemStack item, double x, double y, double z, int dim, String name)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -216,24 +235,29 @@ public class JewelryNBT
itemStackData.setTag("dimName", coords);
}
+ /**
+ * @param item
+ */
public static void addFakeEnchantment(ItemStack item)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
itemStackData.setTag("ench", new NBTTagList());
}
+ /**
+ * @param item
+ * @param color
+ */
public static void addIngotColor(ItemStack item, int color)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -243,12 +267,15 @@ public class JewelryNBT
}
// TODO
+ /**
+ * @param item
+ * @param color
+ */
public static void addGemColor(ItemStack item, int color)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -257,35 +284,44 @@ public class JewelryNBT
itemStackData.setTag("gemColor", colors);
}
- @SuppressWarnings("rawtypes")
+ /**
+ * @param item
+ * @param list
+ */
+ @SuppressWarnings ("rawtypes")
public static void addEntities(ItemStack item, List list)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ 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);
+ for(int i = 0; i < list.size(); i++)
+ ((EntityLivingBase)list.get(i)).writeToNBT(entityNBT);
itemStackData.setTag("entities", entityNBT);
}
// TODO NBT Tag Removing
+ /**
+ * @param item
+ * @param tag
+ */
public static void removeNBT(ItemStack item, String tag)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
itemStackData.removeTag(tag);
}
+ /**
+ * @param item
+ */
public static void removeEntity(ItemStack item)
{
JewelryNBT.removeNBT(item, "entityID");
@@ -293,6 +329,9 @@ public class JewelryNBT
JewelryNBT.removeNBT(item, "ench");
}
+ /**
+ * @param item
+ */
public static void removeBlock(ItemStack item)
{
JewelryNBT.removeNBT(item, "blockID");
@@ -304,12 +343,16 @@ public class JewelryNBT
}
// TODO NTB Tag Checking
+ /**
+ * @param item
+ * @param tag
+ * @return
+ */
public static boolean hasTag(ItemStack item, String tag)
{
NBTTagCompound itemStackData;
if (item.hasTagCompound()) itemStackData = item.getTagCompound();
- else
- {
+ else{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
@@ -317,53 +360,86 @@ public class JewelryNBT
return false;
}
+ /**
+ * @param stack
+ * @param gem
+ * @return
+ */
public static boolean isGemX(ItemStack stack, ItemStack gem)
{
if (gem(stack) != null && gem(stack).getItem() == gem.getItem() && gem(stack).getItemDamage() == gem.getItemDamage()) return true;
return false;
}
- public static boolean isModifierX(ItemStack stack, ItemStack modifier)
+ /**
+ * @param stack
+ * @param modifier
+ * @return
+ */
+ public static int doesModifierExist(ItemStack stack, ItemStack modifier)
{
- if (modifier(stack) != null)
- {
+ if (modifier(stack) != null){
ArrayList<ItemStack> list = modifier(stack);
- for (int i = 0; i < list.size(); i++)
- if (list.get(i).getItem() == modifier.getItem() && list.get(i).getItemDamage() == modifier.getItemDamage()) return true;
+ for(int i = 0; i < list.size(); i++)
+ if (list.get(i).getItem() == modifier.getItem() && list.get(i).getItemDamage() == modifier.getItemDamage()) return i;
}
- return false;
+ return -1;
}
+ /**
+ * @param stack
+ * @param ingot
+ * @return
+ */
public static boolean isIngotX(ItemStack stack, ItemStack ingot)
{
if (ingot(stack) != null && ingot(stack).getItem() == ingot.getItem() && ingot(stack).getItemDamage() == ingot.getItemDamage()) return true;
return false;
}
+ /**
+ * @param stack
+ * @param player
+ * @param entity
+ * @return
+ */
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;
}
+ /**
+ * @param stack
+ * @param dimName
+ * @return
+ */
public static boolean isDimNameX(ItemStack stack, String dimName)
{
if (ingot(stack) != null && dimName(stack).equals(dimName)) return true;
return false;
}
+ /**
+ * @param stack
+ * @param dimension
+ * @return
+ */
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
+ // TODO Return components based on NBT
+ /**
+ * @param stack
+ * @return
+ */
public static ItemStack gem(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("gem"))
- {
- NBTTagCompound jewelNBT = (NBTTagCompound) stack.getTagCompound().getTag("gem");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("gem")){
+ NBTTagCompound jewelNBT = (NBTTagCompound)stack.getTagCompound().getTag("gem");
ItemStack gem = new ItemStack(Item.getItemById(0), 0, 0);
gem.readFromNBT(jewelNBT);
return gem;
@@ -371,16 +447,18 @@ public class JewelryNBT
return null;
}
+ /**
+ * @param stack
+ * @return
+ */
public static ArrayList<ItemStack> modifier(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound())
- {
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound()){
int size = stack.getTagCompound().getInteger("modifierSize");
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
- for (int i = 0; i < size; i++)
- {
+ for(int i = 0; i < size; i++){
ItemStack modifier = new ItemStack(Item.getItemById(0), 0, 0);
- NBTTagCompound modifierNBT = (NBTTagCompound) stack.getTagCompound().getTag("modifier" + i);
+ NBTTagCompound modifierNBT = (NBTTagCompound)stack.getTagCompound().getTag("modifier" + i);
modifier.readFromNBT(modifierNBT);
list.add(modifier);
}
@@ -389,11 +467,14 @@ public class JewelryNBT
return null;
}
+ /**
+ * @param stack
+ * @return
+ */
public static ItemStack ingot(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingot"))
- {
- NBTTagCompound ingotNBT = (NBTTagCompound) stack.getTagCompound().getTag("ingot");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingot")){
+ NBTTagCompound ingotNBT = (NBTTagCompound)stack.getTagCompound().getTag("ingot");
ItemStack ingot = new ItemStack(Item.getItemById(0), 0, 0);
ingot.readFromNBT(ingotNBT);
return ingot;
@@ -401,167 +482,206 @@ public class JewelryNBT
return null;
}
+ /**
+ * @param stack
+ * @param player
+ * @return
+ */
public static EntityLivingBase entity(ItemStack stack, EntityPlayer player)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("entityID") && stack.getTagCompound().hasKey("entity"))
- {
- NBTTagCompound enID = (NBTTagCompound) stack.getTagCompound().getTag("entityID");
- NBTTagCompound en = (NBTTagCompound) stack.getTagCompound().getTag("entity");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("entityID") && stack.getTagCompound().hasKey("entity")){
+ NBTTagCompound enID = (NBTTagCompound)stack.getTagCompound().getTag("entityID");
+ NBTTagCompound en = (NBTTagCompound)stack.getTagCompound().getTag("entity");
int entityID = 0;
entityID = enID.getInteger("entityID");
- EntityLivingBase entity = (EntityLivingBase) EntityList.createEntityByID(entityID, player.worldObj);
- if (entity != null && entity instanceof EntityLivingBase)
- {
+ EntityLivingBase entity = (EntityLivingBase)EntityList.createEntityByID(entityID, player.worldObj);
+ if (entity != null && entity instanceof EntityLivingBase){
entity.readFromNBT(en);
return entity;
- }
- else return null;
+ }else return null;
}
return null;
}
+ /**
+ * @param stack
+ * @return
+ */
public static TileEntity tileEntity(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(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)
- {
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("tile")){
+ NBTTagCompound tileNBT = (NBTTagCompound)stack.getTagCompound().getTag("tile");
+ TileEntity tile = TileEntity.createAndLoadEntity(tileNBT);
+ if (tile != null && tile instanceof TileEntity){
tile.readFromNBT(tileNBT);
return tile;
- }
- else return null;
+ }else return null;
}
return null;
}
+ /**
+ * @param stack
+ * @return
+ */
public static String dimName(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("dimName"))
- {
- NBTTagCompound dim = (NBTTagCompound) stack.getTagCompound().getTag("dimName");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("dimName")){
+ NBTTagCompound dim = (NBTTagCompound)stack.getTagCompound().getTag("dimName");
String name = dim.getString("dimName");
return name;
}
return null;
}
+ /**
+ * @param stack
+ * @return
+ */
public static String modeName(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("mode"))
- {
- NBTTagCompound dim = (NBTTagCompound) stack.getTagCompound().getTag("mode");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("mode")){
+ NBTTagCompound dim = (NBTTagCompound)stack.getTagCompound().getTag("mode");
String name = dim.getString("mode");
return name;
}
return null;
}
+ /**
+ * @param stack
+ * @return
+ */
public static int dimension(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("dimension"))
- {
- NBTTagCompound dim = (NBTTagCompound) stack.getTagCompound().getTag("dimension");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("dimension")){
+ NBTTagCompound dim = (NBTTagCompound)stack.getTagCompound().getTag("dimension");
int dimension = dim.getInteger("dimension");
return dimension;
}
return -2;
}
+ /**
+ * @param stack
+ * @return
+ */
public static int blockCoordX(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockX"))
- {
- NBTTagCompound x = (NBTTagCompound) stack.getTagCompound().getTag("blockX");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockX")){
+ NBTTagCompound x = (NBTTagCompound)stack.getTagCompound().getTag("blockX");
int posX = x.getInteger("blockX");
return posX;
}
return -1;
}
+ /**
+ * @param stack
+ * @return
+ */
public static int blockCoordY(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockY"))
- {
- NBTTagCompound y = (NBTTagCompound) stack.getTagCompound().getTag("blockY");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockY")){
+ NBTTagCompound y = (NBTTagCompound)stack.getTagCompound().getTag("blockY");
int posY = y.getInteger("blockY");
return posY;
}
return -1;
}
+ /**
+ * @param stack
+ * @return
+ */
public static int blockCoordZ(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockZ"))
- {
- NBTTagCompound z = (NBTTagCompound) stack.getTagCompound().getTag("blockZ");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockZ")){
+ NBTTagCompound z = (NBTTagCompound)stack.getTagCompound().getTag("blockZ");
int posZ = z.getInteger("blockZ");
return posZ;
}
return -1;
}
+ /**
+ * @param stack
+ * @return
+ */
public static int blockID(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockID"))
- {
- NBTTagCompound blockID = (NBTTagCompound) stack.getTagCompound().getTag("blockID");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockID")){
+ NBTTagCompound blockID = (NBTTagCompound)stack.getTagCompound().getTag("blockID");
int blockId = blockID.getInteger("blockID");
return blockId;
}
return -1;
}
+ /**
+ * @param stack
+ * @return
+ */
public static int blockMetadata(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("metadata"))
- {
- NBTTagCompound metadataNBT = (NBTTagCompound) stack.getTagCompound().getTag("metadata");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("metadata")){
+ NBTTagCompound metadataNBT = (NBTTagCompound)stack.getTagCompound().getTag("metadata");
int metadata = metadataNBT.getInteger("metadata");
return metadata;
}
return -1;
}
+ /**
+ * @param stack
+ * @return
+ */
public static double playerPosX(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("x"))
- {
- NBTTagCompound x = (NBTTagCompound) stack.getTagCompound().getTag("x");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("x")){
+ NBTTagCompound x = (NBTTagCompound)stack.getTagCompound().getTag("x");
double posX = x.getDouble("x");
return posX;
}
return -1;
}
+ /**
+ * @param stack
+ * @return
+ */
public static double playerPosY(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("y"))
- {
- NBTTagCompound y = (NBTTagCompound) stack.getTagCompound().getTag("y");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("y")){
+ NBTTagCompound y = (NBTTagCompound)stack.getTagCompound().getTag("y");
double posY = y.getDouble("y");
return posY;
}
return -1;
}
+ /**
+ * @param stack
+ * @return
+ */
public static double playerPosZ(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("z"))
- {
- NBTTagCompound z = (NBTTagCompound) stack.getTagCompound().getTag("z");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("z")){
+ NBTTagCompound z = (NBTTagCompound)stack.getTagCompound().getTag("z");
double posZ = z.getDouble("z");
return posZ;
}
return -1;
}
+ /**
+ * @param stack
+ * @return
+ */
public static int ingotColor(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingotColor"))
- {
- NBTTagCompound colors = (NBTTagCompound) stack.getTagCompound().getTag("ingotColor");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingotColor")){
+ NBTTagCompound colors = (NBTTagCompound)stack.getTagCompound().getTag("ingotColor");
int color = colors.getInteger("ingotColor");
return color;
}
@@ -569,31 +689,36 @@ public class JewelryNBT
}
// TODO
+ /**
+ * @param stack
+ * @return
+ */
public static int gemColor(ItemStack stack)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("gemColor"))
- {
- NBTTagCompound colors = (NBTTagCompound) stack.getTagCompound().getTag("gemColor");
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("gemColor")){
+ NBTTagCompound colors = (NBTTagCompound)stack.getTagCompound().getTag("gemColor");
int color = colors.getInteger("gemColor");
return color;
}
return 16777215;
}
- @SuppressWarnings(
- { "rawtypes", "unchecked", "null" })
+ /**
+ * @param stack
+ * @param player
+ * @return
+ */
+ @SuppressWarnings ({"rawtypes", "unchecked", "null"})
public static List entities(ItemStack stack, EntityPlayer player)
{
- if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("entities"))
- {
- NBTTagCompound enID = (NBTTagCompound) stack.getTagCompound().getTag("entitiesID");
+ if (stack != null && stack != new ItemStack(Item.getItemById(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);
+ for(int element: entityID){
+ entity = (EntityLivingBase)EntityList.createEntityByID(element, player.worldObj);
list.add(entity);
}
return list;
diff --git a/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
index b61267e..70129f0 100644
--- a/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
+++ b/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
@@ -4,16 +4,19 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
-
-import cpw.mods.fml.common.registry.GameData;
-import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
+import cpw.mods.fml.common.registry.GameData;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.events.EntityEventHandler;
import darkknight.jewelrycraft.item.ItemList;
-import darkknight.jewelrycraft.lib.Reference;
+import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
public class JewelrycraftUtil
{
@@ -22,26 +25,17 @@ public class JewelrycraftUtil
public static ArrayList<ItemStack> jewelry = new ArrayList<ItemStack>();
public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
public static ArrayList<ItemStack> ores = new ArrayList<ItemStack>();
- public static HashMap<String, Integer> curseValues = new HashMap<String, Integer>();
- public static HashMap<Integer, String> curseNames = new HashMap<Integer, String>();
- public static HashMap<Integer, String> availableCurseNames = new HashMap<Integer, String>();
- public static HashMap<String, Integer> availableCurseValues = new HashMap<String, Integer>();
public static HashMap<Item, ItemStack> oreToIngot = new HashMap<Item, ItemStack>();
public static ArrayList<String> jamcraftPlayers = new ArrayList<String>();
public static Random rand = new Random();
+ /**
+ * Adds gems and jewelry to their appropriate list
+ */
public static void addStuff()
{
- // Modifiers
- for(Object item: GameData.getItemRegistry())
- {
- ArrayList<ItemStack> items = new ArrayList<ItemStack>();
- ((Item)item).getSubItems((Item)item, null, items);
- objects.addAll(items);
- }
-
// Jewels
- for (int i = 0; i < 16; i++)
+ for(int i = 0; i < 16; i++)
gem.add(new ItemStack(ItemList.crystal, 1, i));
gem.add(new ItemStack(Blocks.redstone_block));
gem.add(new ItemStack(Blocks.lapis_block));
@@ -50,56 +44,73 @@ public class JewelrycraftUtil
gem.add(new ItemStack(Items.emerald));
gem.add(new ItemStack(Items.ender_pearl));
gem.add(new ItemStack(Items.nether_star));
-
// Jewelry
jewelry.add(new ItemStack(ItemList.ring));
jewelry.add(new ItemStack(ItemList.necklace));
jewelry.add(new ItemStack(ItemList.bracelet));
jewelry.add(new ItemStack(ItemList.earrings));
-
- // Curses
- addCurse(Reference.MODNAME + ":" + "Blind", 0);
- addCurse(Reference.MODNAME + ":" + "Weak", 1);
- addCurse(Reference.MODNAME + ":" + "Anemic", 2);
- addCurse(Reference.MODNAME + ":" + "Scared", 3);
- addCurse(Reference.MODNAME + ":" + "Brave", 4);
+ for(Object item: GameData.getItemRegistry()){
+ ArrayList<ItemStack> items = new ArrayList<ItemStack>();
+ if (((Item)item).getHasSubtypes()){
+ for(int i = 0; i < ((Item)item).getMaxDamage(); i++)
+ items.add(new ItemStack((Item)item, 1, i));
+ }else objects.add(new ItemStack((Item)item));
+ if (!items.isEmpty()) objects.addAll(items);
+ }
}
- public static void jamcrafters()
+ /**
+ * Adds curse points to a player
+ * @param player the player to add the points to
+ * @param points amount of curse points
+ */
+ public static void addCursePoints(EntityPlayer player, int points)
{
- jamcraftPlayers.add("allout58");
- jamcraftPlayers.add("ChewBaker");
- jamcraftPlayers.add("domi1819");
- jamcraftPlayers.add("founderio");
- jamcraftPlayers.add("Ironhammer354");
- jamcraftPlayers.add("isomgirls6");
- jamcraftPlayers.add("jmjmjm439");
- jamcraftPlayers.add("Joban");
- jamcraftPlayers.add("KJ4IPS");
- jamcraftPlayers.add("Mitchellbrine");
- jamcraftPlayers.add("MrComputerGhost");
- jamcraftPlayers.add("MrKol999");
- jamcraftPlayers.add("Resinresin");
- jamcraftPlayers.add("sci4me");
- jamcraftPlayers.add("sor1n");
- jamcraftPlayers.add("theminecoder");
- jamcraftPlayers.add("YSPilot");
- jamcraftPlayers.add("direwolf20");
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ playerInfo.setInteger("cursePoints", playerInfo.hasKey("cursePoints") ? (playerInfo.getInteger("cursePoints") + points) : points);
+ playerInfo.setBoolean("playerCursePointsChanged", true);
}
- public static void addCurse(String name, int val)
+ public static int getCursePoints(EntityPlayer player)
{
- curseValues.put(name, val);
- curseNames.put(val, name);
- availableCurseValues.put(name, val);
- availableCurseNames.put(val, name);
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ return playerInfo.getInteger("cursePoints");
}
+ /**
+ * Adds the UUID's of the jamcrafters in a list
+ */
+ public static void jamcrafters()
+ {
+ jamcraftPlayers.add("d3214311-7550-4c9c-a372-d9292c10b8a6");
+ jamcraftPlayers.add("a690119f-c4a2-4bd6-a99d-d63679abb328");
+ jamcraftPlayers.add("de7c9903-51fa-4a24-88cd-48faf122ca36");
+ jamcraftPlayers.add("70aeb298-3a7b-46da-a393-ab10df9359f2");
+ jamcraftPlayers.add("6fbe603c-14bf-4085-afdd-abe592c26e7c");
+ jamcraftPlayers.add("b0d21306-36bf-4d85-84df-a956d183c45a");
+ jamcraftPlayers.add("1733a31f-01f9-4f4d-82aa-7de30ca810d3");
+ jamcraftPlayers.add("4833eacf-1d94-49a7-9f89-4cf88d69dcf9");
+ jamcraftPlayers.add("718cf671-9084-4e78-b91f-033e80aa11bf");
+ jamcraftPlayers.add("bea5e0c4-85c4-454d-a081-e1eaae6895ee");
+ jamcraftPlayers.add("7ecf3e2f-fedf-4f7e-8d24-6731d078db4f");
+ jamcraftPlayers.add("1b11ad3a-f0ca-4695-a019-2d7e5d83a5fd");
+ jamcraftPlayers.add("3ec9ac58-2f1b-4d3f-b4eb-3b875da877ae");
+ jamcraftPlayers.add("cf9fa23f-205e-4eed-aba3-9f2848cd6a4d");
+ jamcraftPlayers.add("91880caa-b032-48e3-bfe8-c2c7ed31824e");
+ jamcraftPlayers.add("8d0b3804-f71c-4219-897b-8c315448ea7c");
+ jamcraftPlayers.add("bbb87dbe-690f-4205-bdc5-72ffb8ebc29d");
+ }
+
+ /**
+ * Adds a random amount of modifiers to a list
+ *
+ * @param randValue maximum number of modifiers
+ * @return a list containing the random modifiers
+ */
public static ArrayList<ItemStack> addRandomModifiers(int randValue)
{
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
- for (int i = 0; i < 2 + randValue; i++)
- {
+ for(int i = 0; i < 2 + randValue; i++){
ItemStack item = objects.get(new Random().nextInt(objects.size()));
item.stackSize = 1 + new Random().nextInt(2);
list.add(item);
@@ -107,26 +118,22 @@ public class JewelrycraftUtil
return list;
}
+ /**
+ * Links ores with their appropriate ingot
+ */
public static void addMetals()
{
int index = 0;
- while (index < OreDictionary.getOreNames().length)
- {
+ while (index < OreDictionary.getOreNames().length){
Iterator<ItemStack> i = OreDictionary.getOres(OreDictionary.getOreNames()[index]).iterator();
-
- while (i.hasNext())
- {
+ while (i.hasNext()){
ItemStack nextStack = i.next();
-
- if ((nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || nextStack.getItem().getUnlocalizedName().toLowerCase().contains("alloy")) && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("powder") && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("dust") && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("block") && !metal.contains(nextStack))
- {
+ if ((nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || nextStack.getItem().getUnlocalizedName().toLowerCase().contains("alloy")) && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("powder") && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("dust") && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("block") && !metal.contains(nextStack)){
metal.add(nextStack);
- if (OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore")) != null)
- {
+ if (OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore")) != null){
ores.addAll(OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore")));
Iterator<ItemStack> ores = OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore")).iterator();
- while (ores.hasNext())
- {
+ while (ores.hasNext()){
ItemStack ore = ores.next();
oreToIngot.put(ore.getItem(), nextStack);
}
@@ -137,66 +144,76 @@ public class JewelrycraftUtil
}
}
- public static boolean isModifier(ItemStack item)
- {
- Iterator<ItemStack> i = objects.iterator();
-
- while (i.hasNext())
- {
- ItemStack temp = i.next();
- if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
- }
- return false;
- }
-
+ /**
+ * Checks to see if the specified item is a gem
+ *
+ * @param item ItemStack containing the item
+ * @return is the item a gem
+ */
public static boolean isGem(ItemStack item)
{
Iterator<ItemStack> i = gem.iterator();
-
- while (i.hasNext())
- {
+ while (i.hasNext()){
ItemStack temp = i.next();
if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
}
return false;
}
+ /**
+ * Checks to see if the specified item is a metal
+ *
+ * @param item ItemStack containing the item
+ * @return is the item a metal
+ */
public static boolean isMetal(ItemStack item)
{
Iterator<ItemStack> i = metal.iterator();
-
- while (i.hasNext())
- {
+ while (i.hasNext()){
ItemStack temp = i.next();
if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
}
return false;
}
+ /**
+ * Checks to see if the specified item is a piece of jewelry
+ *
+ * @param item ItemStack containing the item
+ * @return is the item a piece of jewelry
+ */
public static boolean isJewelry(ItemStack item)
{
Iterator<ItemStack> i = jewelry.iterator();
-
- while (i.hasNext())
- {
+ while (i.hasNext()){
ItemStack temp = i.next();
if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
}
return false;
}
+ /**
+ * Checks to see if the specified item is an ore
+ *
+ * @param item ItemStack containing the item
+ * @return is the item an ore
+ */
public static boolean isOre(ItemStack item)
{
Iterator<ItemStack> i = ores.iterator();
-
- while (i.hasNext())
- {
+ while (i.hasNext()){
ItemStack temp = i.next();
if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
}
return false;
}
+ /**
+ * Gets the ingot from the ore
+ *
+ * @param ore the ore
+ * @return the ingot
+ */
public static ItemStack getIngotFromOre(Item ore)
{
return oreToIngot.get(ore);
diff --git a/java/darkknight/jewelrycraft/util/PlayerUtils.java b/java/darkknight/jewelrycraft/util/PlayerUtils.java
index 1135860..159ea98 100644
--- a/java/darkknight/jewelrycraft/util/PlayerUtils.java
+++ b/java/darkknight/jewelrycraft/util/PlayerUtils.java
@@ -2,42 +2,34 @@ package darkknight.jewelrycraft.util;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.integrated.IntegratedServer;
-import cpw.mods.fml.common.FMLCommonHandler;
/**
* Code taken from OpenBlocks
*/
public class PlayerUtils
-{
+{
+ /**
+ * Returns the NBTTag of the player
+ *
+ * @param player the player
+ * @param modName the mod name
+ * @return appropriate NBTTag
+ */
public static NBTTagCompound getModPlayerPersistTag(EntityPlayer player, String modName)
{
-
NBTTagCompound tag = player.getEntityData();
-
NBTTagCompound persistTag = null;
- if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG))
- {
- persistTag = tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
- }
- else
- {
+ if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG)) persistTag = tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
+ else{
persistTag = new NBTTagCompound();
tag.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistTag);
}
-
NBTTagCompound modTag = null;
- if (persistTag.hasKey(modName))
- {
- modTag = persistTag.getCompoundTag(modName);
- }
- else
- {
+ if (persistTag.hasKey(modName)) modTag = persistTag.getCompoundTag(modName);
+ else{
modTag = new NBTTagCompound();
persistTag.setTag(modName, modTag);
}
-
return modTag;
}
} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/worldGen/Generation.java b/java/darkknight/jewelrycraft/worldGen/Generation.java
index bb6d3f2..5992273 100644
--- a/java/darkknight/jewelrycraft/worldGen/Generation.java
+++ b/java/darkknight/jewelrycraft/worldGen/Generation.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.worldGen;
import java.util.Random;
-
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
@@ -10,10 +9,19 @@ import darkknight.jewelrycraft.block.BlockList;
public class Generation implements IWorldGenerator
{
+
+ /**
+ * @param random
+ * @param chunkX
+ * @param chunkZ
+ * @param world
+ * @param chunkGenerator
+ * @param chunkProvider
+ */
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
{
- switch (world.provider.dimensionId)
+ switch(world.provider.dimensionId)
{
case -1:
generateNether(world, random, chunkX << 4, chunkZ << 4);
@@ -27,14 +35,24 @@ public class Generation implements IWorldGenerator
}
}
+ /**
+ * @param world
+ * @param random
+ * @param i
+ * @param j
+ */
private void generateEnd(World world, Random random, int i, int j)
- {
- }
+ {}
+ /**
+ * @param world
+ * @param random
+ * @param i
+ * @param j
+ */
private void generateSurface(World world, Random random, int i, int j)
{
- for (int k = 0; k < 1; k++)
- {
+ for(int k = 0; k < 1; k++){
int x = i + random.nextInt(16);
int y = 5 + random.nextInt(4);
int z = j + random.nextInt(16);
@@ -44,7 +62,12 @@ public class Generation implements IWorldGenerator
}
}
+ /**
+ * @param world
+ * @param random
+ * @param i
+ * @param j
+ */
private void generateNether(World world, Random random, int i, int j)
- {
- }
+ {}
}
diff --git a/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java b/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
index f07a4a6..6083049 100644
--- a/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
+++ b/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
@@ -2,7 +2,6 @@ package darkknight.jewelrycraft.worldGen.village;
import java.util.List;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -29,18 +28,38 @@ public class ComponentJewelry extends StructureVillagePieces.House1
{
private int averageGroundLevel = -1;
+ /**
+ *
+ */
public ComponentJewelry()
- {
- }
+ {}
+ /**
+ * @param par1ComponentVillageStartPiece
+ * @param par2
+ * @param par3Random
+ * @param par4StructureBoundingBox
+ * @param par5
+ */
public ComponentJewelry(Start par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5)
{
super();
- this.coordBaseMode = par5;
- this.boundingBox = par4StructureBoundingBox;
+ coordBaseMode = par5;
+ boundingBox = par4StructureBoundingBox;
}
- @SuppressWarnings("rawtypes")
+ /**
+ * @param villagePiece
+ * @param pieces
+ * @param random
+ * @param p1
+ * @param p2
+ * @param p3
+ * @param p4
+ * @param p5
+ * @return
+ */
+ @SuppressWarnings ("rawtypes")
public static ComponentJewelry buildComponent(Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 11, 5, 12, p4);
@@ -48,191 +67,162 @@ public class ComponentJewelry extends StructureVillagePieces.House1
}
/**
- * second Part of Structure generating, this for example places Spiderwebs,
- * Mob Spawners, it closes Mineshafts at the end, it adds Fences...
+ * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences...
+ *
+ * @param world
+ * @param random
+ * @param sbb
+ * @return
*/
+ @Override
public boolean addComponentParts(World world, Random random, StructureBoundingBox sbb)
{
- if (this.averageGroundLevel < 0)
- {
- this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
-
- if (this.averageGroundLevel < 0) { return true; }
-
- this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 3, 0);
+ if (averageGroundLevel < 0){
+ averageGroundLevel = getAverageGroundLevel(world, sbb);
+ if (averageGroundLevel < 0) return true;
+ boundingBox.offset(0, averageGroundLevel - boundingBox.maxY + 3, 0);
}
-
/**
- * arguments: (World worldObj, StructureBoundingBox structBB, int minX,
- * int minY, int minZ, int maxX, int maxY, int maxZ, int placeBlockId,
- * int replaceBlockId, boolean alwaysreplace)
+ * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, int placeBlockId, int replaceBlockId, boolean alwaysreplace)
*/
- this.fillWithBlocks(world, sbb, 0, 0, 6, 10, 5, 11, Block.getBlockById(0), Block.getBlockById(0), false);
- this.fillWithBlocks(world, sbb, 2, 0, 0, 8, 5, 5, Block.getBlockById(0), Block.getBlockById(0), false);
+ fillWithBlocks(world, sbb, 0, 0, 6, 10, 5, 11, Block.getBlockById(0), Block.getBlockById(0), false);
+ fillWithBlocks(world, sbb, 2, 0, 0, 8, 5, 5, Block.getBlockById(0), Block.getBlockById(0), false);
// Pillars
- this.fillWithBlocks(world, sbb, 2, 0, 0, 2, 3, 0, Blocks.log, Blocks.log, false);
- this.fillWithBlocks(world, sbb, 2, 0, 3, 2, 3, 3, Blocks.log, Blocks.log, false);
- this.fillWithBlocks(world, sbb, 8, 0, 0, 8, 3, 0, Blocks.log, Blocks.log, false);
- this.fillWithBlocks(world, sbb, 8, 0, 3, 8, 3, 3, Blocks.log, Blocks.log, false);
-
+ fillWithBlocks(world, sbb, 2, 0, 0, 2, 3, 0, Blocks.log, Blocks.log, false);
+ fillWithBlocks(world, sbb, 2, 0, 3, 2, 3, 3, Blocks.log, Blocks.log, false);
+ fillWithBlocks(world, sbb, 8, 0, 0, 8, 3, 0, Blocks.log, Blocks.log, false);
+ fillWithBlocks(world, sbb, 8, 0, 3, 8, 3, 3, Blocks.log, Blocks.log, false);
// Walls
- this.fillWithBlocks(world, sbb, 2, 0, 1, 2, 3, 2, Blocks.planks, Blocks.planks, false);
- this.fillWithBlocks(world, sbb, 2, 0, 4, 2, 3, 5, Blocks.planks, Blocks.planks, false);
- this.fillWithBlocks(world, sbb, 8, 0, 1, 8, 3, 2, Blocks.planks, Blocks.planks, false);
- this.fillWithBlocks(world, sbb, 8, 0, 4, 8, 3, 5, Blocks.planks, Blocks.planks, false);
- this.fillWithBlocks(world, sbb, 3, 0, 0, 7, 3, 0, Blocks.planks, Blocks.planks, false);
-
- this.fillWithBlocks(world, sbb, 0, 0, 6, 10, 3, 6, Blocks.cobblestone, Blocks.cobblestone, false);
- this.fillWithBlocks(world, sbb, 0, 0, 11, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
- this.fillWithBlocks(world, sbb, 0, 0, 6, 0, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
- this.fillWithBlocks(world, sbb, 10, 0, 6, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
-
+ fillWithBlocks(world, sbb, 2, 0, 1, 2, 3, 2, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 2, 0, 4, 2, 3, 5, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 8, 0, 1, 8, 3, 2, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 8, 0, 4, 8, 3, 5, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 3, 0, 0, 7, 3, 0, Blocks.planks, Blocks.planks, false);
+ fillWithBlocks(world, sbb, 0, 0, 6, 10, 3, 6, Blocks.cobblestone, Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 0, 0, 11, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 0, 0, 6, 0, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
+ fillWithBlocks(world, sbb, 10, 0, 6, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
// Roof
- for (int i = 3; i <= 7; i++)
- for (int j = 1; j <= 5; j++)
- this.placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 2, i, 4, j, sbb);
-
- for (int i = 3; i <= 7; i++)
- for (int j = 6; j <= 6; j++)
- this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, 0, i, 4, j, sbb);
-
- for (int i = 1; i <= 9; i++)
- for (int j = 7; j <= 10; j++)
- this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, 3, i, 4, j, sbb);
-
- for (int i = 2; i <= 8; i++)
- this.placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, i, 4, 0, sbb);
-
- for (int i = 1; i <= 5; i++)
- {
- this.placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 2, 4, i, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 8, 4, i, sbb);
+ for(int i = 3; i <= 7; i++)
+ for(int j = 1; j <= 5; j++)
+ placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 2, i, 4, j, sbb);
+ for(int i = 3; i <= 7; i++)
+ for(int j = 6; j <= 6; j++)
+ placeBlockAtCurrentPosition(world, Blocks.stone_slab, 0, i, 4, j, sbb);
+ for(int i = 1; i <= 9; i++)
+ for(int j = 7; j <= 10; j++)
+ placeBlockAtCurrentPosition(world, Blocks.stone_slab, 3, i, 4, j, sbb);
+ for(int i = 2; i <= 8; i++)
+ placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, i, 4, 0, sbb);
+ for(int i = 1; i <= 5; i++){
+ placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 2, 4, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 8, 4, i, sbb);
}
-
- for (int i = 0; i <= 2; i++)
- {
- this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 6, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i + 8, 4, 6, sbb);
+ for(int i = 0; i <= 2; i++){
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 6, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i + 8, 4, 6, sbb);
}
-
- for (int i = 7; i <= 11; i++)
- {
- this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 0, 4, i, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 10, 4, i, sbb);
+ for(int i = 7; i <= 11; i++){
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 0, 4, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 10, 4, i, sbb);
}
-
- for (int i = 0; i <= 10; i++)
- this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 11, sbb);
-
+ for(int i = 0; i <= 10; i++)
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 11, sbb);
// Base
- for (int i = 2; i <= 8; i++)
- for (int j = 0; j <= 5; j++)
- this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, i, 0, j, sbb);
- this.fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11, Blocks.stonebrick, Blocks.stonebrick, false);
-
- for (int i = 6; i <= 10; i++)
- this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 5, 0, i, sbb);
-
- for (int i = 7; i <= 10; i++)
- {
- this.placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 1, 0, i, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 9, 0, i, sbb);
+ for(int i = 2; i <= 8; i++)
+ for(int j = 0; j <= 5; j++)
+ placeBlockAtCurrentPosition(world, Blocks.planks, 1, i, 0, j, sbb);
+ fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11, Blocks.stonebrick, Blocks.stonebrick, false);
+ for(int i = 6; i <= 10; i++)
+ placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 5, 0, i, sbb);
+ for(int i = 7; i <= 10; i++){
+ placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 1, 0, i, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 9, 0, i, sbb);
}
-
// Decorations
- this.placeDoorAtCurrentPosition(world, sbb, random, 6, 1, 0, this.getMetadataWithOffset(Blocks.wooden_door, 1));
- this.placeDoorAtCurrentPosition(world, sbb, random, 5, 1, 6, this.getMetadataWithOffset(Blocks.wooden_door, 1));
-
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 3, 2, 0, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4, 2, 0, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 1, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 4, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 5, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 1, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 2, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 4, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 5, sbb);
-
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 3, 1, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 3, 3, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 7, 3, 3, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 5, sbb);
-
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 7, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 10, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 8, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 9, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 8, sbb);
- this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 9, sbb);
-
+ placeDoorAtCurrentPosition(world, sbb, random, 6, 1, 0, getMetadataWithOffset(Blocks.wooden_door, 1));
+ placeDoorAtCurrentPosition(world, sbb, random, 5, 1, 6, getMetadataWithOffset(Blocks.wooden_door, 1));
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 3, 2, 0, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4, 2, 0, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 1, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 2, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 4, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 5, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 1, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 2, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 4, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 5, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 3, 1, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 3, 3, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 7, 3, 3, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 5, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 7, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 10, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 8, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 9, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 8, sbb);
+ placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 9, sbb);
int bgCarpetColor = random.nextInt(16);
-
- for (int i = 4; i <= 7; i++)
- for (int j = 1; j <= 5; j++)
- this.placeBlockAtCurrentPosition(world, Blocks.carpet, bgCarpetColor, i, 1, j, sbb);
-
+ for(int i = 4; i <= 7; i++)
+ for(int j = 1; j <= 5; j++)
+ placeBlockAtCurrentPosition(world, Blocks.carpet, bgCarpetColor, i, 1, j, sbb);
generateChest(world, 3, 1, 1, 0, random, sbb, ConfigHandler.jewelsChestMin, ConfigHandler.jewelsChestMax);
- generateDisplayer(world, 3, 1, 2, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb);
- placeBlockAtCurrentPosition(world, BlockList.jewelCraftingTable, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, 3, 1, 3, sbb);
- generateDisplayer(world, 3, 1, 4, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb);
+ generateDisplayer(world, 3, 1, 2, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.jewelCraftingTable, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, 3, 1, 3, sbb);
+ generateDisplayer(world, 3, 1, 4, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb);
generateChest(world, 3, 1, 5, 0, random, sbb, ConfigHandler.jewelsChestMin, ConfigHandler.jewelsChestMax);
-
generateFurnace(world, 1, 1, 7, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 2, 7, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 3, 7, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 1, 10, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 2, 10, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 3, 10, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
-
- generateSmelter(world, 1, 1, 8, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb, random.nextBoolean());
- generateSmelter(world, 1, 1, 9, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb, random.nextBoolean());
-
- generateMolder(world, 2, 1, 8, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb, random.nextBoolean(), random.nextBoolean());
- generateMolder(world, 2, 1, 9, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb, random.nextBoolean(), random.nextBoolean());
-
- if(random.nextBoolean()) generateIngotChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
+ generateSmelter(world, 1, 1, 8, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb, random.nextBoolean());
+ generateSmelter(world, 1, 1, 9, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb, random.nextBoolean());
+ generateMolder(world, 2, 1, 8, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb, random.nextBoolean(), random.nextBoolean());
+ generateMolder(world, 2, 1, 9, coordBaseMode == 0 || coordBaseMode == 2 ? 1 : 2, random, sbb, random.nextBoolean(), random.nextBoolean());
+ if (random.nextBoolean()) generateIngotChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
else generateOresChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
- if(random.nextBoolean()) generateIngotChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
+ if (random.nextBoolean()) generateIngotChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
else generateOresChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
- if(random.nextBoolean()) generateIngotChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
+ if (random.nextBoolean()) generateIngotChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
else generateOresChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
- if(random.nextBoolean()) generateIngotChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
+ if (random.nextBoolean()) generateIngotChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
else generateOresChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
-
- for (int l = 0; l < 6; ++l)
- {
- for (int i1 = 2; i1 < 9; ++i1)
- {
- this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
- this.func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
+ for(int l = 0; l < 6; ++l)
+ for(int i1 = 2; i1 < 9; ++i1){
+ clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
+ func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
}
- }
-
- for (int l = 6; l < 12; ++l)
- {
- for (int i1 = 0; i1 < 11; ++i1)
- {
- this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
- this.func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
+ for(int l = 6; l < 12; ++l)
+ for(int i1 = 0; i1 < 11; ++i1){
+ clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
+ func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
}
- }
-
- this.spawnVillagers(world, sbb, 3, 1, 3, 1);
-
+ spawnVillagers(world, sbb, 3, 1, 3, 1);
return true;
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param metadata
+ * @param random
+ * @param sbb
+ * @param min
+ * @param max
+ */
public void generateChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max)
{
- int i1 = this.getXWithOffset(i, k);
- int j1 = this.getYWithOffset(j);
- int k1 = this.getZWithOffset(i, k);
+ int i1 = getXWithOffset(i, k);
+ int j1 = getYWithOffset(j);
+ int k1 = getZWithOffset(i, k);
int t = random.nextInt(max - min + 1) + min;
- this.placeBlockAtCurrentPosition(world, Blocks.chest, metadata, i, j, k, sbb);
- TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
- while (chest != null && t > 0)
- {
+ placeBlockAtCurrentPosition(world, Blocks.chest, metadata, i, j, k, sbb);
+ TileEntityChest chest = (TileEntityChest)world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0){
ItemStack jewels = JewelrycraftUtil.gem.get(random.nextInt(JewelrycraftUtil.gem.size()));
chest.func_145976_a("Jeweler's Chest");
if (jewels.getItem() == Items.nether_star && ConfigHandler.generateVillageNetherstar) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
@@ -241,16 +231,28 @@ public class ComponentJewelry extends StructureVillagePieces.House1
}
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param metadata
+ * @param random
+ * @param sbb
+ * @param min
+ * @param max
+ * @param chestB
+ * @param randomAmount
+ */
public void generateIngotChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, Block chestB, int randomAmount)
{
- int i1 = this.getXWithOffset(i, k);
- int j1 = this.getYWithOffset(j);
- int k1 = this.getZWithOffset(i, k);
+ int i1 = getXWithOffset(i, k);
+ int j1 = getYWithOffset(j);
+ int k1 = getZWithOffset(i, k);
int t = random.nextInt(max - min + 1) + min;
- this.placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
- TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
- while (chest != null && t > 0)
- {
+ placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
+ TileEntityChest chest = (TileEntityChest)world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0){
chest.func_145976_a("Ingot Chest");
int metalID = random.nextInt(JewelrycraftUtil.metal.size());
ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
@@ -260,16 +262,28 @@ public class ComponentJewelry extends StructureVillagePieces.House1
}
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param metadata
+ * @param random
+ * @param sbb
+ * @param min
+ * @param max
+ * @param chestB
+ * @param randomAmount
+ */
public void generateOresChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, Block chestB, int randomAmount)
{
- int i1 = this.getXWithOffset(i, k);
- int j1 = this.getYWithOffset(j);
- int k1 = this.getZWithOffset(i, k);
+ int i1 = getXWithOffset(i, k);
+ int j1 = getYWithOffset(j);
+ int k1 = getZWithOffset(i, k);
int t = random.nextInt(max - min + 1) + min;
- this.placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
- TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
- while (chest != null && t > 0)
- {
+ placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
+ TileEntityChest chest = (TileEntityChest)world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0){
chest.func_145976_a("Ores Chest");
int oreID = random.nextInt(JewelrycraftUtil.ores.size());
ItemStack ores = JewelrycraftUtil.ores.get(oreID).copy();
@@ -279,15 +293,23 @@ public class ComponentJewelry extends StructureVillagePieces.House1
}
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param metadata
+ * @param random
+ * @param sbb
+ */
public void generateDisplayer(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb)
{
- int i1 = this.getXWithOffset(i, k);
- int j1 = this.getYWithOffset(j);
- int k1 = this.getZWithOffset(i, k);
+ int i1 = getXWithOffset(i, k);
+ int j1 = getYWithOffset(j);
+ int k1 = getZWithOffset(i, k);
placeBlockAtCurrentPosition(world, BlockList.displayer, metadata, i, j, k, sbb);
- TileEntityDisplayer displayer = (TileEntityDisplayer) world.getTileEntity(i1, j1, k1);
- if (displayer != null)
- {
+ TileEntityDisplayer displayer = (TileEntityDisplayer)world.getTileEntity(i1, j1, k1);
+ if (displayer != null){
Item[] jewels = {ItemList.ring, ItemList.necklace};
ItemStack jewel = new ItemStack(jewels[random.nextInt(jewels.length)]);
JewelryNBT.addMetal(jewel, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
@@ -299,76 +321,117 @@ public class ComponentJewelry extends StructureVillagePieces.House1
}
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param metadata
+ * @param random
+ * @param sbb
+ * @param isEmpty
+ */
public void generateSmelter(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, boolean isEmpty)
{
- int i1 = this.getXWithOffset(i, k);
- int j1 = this.getYWithOffset(j);
- int k1 = this.getZWithOffset(i, k);
+ int i1 = getXWithOffset(i, k);
+ int j1 = getYWithOffset(j);
+ int k1 = getZWithOffset(i, k);
placeBlockAtCurrentPosition(world, BlockList.smelter, metadata, i, j, k, sbb);
- TileEntitySmelter smelter = (TileEntitySmelter) world.getTileEntity(i1, j1, k1);
- if (smelter != null && !isEmpty)
- {
+ TileEntitySmelter smelter = (TileEntitySmelter)world.getTileEntity(i1, j1, k1);
+ if (smelter != null && !isEmpty){
int metal = random.nextInt(JewelrycraftUtil.metal.size());
smelter.moltenMetal = JewelrycraftUtil.metal.get(metal).copy();
smelter.hasMoltenMetal = true;
int quantity = random.nextInt(9);
switch(quantity)
{
- case 0: smelter.quantity = 0.1f;
- case 1: smelter.quantity = 0.2f;
- case 2: smelter.quantity = 0.3f;
- case 3: smelter.quantity = 0.4f;
- case 4: smelter.quantity = 0.5f;
- case 5: smelter.quantity = 0.6f;
- case 6: smelter.quantity = 0.7f;
- case 7: smelter.quantity = 0.8f;
- case 8: smelter.quantity = 0.9f;
- default: smelter.quantity = 0.1f;
+ case 0:
+ smelter.quantity = 0.1f;
+ case 1:
+ smelter.quantity = 0.2f;
+ case 2:
+ smelter.quantity = 0.3f;
+ case 3:
+ smelter.quantity = 0.4f;
+ case 4:
+ smelter.quantity = 0.5f;
+ case 5:
+ smelter.quantity = 0.6f;
+ case 6:
+ smelter.quantity = 0.7f;
+ case 7:
+ smelter.quantity = 0.8f;
+ case 8:
+ smelter.quantity = 0.9f;
+ default:
+ smelter.quantity = 0.1f;
}
}
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param metadata
+ * @param random
+ * @param sbb
+ * @param hasMold
+ * @param hasStuff
+ */
public void generateMolder(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, boolean hasMold, boolean hasStuff)
{
- int i1 = this.getXWithOffset(i, k);
- int j1 = this.getYWithOffset(j);
- int k1 = this.getZWithOffset(i, k);
+ int i1 = getXWithOffset(i, k);
+ int j1 = getYWithOffset(j);
+ int k1 = getZWithOffset(i, k);
placeBlockAtCurrentPosition(world, BlockList.molder, metadata, i, j, k, sbb);
- TileEntityMolder molder = (TileEntityMolder) world.getTileEntity(i1, j1, k1);
- if (molder != null)
- {
- if (hasMold)
- {
- int meta = random.nextInt(ItemMolds.moldsItemNames.length + 1);
- molder.mold = new ItemStack(ItemList.molds, 1, meta);
- molder.hasMold = true;
- if (hasStuff)
- {
- ItemStack ring = new ItemStack(ItemList.ring);
- JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
- ItemStack necklace = new ItemStack(ItemList.necklace);
- JewelryNBT.addMetal(necklace, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
- if (meta == 0) molder.jewelBase = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
- else if (meta == 1) molder.jewelBase = ring;
- else molder.jewelBase = necklace;
- molder.hasJewelBase = true;
- }
+ TileEntityMolder molder = (TileEntityMolder)world.getTileEntity(i1, j1, k1);
+ if (molder != null) if (hasMold){
+ int meta = random.nextInt(ItemMolds.moldsItemNames.length + 1);
+ molder.mold = new ItemStack(ItemList.molds, 1, meta);
+ molder.hasMold = true;
+ if (hasStuff){
+ ItemStack ring = new ItemStack(ItemList.ring);
+ JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
+ ItemStack necklace = new ItemStack(ItemList.necklace);
+ JewelryNBT.addMetal(necklace, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
+ ItemStack bracelet = new ItemStack(ItemList.bracelet);
+ JewelryNBT.addMetal(bracelet, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
+ ItemStack earrings = new ItemStack(ItemList.earrings);
+ JewelryNBT.addMetal(earrings, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
+ if (meta == 0) molder.jewelBase = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
+ else if (meta == 1) molder.jewelBase = ring;
+ else if (meta == 2) molder.jewelBase = necklace;
+ else if (meta == 3) molder.jewelBase = bracelet;
+ else if (meta == 4) molder.jewelBase = earrings;
+ molder.hasJewelBase = true;
}
}
}
+ /**
+ * @param world
+ * @param i
+ * @param j
+ * @param k
+ * @param metadata
+ * @param random
+ * @param sbb
+ * @param min
+ * @param max
+ * @param hasMetal
+ */
public void generateFurnace(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, boolean hasMetal)
{
- int i1 = this.getXWithOffset(i, k);
- int j1 = this.getYWithOffset(j);
- int k1 = this.getZWithOffset(i, k);
+ int i1 = getXWithOffset(i, k);
+ int j1 = getYWithOffset(j);
+ int k1 = getZWithOffset(i, k);
placeBlockAtCurrentPosition(world, Blocks.furnace, metadata, i, j, k, sbb);
- TileEntityFurnace furnace = (TileEntityFurnace) world.getTileEntity(i1, j1, k1);
- if (furnace != null)
- {
+ TileEntityFurnace furnace = (TileEntityFurnace)world.getTileEntity(i1, j1, k1);
+ if (furnace != null){
if (random.nextBoolean()) furnace.setInventorySlotContents(1, new ItemStack(Items.coal, 1 + random.nextInt(16)));
- if (hasMetal)
- {
+ if (hasMetal){
int metalID = random.nextInt(JewelrycraftUtil.metal.size());
ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
metal.stackSize = random.nextInt(max - min + 1) + min;
@@ -378,9 +441,12 @@ public class ComponentJewelry extends StructureVillagePieces.House1
}
/**
- * Returns the villager type to spawn in this component, based on the number
- * of villagers already spawned.
+ * Returns the villager type to spawn in this component, based on the number of villagers already spawned.
+ *
+ * @param par1
+ * @return
*/
+ @Override
protected int getVillagerType(int par1)
{
return 3000;
diff --git a/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java b/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java
index 1d474b0..a3f7158 100644
--- a/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java
+++ b/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java
@@ -1,7 +1,6 @@
package darkknight.jewelrycraft.worldGen.village;
import java.util.Random;
-
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -18,109 +17,101 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class JCTrades implements IVillageTradeHandler
{
+ /**
+ *
+ */
public JCTrades()
{
super();
}
+ /**
+ * @param villager
+ * @param recipeList
+ * @param random
+ */
@Override
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random)
{
- if (villager.getProfession() == 3000)
- {
+ if (villager.getProfession() == 3000){
ItemStack ingredient = null;
ItemStack ingredient2 = null;
ItemStack result;
-
int type = random.nextInt(12);
- switch (type)
+ switch(type)
{
- case 0:
- {
+ case 0:{
result = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
result.stackSize = 5 + random.nextInt(5);
ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(7));
if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(2));
break;
}
- case 1:
- {
+ case 1:{
result = new ItemStack(ItemList.molds, 5 + random.nextInt(7), random.nextInt(ItemMolds.moldsItemNames.length));
ingredient = new ItemStack(Items.emerald, 1);
if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
break;
}
- case 2:
- {
+ case 2:{
int number = random.nextInt(3);
result = new ItemStack(BlockList.displayer, 1 + number);
- ingredient = new ItemStack(Blocks.emerald_block, 2 + number*3 + random.nextInt(2));
+ ingredient = new ItemStack(Blocks.emerald_block, 2 + number * 3 + random.nextInt(2));
ingredient2 = new ItemStack(Items.emerald, 3 + number + random.nextInt(8));
break;
}
- case 3:
- {
+ case 3:{
result = new ItemStack(BlockList.jewelCraftingTable);
ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2));
if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
break;
}
- case 4:
- {
+ case 4:{
result = new ItemStack(BlockList.shadowOre, 1 + random.nextInt(6));
ingredient = new ItemStack(Items.emerald, 3 + random.nextInt(4));
if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 3 + random.nextInt(4));
break;
}
- case 5:
- {
+ case 5:{
result = new ItemStack(BlockList.molder, 5 + random.nextInt(5));
ingredient = new ItemStack(Items.emerald, 1);
if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1);
break;
}
- case 6:
- {
+ case 6:{
result = new ItemStack(BlockList.smelter);
ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2));
if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
break;
}
- case 7:
- {
+ case 7:{
int end = random.nextInt(JewelrycraftUtil.gem.size());
result = JewelrycraftUtil.gem.get(end);
result.stackSize = 1 + random.nextInt(JewelrycraftUtil.gem.size() - end);
- if (JewelrycraftUtil.gem.size() - 1 - end >= 1)
- {
+ if (JewelrycraftUtil.gem.size() - 1 - end >= 1){
int value = end;
if (value > 64) value = 64;
ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(value));
if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(value));
- }
- else
- {
+ }else{
ingredient = new ItemStack(Blocks.emerald_block, 16 + random.nextInt(32));
ingredient2 = new ItemStack(Blocks.emerald_block, 8 + random.nextInt(48));
}
break;
}
- case 8:
- {
+ case 8:{
result = JewelrycraftUtil.ores.get(random.nextInt(JewelrycraftUtil.ores.size()));
result.stackSize = 3 + random.nextInt(3);
ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(5));
if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(6));
break;
}
- case 9:
- {
+ case 9:{
result = new ItemStack(ItemList.guide, 1);
ingredient = new ItemStack(Items.emerald, 1);
break;
}
- default:
- {
+ default:{
result = new ItemStack(ItemList.ring, 1, 0);
int randValue = random.nextInt(4);
JewelryNBT.addMetal(result, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
@@ -130,7 +121,6 @@ public class JCTrades implements IVillageTradeHandler
ingredient2 = new ItemStack(Blocks.emerald_block, 2 + randValue);
}
}
-
recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result));
}
}
diff --git a/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java b/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java
index e12fde1..a2c3d62 100644
--- a/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java
+++ b/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java
@@ -2,10 +2,6 @@ package darkknight.jewelrycraft.worldGen.village;
import java.util.List;
import java.util.Random;
-
-import net.minecraft.world.gen.structure.StructureVillagePieces.House1;
-import net.minecraft.world.gen.structure.StructureStart;
-import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight;
import net.minecraft.world.gen.structure.StructureVillagePieces.Start;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;
@@ -13,20 +9,41 @@ import darkknight.jewelrycraft.config.ConfigHandler;
public class VillageJewelryHandler implements IVillageCreationHandler
{
+
+ /**
+ * @param random
+ * @param i
+ * @return
+ */
@Override
public PieceWeight getVillagePieceWeight(Random random, int i)
{
return new PieceWeight(ComponentJewelry.class, ConfigHandler.jewelerWeight, ConfigHandler.maxVillageJewelers);
}
+ /**
+ * @return
+ */
@Override
public Class<?> getComponentClass()
{
return ComponentJewelry.class;
}
+ /**
+ * @param villagePiece
+ * @param startPiece
+ * @param pieces
+ * @param random
+ * @param p1
+ * @param p2
+ * @param p3
+ * @param p4
+ * @param p5
+ * @return
+ */
@Override
- public Object buildComponent(PieceWeight villagePiece, Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
+ public Object buildComponent(PieceWeight villagePiece, Start startPiece, @SuppressWarnings ("rawtypes") List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
return ComponentJewelry.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}