summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-05-21 18:48:35 +0300
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-05-21 18:48:35 +0300
commit27b6d250ba6005bfa9cdd9d291e0656f5e02fa65 (patch)
tree89fd6b927e3cdd9391a2479cfa08dee2bda1c15e /src
parent2b4aedb9fb90e02c8ec89130919fb9cfae82770c (diff)
Liquids!
Diffstat (limited to 'src')
-rw-r--r--src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java11
-rw-r--r--src/main/java/darkknight/jewelrycraft/block/BlockMolder.java4
-rw-r--r--src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java166
-rw-r--r--src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java12
-rw-r--r--src/main/java/darkknight/jewelrycraft/events/BucketHandler.java7
-rw-r--r--src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java58
-rw-r--r--src/main/java/darkknight/jewelrycraft/events/EventHandler.java65
-rw-r--r--src/main/java/darkknight/jewelrycraft/item/ItemList.java3
-rw-r--r--src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java122
-rw-r--r--src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java18
-rw-r--r--src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java2
-rw-r--r--src/main/java/darkknight/jewelrycraft/item/ItemRing.java2
-rw-r--r--src/main/java/darkknight/jewelrycraft/lib/Reference.java2
-rw-r--r--src/main/java/darkknight/jewelrycraft/renders/RendererSmelter.java67
-rw-r--r--src/main/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java16
-rw-r--r--src/main/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java23
-rw-r--r--src/main/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java83
-rw-r--r--src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java14
-rw-r--r--src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java254
-rw-r--r--src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java1
-rw-r--r--src/main/java/darkknight/jewelrycraft/worldGen/Generation.java4
-rw-r--r--src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java6
-rw-r--r--src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.pngbin0 -> 9922 bytes
-rw-r--r--src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta45
24 files changed, 786 insertions, 199 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java
index f6672ee..568591f 100644
--- a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java
+++ b/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java
@@ -12,6 +12,7 @@ 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.init.Items;
import net.minecraft.item.Item;
@@ -61,6 +62,7 @@ public class JewelrycraftMod
public static CommonProxy proxy;
public static final Logger logger = Logger.getLogger("Jewelrycraft");
+ public static File dir;
public static CreativeTabs jewelrycraft = new CreativeTabs("JewelryCraft")
{
@@ -73,9 +75,8 @@ public class JewelrycraftMod
public static CreativeTabs rings = new CreativeTabRings("Rings");
public static CreativeTabs necklaces = new CreativeTabNecklaces("Necklaces");
public static CreativeTabs liquids = new CreativeTabLiquids("Liquids");
-
- public static File liquidsConf;
- public static NBTTagCompound saveData;
+ public static NBTTagCompound saveData = new NBTTagCompound();
+ public static File liquidsConf;
@EventHandler
public void preInit(FMLPreInitializationEvent e) throws IOException
@@ -108,13 +109,11 @@ public class JewelrycraftMod
List<String> authorList = new ArrayList<String>();
authorList.add("DarkKnight (or sor1n)");
authorList.add("bspkrs");
+ dir = e.getModConfigurationDirectory();
metadata.autogenerated = false;
metadata.authorList = authorList;
metadata.url = "https://github.com/sor1n/Modjam-Mod";
-
- liquidsConf = new File(e.getModConfigurationDirectory(), "JLP.cfg");
- if(!liquidsConf.exists() && !liquidsConf.createNewFile());
}
@EventHandler
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java
index 1ed58d7..4b26044 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java
+++ b/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java
@@ -57,8 +57,6 @@ public class BlockMolder extends BlockContainer
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.molder.addedmold", te.mold.getDisplayName())));
te.isDirty = true;
- te.markDirty();
- world.markTileEntityChunkModified(i, j, k, te);
}
if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal)
{
@@ -66,7 +64,6 @@ public class BlockMolder extends BlockContainer
te.mold = new ItemStack(Item.getItemById(0), 0, 0);
te.hasMold = false;
te.isDirty = true;
- te.markDirty();
}
else if(te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.hasmoltenmetal")));
}
@@ -122,7 +119,6 @@ public class BlockMolder extends BlockContainer
else if (me.mold.getItem() != ItemList.molds)
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldismissing")));
me.isDirty = true;
- me.markDirty();
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
index 9adbf59..b6d10c1 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
+++ b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
@@ -2,13 +2,16 @@ package darkknight.jewelrycraft.block;
import java.awt.image.BufferedImage;
import java.io.IOException;
+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.resources.IResourceManager;
+import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -20,6 +23,7 @@ import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.util.JewelryNBT;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
@@ -34,6 +38,7 @@ public class BlockMoltenMetal extends BlockFluidClassic {
super(fluid, material);
setBlockName("Jewelrycraft.moltenMetal");
this.setQuantaPerBlock(100);
+ setLightLevel(15f);
}
@Override
@@ -59,24 +64,166 @@ public class BlockMoltenMetal extends BlockFluidClassic {
return super.displaceIfPossible(world, x, y, z);
}
+ @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);
+ }
+
+ Material material = block.getMaterial();
+ 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;
+ }
+ }
+
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int i, int j, int k)
{
-// try {
-// return color(world, i, j, k);
-// } catch (IOException e) {
-// e.printStackTrace();
-// }
+ try {
+ return color(world, i, j, k, false, null);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
return 0;
}
- public static int color(IBlockAccess world, int i, int j, int k) throws IOException
+ @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)
+ {
+ int y2 = y - densityDir;
+
+ if ((world.getBlock(x, y2, z ) == this && JewelrycraftMod.saveData.getInteger(coords(x, y2, z)) == JewelrycraftMod.saveData.getInteger(coords(x, y, z)))||
+ (world.getBlock(x - 1, y2, z ) == this && JewelrycraftMod.saveData.getInteger(coords(x - 1, y2, z)) == JewelrycraftMod.saveData.getInteger(coords(x, y, z)))||
+ (world.getBlock(x + 1, y2, z ) == this && JewelrycraftMod.saveData.getInteger(coords(x + 1, y2, z)) == JewelrycraftMod.saveData.getInteger(coords(x, y, z)))||
+ (world.getBlock(x, y2, z - 1) == this && JewelrycraftMod.saveData.getInteger(coords(x, y2, z - 1)) == JewelrycraftMod.saveData.getInteger(coords(x, y, z)))||
+ (world.getBlock(x, y2, z + 1) == this && JewelrycraftMod.saveData.getInteger(coords(x, y2, z + 1)) == JewelrycraftMod.saveData.getInteger(coords(x, y, z))))
+ {
+ expQuanta = quantaPerBlock - 1;
+ }
+ else
+ {
+ int maxQuanta = -100;
+ maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta);
+ maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta);
+ maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta);
+ maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta);
+
+ expQuanta = maxQuanta - 1;
+ }
+
+ // decay calculation
+ if (expQuanta != quantaRemaining)
+ {
+ quantaRemaining = expQuanta;
+
+ 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);
+ }
+ }
+ }
+ // 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);
+ }
+
+ // Flow vertically if possible
+ if (canDisplace(world, x, y + densityDir, z))
+ {
+ JewelrycraftMod.saveData.setInteger(coords(x, y + densityDir, z), JewelrycraftMod.saveData.getInteger(coords(x, y, z)));
+ flowIntoBlock(world, x, y + densityDir, z, 1);
+ 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)
+ {
+ flowMeta = 1;
+ }
+ boolean flowTo[] = getOptimalFlowDirections(world, x, y, z);
+
+ if (flowTo[0]){
+ if(JewelrycraftMod.saveData.getTag(coords(x - 1, y, z)) == null || world.getBlock(x - 1, y, z).isAir(world, x - 1, y, z))
+ JewelrycraftMod.saveData.setInteger(coords(x - 1, y, z), JewelrycraftMod.saveData.getInteger(coords(x, y, z)));
+ flowIntoBlock(world, x - 1, y, z, flowMeta);
+ }
+ if (flowTo[1]){
+ if(JewelrycraftMod.saveData.getTag(coords(x + 1, y, z)) == null || world.getBlock(x + 1, y, z).isAir(world, x + 1, y, z))
+ JewelrycraftMod.saveData.setInteger(coords(x + 1, y, z), JewelrycraftMod.saveData.getInteger(coords(x, y, z)));
+ flowIntoBlock(world, x + 1, y, z, flowMeta);
+ }
+ if (flowTo[2]){
+ if(JewelrycraftMod.saveData.getTag(coords(x, y, z - 1)) == null || world.getBlock(x, y, z - 1).isAir(world, x, y, z - 1))
+ JewelrycraftMod.saveData.setInteger(coords(x, y, z - 1), JewelrycraftMod.saveData.getInteger(coords(x, y, z)));
+ flowIntoBlock(world, x, y, z - 1, flowMeta);
+ }
+ if (flowTo[3]){
+ if(JewelrycraftMod.saveData.getTag(coords(x, y, z + 1)) == null || world.getBlock(x, y, z + 1).isAir(world, x, y, z + 1))
+ JewelrycraftMod.saveData.setInteger(coords(x, y, z + 1), JewelrycraftMod.saveData.getInteger(coords(x, y, z)));
+ flowIntoBlock(world, x, y, z + 1, flowMeta);
+ }
+ }
+ }
+
+ public static int color(IBlockAccess world, int i, int j, int k, boolean forcecolor, Item itemC) throws IOException
{
String domain = "", texture;
IResourceManager rm = Minecraft.getMinecraft().getResourceManager();
BufferedImage icon;
ItemStack item = new ItemStack(BlockList.moltenMetal);
- JewelryNBT.addMetal(item, new ItemStack(JewelrycraftUtil.liquids.get(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k))));
+ if(JewelrycraftMod.saveData.getInteger(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k)) > 0)
+ JewelryNBT.addMetal(item, new ItemStack(Item.getItemById(JewelrycraftMod.saveData.getInteger(coords(i, j, k)))));
+ if(forcecolor) JewelryNBT.addMetal(item, new ItemStack(itemC));
int x=0, y=0, ok = 0, red, green, blue;
if (JewelryNBT.ingot(item) != null && JewelryNBT.ingot(item).getIconIndex() != null && JewelryNBT.ingotColor(item) == 16777215)
{
@@ -114,4 +261,9 @@ public class BlockMoltenMetal extends BlockFluidClassic {
if(JewelryNBT.ingot(item) != null) return JewelryNBT.ingotColor(item);
return 16777215;
}
+
+ public static String coords(int x, int y, int z)
+ {
+ return String.valueOf(x) + " " + String.valueOf(y) + " " + String.valueOf(z);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java
index 176a6f2..1f04bce 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java
+++ b/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java
@@ -71,7 +71,7 @@ public class BlockSmelter extends BlockContainer
{
int index = -1;
for(int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++) if(entityPlayer.getDisplayName().equals(JewelrycraftUtil.jamcraftPlayers.get(a))) index = a;
- if (!te.hasMetal && !te.hasMoltenMetal && item != null && (item.getUnlocalizedName().toLowerCase().contains("ingot") || index != -1) && !item.getUnlocalizedName().toLowerCase().contains("mold"))
+ if (!te.hasMetal && !te.hasMoltenMetal && !te.pouring && item != null && (item.getUnlocalizedName().toLowerCase().contains("ingot") || index != -1) && !item.getUnlocalizedName().toLowerCase().contains("mold"))
{
entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.nowsmeltingingot", item.getDisplayName())));
te.metal = item.copy();
@@ -80,7 +80,6 @@ public class BlockSmelter extends BlockContainer
te.melting = ConfigHandler.ingotMeltingTime;
if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
te.isDirty = true;
- te.markDirty();
}
else if (te.hasMetal && !te.hasMoltenMetal && item != null && item.getDisplayName().contains("Ingot") && !item.getDisplayName().contains("Mold"))
entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.alreadyhasingot", te.metal.getDisplayName())));
@@ -96,8 +95,6 @@ public class BlockSmelter extends BlockContainer
dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy());
te.hasMetal = false;
te.melting = -1;
- te.isDirty = true;
- te.markDirty();
world.markBlockForUpdate(i, j, k);
world.setTileEntity(i, j, k, te);
}
@@ -124,13 +121,8 @@ public class BlockSmelter extends BlockContainer
{
if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me != null && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase)
{
- me.moltenMetal = te.moltenMetal;
- me.hasMoltenMetal = true;
- me.cooling = ConfigHandler.ingotCoolingTime;
- te.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
- te.hasMoltenMetal = false;
+ te.pouring = true;
te.isDirty = true;
- te.markDirty();
world.markBlockForUpdate(i, j, k);
world.setTileEntity(i, j, k, te);
}
diff --git a/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java b/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java
index 64a02c3..cf16847 100644
--- a/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java
+++ b/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java
@@ -18,6 +18,9 @@ import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.block.BlockMoltenMetal;
+import darkknight.jewelrycraft.util.JewelryNBT;
public class BucketHandler {
@@ -47,7 +50,9 @@ public class BucketHandler {
Item bucket = buckets.get(block);
if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) {
world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
- return new ItemStack(bucket);
+ ItemStack item = new ItemStack(bucket);
+ JewelryNBT.addMetal(item, new ItemStack(Item.getItemById(JewelrycraftMod.saveData.getInteger(BlockMoltenMetal.coords(pos.blockX, pos.blockY, pos.blockZ)))));
+ return item;
} else
return null;
diff --git a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java
index d8d49a2..957705c 100644
--- a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java
+++ b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java
@@ -1,27 +1,31 @@
package darkknight.jewelrycraft.events;
+import java.io.EOFException;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.WorldServer;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.event.world.WorldEvent;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.util.BlockUtils;
import darkknight.jewelrycraft.util.PlayerUtils;
-import cpw.mods.fml.common.FMLCommonHandler;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
/**
* Code taken from OpenBlocks
*/
+
public class EntityEventHandler
{
public static final String OPENBLOCKS_PERSIST_TAG = "Jewelrycraft";
@@ -31,10 +35,7 @@ public class EntityEventHandler
public void onEntityJoinWorld(EntityJoinWorldEvent event)
{
final Entity entity = event.entity;
- /**
- * If the player hasn't been given a manual, we'll give him one! (or
- * throw it on the floor..)
- */
+
if (!event.world.isRemote && entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer)entity;
@@ -52,4 +53,47 @@ public class EntityEventHandler
}
}
}
+
+ @SubscribeEvent
+ public void onWorldLoad(WorldEvent.Load event)
+ {
+ if(!event.world.isRemote)
+ {
+ JewelrycraftMod.liquidsConf = new File(JewelrycraftMod.dir, "JLP" + event.world.getWorldInfo().getWorldName() + ".cfg");
+ try {
+ if(!JewelrycraftMod.liquidsConf.exists()) JewelrycraftMod.liquidsConf.createNewFile();
+ } 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();
+ }
+ }
+
+ }
+
+ @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();
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/events/EventHandler.java b/src/main/java/darkknight/jewelrycraft/events/EventHandler.java
new file mode 100644
index 0000000..019deab
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/events/EventHandler.java
@@ -0,0 +1,65 @@
+package darkknight.jewelrycraft.events;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.CompressedStreamTools;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.WorldServer;
+import net.minecraftforge.event.entity.EntityJoinWorldEvent;
+import net.minecraftforge.event.world.WorldEvent;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.util.BlockUtils;
+import darkknight.jewelrycraft.util.PlayerUtils;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+
+/**
+ * Code taken from OpenBlocks
+ */
+public class EventHandler
+{
+ public static final String OPENBLOCKS_PERSIST_TAG = "Jewelrycraft";
+ public static final String GIVEN_GUIDE_TAG = "givenGuive";
+
+ @SubscribeEvent
+ public void onEntityJoinWorld(EntityJoinWorldEvent event)
+ {
+ final Entity entity = event.entity;
+ /**
+ * If the player hasn't been given a manual, we'll give him one! (or
+ * throw it on the floor..)
+ */
+ if (!event.world.isRemote && entity instanceof EntityPlayer)
+ {
+ EntityPlayer player = (EntityPlayer)entity;
+ NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+
+ boolean shouldGiveManual = ItemList.guide != null && !persistTag.getBoolean(GIVEN_GUIDE_TAG);
+ 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(GIVEN_GUIDE_TAG, true);
+ }
+ }
+ }
+
+ @SubscribeEvent
+ public void onWorldLoad(WorldEvent.Load event)
+ {
+ }
+
+ @SubscribeEvent
+ public void onWorldSave(WorldEvent.Save event)
+ {
+ }
+} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemList.java b/src/main/java/darkknight/jewelrycraft/item/ItemList.java
index 3a91c7b..370c1d3 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemList.java
+++ b/src/main/java/darkknight/jewelrycraft/item/ItemList.java
@@ -22,6 +22,7 @@ public class ItemList
public static ItemNecklace necklace;
public static Item guide;
public static ItemMoltenMetalBucket bucket;
+ public static ItemMoltenMetal metal;
private static boolean isInitialized = false;
@@ -38,6 +39,7 @@ public class ItemList
necklace = (ItemNecklace) new ItemNecklace().setUnlocalizedName("Jewelrycraft.necklace").setTextureName("jewelrycraft:necklace");
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");
GameRegistry.registerItem(thiefGloves, "thiefGloves");
GameRegistry.registerItem(shadowIngot, "shadowIngot");
@@ -48,6 +50,7 @@ public class ItemList
GameRegistry.registerItem(crystal, "crystal");
GameRegistry.registerItem(guide, "guide");
GameRegistry.registerItem(bucket, "moltenMetalBucket");
+ GameRegistry.registerItem(metal, "moltenMetal");
isInitialized = true;
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java
new file mode 100644
index 0000000..9bf9896
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java
@@ -0,0 +1,122 @@
+package darkknight.jewelrycraft.item;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.Iterator;
+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.BlockChest;
+import net.minecraft.block.BlockSkull;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.client.resources.IResourceManager;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.enchantment.EnchantmentHelper;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.monster.EntityIronGolem;
+import net.minecraft.entity.monster.EntitySnowman;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.InventoryEnderChest;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.tileentity.TileEntitySkull;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.block.BlockList;
+import darkknight.jewelrycraft.util.JewelryNBT;
+
+public class ItemMoltenMetal extends Item
+{
+ private int amplifier, cooldown = 0;
+ int index = 0;
+
+ public ItemMoltenMetal()
+ {
+ super();
+ this.setMaxStackSize(1);
+ }
+
+ public void registerIcons(IIconRegister iconRegister)
+ {
+ itemIcon = iconRegister.registerIcon("jewelrycraft:moltenMetalStill");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack stack, int pass)
+ {
+ try
+ {
+ return color(stack, pass);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return 16777215;
+ }
+
+ public static int color(ItemStack stack, int pass) throws IOException
+ {
+ String domain = "", texture;
+ IResourceManager rm = Minecraft.getMinecraft().getResourceManager();
+ BufferedImage icon;
+ int x=0, y=0, ok = 0, red, green, blue;
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && JewelryNBT.ingot(stack) != null && JewelryNBT.ingot(stack) != new ItemStack(Item.getItemById(0), 0, 0) && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215)
+ {
+ String ingotIconName = JewelryNBT.ingot(stack).getIconIndex().getIconName();
+
+ if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim();
+ else domain = "minecraft";
+
+ texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png";
+ ResourceLocation ingot = null;
+
+ if (JewelryNBT.ingot(stack).getUnlocalizedName().contains("item")) ingot = new ResourceLocation(domain, "textures/items/" + texture);
+ else ingot = new ResourceLocation(domain, "textures/blocks/" + texture);
+
+ icon = ImageIO.read(rm.getResource(ingot).getInputStream());
+ while(ok == 0)
+ {
+ red = (icon.getRGB(x, y) >> 16) & 0xFF;
+ green = (icon.getRGB(x, y) >> 8) & 0xFF;
+ blue = icon.getRGB(x, y) & 0xFF;
+ if((red <= 80 && green <= 80 && blue <= 80) || (red >= 180 && green >= 180 && blue >= 180))
+ {
+ if(x<icon.getTileWidth()-1) x++;
+ if(x>=icon.getTileWidth()-1 && y<icon.getTileWidth()-1)
+ {
+ x=0;
+ y++;
+ }
+ if(x == icon.getTileWidth()-1 && y==icon.getTileWidth()-1) ok=1;
+ }
+ else ok=1;
+ }
+ JewelryNBT.addIngotColor(stack, icon.getRGB(x, y));
+ }
+ if(JewelryNBT.ingot(stack) != null) return JewelryNBT.ingotColor(stack);
+ return 16777215;
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
index 18a17ad..4bb9050 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
+++ b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
@@ -1,14 +1,9 @@
package darkknight.jewelrycraft.item;
import java.awt.image.BufferedImage;
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.file.Files;
-import java.nio.file.StandardOpenOption;
import javax.imageio.ImageIO;
@@ -28,6 +23,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
+import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import cpw.mods.fml.common.eventhandler.Event;
@@ -35,6 +31,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.block.BlockList;
+import darkknight.jewelrycraft.block.BlockMoltenMetal;
import darkknight.jewelrycraft.util.JewelryNBT;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
@@ -206,12 +203,9 @@ public class ItemMoltenMetalBucket extends Item
else
{
if (!par1World.isRemote && flag && !material.isLiquid()) par1World.func_147480_a(par2, par3, par4, true);
- JewelrycraftUtil.liquids.put(String.valueOf(par2) + " " + String.valueOf(par3) + " " + String.valueOf(par4), JewelryNBT.ingot(stack).getItem());
- JewelrycraftMod.saveData = new NBTTagCompound();
- JewelrycraftMod.saveData.setString("coords", String.valueOf(par2) + " " + String.valueOf(par3) + " " + String.valueOf(par4));
- JewelrycraftMod.saveData.setInteger("item", Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()));
- CompressedStreamTools.writeCompressed(JewelrycraftMod.saveData, new FileOutputStream(JewelrycraftMod.liquidsConf));
- System.out.println(JewelrycraftMod.saveData.getString("coords"));
+
+ JewelrycraftMod.saveData.setInteger(String.valueOf(par2) + " " + String.valueOf(par3) + " " + String.valueOf(par4), Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()));
+
par1World.setBlock(par2, par3, par4, BlockList.moltenMetal, 0, 3);
return true;
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java b/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java
index 71af0a0..7206423 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java
+++ b/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java
@@ -145,7 +145,7 @@ public class ItemNecklace extends Item
*/
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
- if (stack.hasTagCompound() && Minecraft.getMinecraft().gameSettings.advancedItemTooltips)
+ if (stack.hasTagCompound())
{
ItemStack ingot = JewelryNBT.ingot(stack);
if (ingot != null) list.add("Ingot: " + EnumChatFormatting.YELLOW + ingot.getDisplayName());
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemRing.java b/src/main/java/darkknight/jewelrycraft/item/ItemRing.java
index fff9120..75b335d 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemRing.java
+++ b/src/main/java/darkknight/jewelrycraft/item/ItemRing.java
@@ -268,7 +268,7 @@ public class ItemRing extends Item
*/
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
- if (stack.hasTagCompound() && stack.getDisplayName() != "Wedding Ring" && Minecraft.getMinecraft().gameSettings.advancedItemTooltips)
+ if (stack.hasTagCompound() && stack.getDisplayName() != "Wedding Ring")
{
ItemStack ingot = JewelryNBT.ingot(stack);
if (ingot != null) list.add("Ingot: " + EnumChatFormatting.YELLOW + ingot.getDisplayName());
diff --git a/src/main/java/darkknight/jewelrycraft/lib/Reference.java b/src/main/java/darkknight/jewelrycraft/lib/Reference.java
index 407a756..ba22205 100644
--- a/src/main/java/darkknight/jewelrycraft/lib/Reference.java
+++ b/src/main/java/darkknight/jewelrycraft/lib/Reference.java
@@ -4,6 +4,6 @@ public class Reference
{
public static final String MODID = "Jewelrycraft";
public static final String MODNAME = "Jewelrycraft";
- public static final String VERSION = "1.3.3";
+ public static final String VERSION = "1.4";
public static final String PACKET_CHANNEL = "Jewelrycraft";
}
diff --git a/src/main/java/darkknight/jewelrycraft/renders/RendererSmelter.java b/src/main/java/darkknight/jewelrycraft/renders/RendererSmelter.java
new file mode 100644
index 0000000..ca5da8b
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/renders/RendererSmelter.java
@@ -0,0 +1,67 @@
+package darkknight.jewelrycraft.renders;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+
+public class RendererSmelter implements ISimpleBlockRenderingHandler
+{
+ public static int renderID;
+
+ public static Tessellator t;
+ public static float minU, minV, maxU, maxV;
+
+ public RendererSmelter(int id)
+ {
+ renderID = id;
+ }
+
+ @Override
+ public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer)
+ {
+
+ }
+
+ @Override
+ public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
+ {
+ t = Tessellator.instance;
+
+ t.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
+
+ t.setColorOpaque_F(0.6F, 0.6F, 0.6F);
+
+ bindTexture(Blocks.dirt.getIcon(1, 2));
+
+ t.addVertexWithUV(x, y + 0.5F, z, minU, minV);
+ t.addVertexWithUV(x, y, z, minU, maxV);
+ t.addVertexWithUV(x, y, z + 1F, maxU, maxV);
+ t.addVertexWithUV(x, y + 0.5F, z + 1F, maxU, minV);
+
+ return true;
+ }
+
+ public void bindTexture(IIcon texture)
+ {
+ minU = texture.getMinU();
+ minV = texture.getInterpolatedV(8);
+ maxU = texture.getMaxU();
+ maxV = texture.getMaxV();
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory(int modelId)
+ {
+ return false;
+ }
+
+ @Override
+ public int getRenderId()
+ {
+ return renderID;
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java b/src/main/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
index b7acffc..8956eb4 100644
--- a/src/main/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
+++ b/src/main/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
@@ -11,20 +11,17 @@ 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.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
-import net.minecraft.world.WorldServer;
-import net.minecraftforge.common.util.FakePlayer;
import org.lwjgl.opengl.GL11;
-import com.mojang.authlib.GameProfile;
-
import darkknight.jewelrycraft.model.ModelDisplayer;
import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
@@ -58,14 +55,15 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
renderLabel(Integer.toString(disp.quantity), 0F, (-0.171F)*ind, 0F, block, disp, Color.GRAY.getRGB());
GL11.glPopMatrix();
ind++;
- if(!(disp.object.getItem() instanceof ItemMap) && disp.object != null && disp.object != new ItemStack(Item.getItemById(0), 0, 0) && disp.object.getTooltip(te.getWorldObj().getClosestPlayer(x, y, z, 2D), true) != null)
+ EntityPlayer player = te.getWorldObj().getClosestPlayer(te.xCoord, te.yCoord, te.zCoord, 50D);
+ if(disp.object.getItem() != Items.map && player != null && disp.object.getTooltip(player, true) != null)
{
- for(int i = 1; i < disp.object.getTooltip(te.getWorldObj().getClosestPlayer(x, y, z, 2D), true).size(); i++)
+ for(int i = 1; i < disp.object.getTooltip(player, true).size(); i++)
{
- if(disp.object.getTooltip(te.getWorldObj().getClosestPlayer(x, y, z, 2D), true).get(i).toString() != "")
+ if(disp.object.getTooltip(player, true).get(i).toString() != "")
{
GL11.glPushMatrix();
- renderLabel(disp.object.getTooltip(te.getWorldObj().getClosestPlayer(x, y, z, 2D), true).get(i).toString(), 0F, (-0.171F)*ind, 0F, block, disp, Color.GRAY.getRGB());
+ renderLabel(disp.object.getTooltip(player, true).get(i).toString(), 0F, (-0.171F)*ind, 0F, block, disp, Color.GRAY.getRGB());
GL11.glPopMatrix();
ind++;
}
diff --git a/src/main/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java b/src/main/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
index 4dcec8c..1d31358 100644
--- a/src/main/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
+++ b/src/main/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
@@ -2,8 +2,10 @@ package darkknight.jewelrycraft.renders;
import org.lwjgl.opengl.GL11;
+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;
@@ -14,6 +16,8 @@ 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;
@@ -81,6 +85,25 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
+ if(me.hasMoltenMetal && me.moltenMetal != null && me.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0))
+ {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ ItemStack metal = new ItemStack(ItemList.metal);
+ JewelryNBT.addMetal(metal, new ItemStack(me.moltenMetal.getItem()));
+ 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.43f - 0.115f*me.quantity, -0.3F);
+ GL11.glScalef(1.2F, 1.0F, 1.45F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ RenderItem.renderInFrame = true;
+ RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
}
GL11.glPopMatrix();
GL11.glPopMatrix();
diff --git a/src/main/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java b/src/main/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
index 0c981c6..c3c3147 100644
--- a/src/main/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
+++ b/src/main/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
@@ -1,5 +1,7 @@
package darkknight.jewelrycraft.renders;
+import java.io.IOException;
+
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -10,21 +12,29 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+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 net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import darkknight.jewelrycraft.block.BlockList;
+import darkknight.jewelrycraft.block.BlockMoltenMetal;
+import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.model.ModelSmelter;
import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
+import darkknight.jewelrycraft.util.JewelryNBT;
public class TileEntitySmelterRender extends TileEntitySpecialRenderer
{
ModelSmelter modelSmelter = new ModelSmelter();
String texture = "textures/tileentities/Smelter.png";
+
+ public static final float p = 1 / 16, p3 = 3 * p, p13 = 13 * p, p15 = 15 * p;
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
@@ -57,6 +67,36 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
+ GL11.glPushMatrix();
+ GL11.glPopMatrix();
+
+ Tessellator t = Tessellator.instance;
+ float minU, minV, maxU, maxV;
+ IIcon lava = Blocks.lava.getIcon(1, 0);
+
+ t.setBrightness(15728864);
+
+ int meta = te.getWorldObj().getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
+
+ minU = lava.getMinU();
+ minV = lava.getMinV();
+ maxU = lava.getMaxU();
+ maxV = lava.getMaxV();
+ /*maxU = lava.getInterpolatedU(10);
+ maxV = lava.getInterpolatedV(14);*/
+
+
+
+ t.startDrawingQuads();
+
+ t.addVertexWithUV(te.xCoord, te.yCoord + p15, te.zCoord, minU, minV);
+ t.addVertexWithUV(te.xCoord, te.yCoord + p15, te.zCoord + 1, minU, maxV);
+ t.addVertexWithUV(te.xCoord + 1, te.yCoord + p15, te.zCoord + 1, maxU, maxV);
+ t.addVertexWithUV(te.xCoord + 1, te.yCoord + p15, te.zCoord, maxU, minV);
+
+ t.draw();
+
+ /*
GL11.glTranslatef(-0F, 1.25F, -0.3F);
GL11.glScalef(1.25F, 1.0F, 1.47F);
GL11.glRotatef(90F, 1F, 0F, 0f);
@@ -73,12 +113,13 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
GL11.glTranslatef(0F, -5.6F, 0.0F);
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderItem.renderInFrame = false;
+ RenderItem.renderInFrame = false;*/
+
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
if (st != null)
{
- if (st.hasMetal && st.metal != null && st.metal.getIconIndex() != null && st.metal.getIconIndex().getIconName() != "")
+ if (st.hasMetal && st.metal != null && st.metal != new ItemStack(Item.getItemById(0), 0, 0) && st.metal.getIconIndex() != null && st.metal.getIconIndex().getIconName() != "")
{
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
@@ -101,25 +142,25 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
-// if(st.hasMoltenMetal && st.moltenMetal != null)
-// {
-//
-// GL11.glPushMatrix();
-// GL11.glDisable(GL11.GL_LIGHTING);
-// EntityItem moltenMetal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, new ItemStack(BlockList.moltenMetal));
-// moltenMetal.getEntityItem().stackSize = 1;
-// moltenMetal.hoverStart = 0.0F;
-//
-// GL11.glColor4f(0f, 0f, 1f, 1f);
-// GL11.glTranslatef(-0F, 0.75F, -0.3F);
-// GL11.glScalef(1.25F, 1.0F, 1.47F);
-// GL11.glRotatef(90F, 1F, 0F, 0f);
-// RenderItem.renderInFrame = true;
-// RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
-// RenderItem.renderInFrame = false;
-// GL11.glEnable(GL11.GL_LIGHTING);
-// GL11.glPopMatrix();
-// }
+ if(st.hasMoltenMetal && st.moltenMetal != null && st.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0))
+ {
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_LIGHTING);
+ ItemStack metal = new ItemStack(ItemList.metal);
+ JewelryNBT.addMetal(metal, new ItemStack(st.moltenMetal.getItem()));
+ 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.1f -.5F*st.quantity, -0.3F);
+ GL11.glScalef(1.25F, 1.0F, 1.47F);
+ GL11.glRotatef(90F, 1F, 0F, 0f);
+ RenderItem.renderInFrame = true;
+ RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ RenderItem.renderInFrame = false;
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glPopMatrix();
+ }
}
GL11.glPopMatrix();
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
index e985f6f..a1b0561 100644
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
+++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
@@ -15,6 +15,7 @@ public class TileEntityMolder extends TileEntity
public int cooling;
public boolean hasMoltenMetal, hasJewelBase, hasMold, isDirty;
public ItemStack mold, jewelBase, moltenMetal, ringMetal;
+ public float quantity;
public TileEntityMolder()
{
@@ -23,6 +24,7 @@ public class TileEntityMolder extends TileEntity
this.mold = new ItemStack(Item.getItemById(0), 0, 0);
this.ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
this.cooling = 0;
+ this.quantity = 0f;
this.hasJewelBase = false;
this.hasMoltenMetal = false;
this.hasMold = false;
@@ -34,6 +36,7 @@ public class TileEntityMolder extends TileEntity
{
super.writeToNBT(nbt);
nbt.setInteger("cooling", cooling);
+ nbt.setFloat("quantity", quantity);
nbt.setBoolean("hasJewelBase", hasJewelBase);
nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
nbt.setBoolean("hasMold", hasMold);
@@ -56,6 +59,7 @@ public class TileEntityMolder extends TileEntity
{
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");
@@ -74,21 +78,19 @@ public class TileEntityMolder extends TileEntity
{
super.updateEntity();
if(isDirty){
- this.markDirty();
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
if (moltenMetal.getItem() != Item.getItemById(0))
{
- if(worldObj.rand.nextInt(20) == 0) this.worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.fizz", 0.5F, 1F);
+// 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 (this.hasMoltenMetal && !this.hasJewelBase)
{
ringMetal = moltenMetal;
- if (cooling > 0)
- this.cooling--;
+ if (cooling > 0 && quantity > 0.9f) this.cooling--;
if (cooling == 0)
{
this.hasMoltenMetal = false;
@@ -103,8 +105,8 @@ public class TileEntityMolder extends TileEntity
this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
this.hasJewelBase = true;
cooling = -1;
- this.isDirty = true;
- this.markDirty();
+ quantity = 0f;
+ isDirty = true;
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
index 53a9f82..5f4be83 100644
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
+++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
@@ -2,6 +2,8 @@ package darkknight.jewelrycraft.tileentity;
import java.util.Random;
+import darkknight.jewelrycraft.config.ConfigHandler;
+
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -12,114 +14,146 @@ import net.minecraft.tileentity.TileEntity;
public class TileEntitySmelter extends TileEntity
{
- public int melting, flow, n = 0, p = 0;
- public boolean hasMetal, hasMoltenMetal, isDirty;
- public ItemStack metal, moltenMetal;
-
- public TileEntitySmelter()
- {
- this.melting = 0;
- this.flow = 0;
- 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;
- }
-
- @Override
- public void writeToNBT(NBTTagCompound nbt)
- {
- super.writeToNBT(nbt);
- nbt.setInteger("melting", melting);
- nbt.setBoolean("hasMetal", hasMetal);
- nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
- NBTTagCompound tag = new NBTTagCompound();
- NBTTagCompound tag1 = new NBTTagCompound();
- this.metal.writeToNBT(tag);
- nbt.setTag("metal", tag);
- this.moltenMetal.writeToNBT(tag1);
- nbt.setTag("moltenMetal", tag1);
- }
-
- @Override
- public void readFromNBT(NBTTagCompound nbt)
- {
- super.readFromNBT(nbt);
- this.melting = nbt.getInteger("melting");
- this.hasMetal = nbt.getBoolean("hasMetal");
- this.hasMoltenMetal = nbt.getBoolean("hasMoltenMetal");
- 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"));
- }
-
- @Override
- public void updateEntity()
- {
- super.updateEntity();
- Random rand = new Random();
- if(isDirty){
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- isDirty = false;
- }
- if (p > 0)
- --p;
- else
- p = 5;
- if (n == 0 && p == 0)
- {
- flow += 16;
- if (flow >= 16 * 20)
- n = 1;
- }
- if (n == 1 && p == 0)
- {
- flow -= 16;
- if (flow <= 0)
- n = 0;
- }
- if (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 (this.hasMetal)
- {
- if (melting > 0)
- this.melting--;
- if (melting == 0)
- {
- this.hasMetal = false;
- this.moltenMetal = metal;
- this.metal = new ItemStack(Item.getItemById(0), 0, 0);
- this.hasMoltenMetal = true;
- melting = -1;
- this.isDirty = true;
- this.markDirty();
- }
- }
- }
-
- 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);
- }
+ public int melting, flow, n = 0, p = 0;
+ public boolean hasMetal, hasMoltenMetal, isDirty, pouring;
+ public ItemStack metal, moltenMetal;
+ public float quantity;
+
+ 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;
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ nbt.setInteger("melting", melting);
+ nbt.setFloat("quantity", quantity);
+ nbt.setBoolean("hasMetal", hasMetal);
+ nbt.setBoolean("hasMoltenMetal", hasMoltenMetal);
+ nbt.setBoolean("pouring", pouring);
+ NBTTagCompound tag = new NBTTagCompound();
+ NBTTagCompound tag1 = new NBTTagCompound();
+ this.metal.writeToNBT(tag);
+ nbt.setTag("metal", tag);
+ this.moltenMetal.writeToNBT(tag1);
+ nbt.setTag("moltenMetal", tag1);
+ }
+
+ @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"));
+ }
+
+ @Override
+ public void updateEntity()
+ {
+ super.updateEntity();
+ Random rand = new Random();
+ if(isDirty){
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ isDirty = false;
+ }
+ if (p > 0)
+ --p;
+ else
+ p = 5;
+ if (n == 0 && p == 0)
+ {
+ flow += 16;
+ if (flow >= 16 * 20)
+ n = 1;
+ }
+ if (n == 1 && p == 0)
+ {
+ flow -= 16;
+ if (flow <= 0)
+ n = 0;
+ }
+ if (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 (this.hasMetal)
+ {
+ if (melting > 0)
+ this.melting--;
+ if (melting == 0)
+ {
+ this.hasMetal = false;
+ this.moltenMetal = metal;
+ this.metal = new ItemStack(Item.getItemById(0), 0, 0);
+ this.hasMoltenMetal = true;
+ this.quantity = 1f;
+ melting = -1;
+ this.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){
+ quantity -= 0.01f;
+ me.quantity += 0.01f;
+ if(!me.hasMoltenMetal)
+ {
+ me.moltenMetal = moltenMetal;
+ me.hasMoltenMetal = true;
+ }
+ if(quantity < 0){
+ quantity = 0f;
+ hasMoltenMetal = false;
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ pouring = false;
+ me.cooling = ConfigHandler.ingotCoolingTime;
+ }
+ }
+ }
+
+ 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);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
index 271f6f9..905665e 100644
--- a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
+++ b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
@@ -19,7 +19,6 @@ public class JewelrycraftUtil
public static ArrayList<ItemStack> jewelry = new ArrayList<ItemStack>();
public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
public static ArrayList<String> jamcraftPlayers = new ArrayList<String>();
- public static HashMap<String,Item> liquids = new HashMap<String,Item>();
public static Random rand = new Random();
public static void addStuff()
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java
index f484c0b..9ff79ab 100644
--- a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java
@@ -2,6 +2,7 @@ package darkknight.jewelrycraft.worldGen;
import java.util.Random;
+import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import cpw.mods.fml.common.IWorldGenerator;
@@ -37,7 +38,8 @@ public class Generation implements IWorldGenerator
int y = 5 + random.nextInt(4);
int z = j + random.nextInt(16);
world.setBlock(x, y, z, BlockList.shadowOre);
- if(random.nextInt(3) == 0) world.setBlock(x + random.nextInt(2), y + random.nextInt(1), z + random.nextInt(2), BlockList.shadowOre);
+ int randX = random.nextInt(2), randY = random.nextInt(1), randZ = random.nextInt(2);
+ if(random.nextInt(3) == 0 && world.getBlock(x + randX, y + randY, z + randZ) == Blocks.stone) world.setBlock(x + randX, y + randY, z + randZ, BlockList.shadowOre);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java b/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
index 6924940..0a79b79 100644
--- a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
+++ b/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
@@ -301,6 +301,7 @@ public class ComponentJewelry extends StructureVillagePieces.House1
{
smelter.moltenMetal = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
smelter.hasMoltenMetal = true;
+ smelter.quantity = 1f;
}
}
@@ -320,8 +321,11 @@ public class ComponentJewelry extends StructureVillagePieces.House1
if(hasStuff){
ItemStack ring = new ItemStack(ItemList.ring);
JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
+ ItemStack necklace = new ItemStack(ItemList.necklace);
+ JewelryNBT.addMetal(necklace, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
if(meta == 0) molder.jewelBase = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
- else molder.jewelBase = ring;
+ else if(meta == 1) molder.jewelBase = ring;
+ else molder.jewelBase = necklace;
molder.hasJewelBase = true;
}
}
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png b/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png
new file mode 100644
index 0000000..1eff844
--- /dev/null
+++ b/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta b/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta
new file mode 100644
index 0000000..7ceb363
--- /dev/null
+++ b/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta
@@ -0,0 +1,45 @@
+{
+ "animation": {
+ "frametime": 2,
+ "frames": [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 18,
+ 17,
+ 16,
+ 15,
+ 14,
+ 13,
+ 12,
+ 11,
+ 10,
+ 9,
+ 8,
+ 7,
+ 6,
+ 5,
+ 4,
+ 3,
+ 2,
+ 1
+ ]
+ }
+} \ No newline at end of file