summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-16 16:34:17 +0200
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2013-12-16 16:34:17 +0200
commit26d28c9b93133a6cfc5d2544c662e9d77955b6f5 (patch)
treeba4a4cb9829a14db82e67af26e2e21fc59571ead /common
parent1f718427162fa59a22c08a32e68e133fb411aa37 (diff)
Rings and molder
Diffstat (limited to 'common')
-rw-r--r--common/darkknight/jewelrycraft/block/BlockMolder.java12
-rw-r--r--common/darkknight/jewelrycraft/block/BlockSmelter.java5
-rw-r--r--common/darkknight/jewelrycraft/config/ConfigHandler.java4
-rw-r--r--common/darkknight/jewelrycraft/item/ItemList.java2
-rw-r--r--common/darkknight/jewelrycraft/item/ItemMolds.java9
-rw-r--r--common/darkknight/jewelrycraft/item/ItemRing.java46
-rw-r--r--common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java29
-rw-r--r--common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java19
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java31
-rw-r--r--common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java37
10 files changed, 131 insertions, 63 deletions
diff --git a/common/darkknight/jewelrycraft/block/BlockMolder.java b/common/darkknight/jewelrycraft/block/BlockMolder.java
index 36a48f7..f948e39 100644
--- a/common/darkknight/jewelrycraft/block/BlockMolder.java
+++ b/common/darkknight/jewelrycraft/block/BlockMolder.java
@@ -3,6 +3,7 @@ package darkknight.jewelrycraft.block;
import java.util.Random;
import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.item.ItemRing;
import darkknight.jewelrycraft.tileentity.TileEntityMolder;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -108,11 +109,20 @@ public class BlockMolder extends BlockContainer
TileEntityMolder me = (TileEntityMolder) world.getBlockTileEntity(i, j, k);
if(me != null && me.hasJewelBase)
{
- player.inventory.addItemStackToInventory(new ItemStack(me.jewelBase.itemID, 1, me.jewelBase.getItemDamage()));
+ giveJewelToPlayer(me, player, me.jewelBase, me.ringMetal);
me.jewelBase = new ItemStack(0, 0, 0);
me.hasJewelBase = false;
}
}
+
+ public void giveJewelToPlayer(TileEntityMolder md, EntityPlayer player, ItemStack item, ItemStack metal)
+ {
+ if(item.getItem() == ItemList.ring){
+ ItemRing ring = new ItemRing(item.itemID, metal);
+ player.inventory.addItemStackToInventory(new ItemStack(ring));
+ }
+ else player.inventory.addItemStackToInventory(item);
+ }
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
diff --git a/common/darkknight/jewelrycraft/block/BlockSmelter.java b/common/darkknight/jewelrycraft/block/BlockSmelter.java
index cf9782d..d4119e4 100644
--- a/common/darkknight/jewelrycraft/block/BlockSmelter.java
+++ b/common/darkknight/jewelrycraft/block/BlockSmelter.java
@@ -80,7 +80,7 @@ public class BlockSmelter extends BlockContainer
{
te.metal = new ItemStack(item.itemID, 1, item.getItemDamage());
te.hasMetal = true;
- te.melting = 200000;
+ te.melting = 2000;
--item.stackSize;
}
else if (te.hasMetal && !te.hasMoltenMetal && item != null && item.getDisplayName().contains("Ingot") && !item.getDisplayName().contains("Mold"))
@@ -115,7 +115,7 @@ public class BlockSmelter extends BlockContainer
{
me.moltenMetal = te.moltenMetal;
me.hasMoltenMetal = true;
- me.cooling = 2000;
+ me.cooling = 200;
te.moltenMetal = new ItemStack(0, 0, 0);
te.hasMoltenMetal = false;
}
@@ -141,7 +141,6 @@ public class BlockSmelter extends BlockContainer
{
int rotation = MathHelper.floor_double((double)(entityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
- System.out.println(world.getBlockMetadata(i, j, k));
}
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
diff --git a/common/darkknight/jewelrycraft/config/ConfigHandler.java b/common/darkknight/jewelrycraft/config/ConfigHandler.java
index aaa0887..56eb42e 100644
--- a/common/darkknight/jewelrycraft/config/ConfigHandler.java
+++ b/common/darkknight/jewelrycraft/config/ConfigHandler.java
@@ -8,7 +8,8 @@ public class ConfigHandler
private static Configuration config;
public static int idThiefGloves = 17493;
public static int idShadowIngot = 17494;
- public static int idMolds = 17495;
+ public static int idMolds = 17495;
+ public static int idRing = 17496;
public static int idShadowOre = 1750;
public static int idSmelter = 1751;
@@ -28,6 +29,7 @@ public class ConfigHandler
idThiefGloves = config.getItem("id.ThiefGloves", idThiefGloves).getInt();
idShadowIngot = config.getItem("id.ShadowIngot", idShadowIngot).getInt();
idMolds = config.getItem("id.Molds", idMolds).getInt();
+ idRing = config.getItem("id.Ring", idRing).getInt();
idShadowOre = config.getBlock("id.ShadowOre", idShadowOre).getInt();
idSmelter = config.getBlock("id.Smelter", idSmelter).getInt();
idMolder = config.getBlock("id.Molder", idMolder).getInt();
diff --git a/common/darkknight/jewelrycraft/item/ItemList.java b/common/darkknight/jewelrycraft/item/ItemList.java
index 261fa9e..5418c52 100644
--- a/common/darkknight/jewelrycraft/item/ItemList.java
+++ b/common/darkknight/jewelrycraft/item/ItemList.java
@@ -10,6 +10,7 @@ public class ItemList
public static Item thiefGloves;
public static Item shadowIngot;
public static Item molds;
+ public static Item ring;
private static boolean isInitialized = false;
@@ -20,6 +21,7 @@ public class ItemList
thiefGloves = new ItemThiefGloves(ConfigHandler.idThiefGloves).setUnlocalizedName("jewelrycraft.thiefGloves").setCreativeTab(JewelrycraftMod.jewelrycraft);
shadowIngot = new ItemBase(ConfigHandler.idShadowIngot).setUnlocalizedName("jewelrycraft.ingotShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
molds = new ItemMolds(ConfigHandler.idMolds).setUnlocalizedName("jewelrycraft.mold").setTextureName("Mold").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ ring = new ItemRing(ConfigHandler.idRing).setUnlocalizedName("jewelrycraft.ring").setCreativeTab(JewelrycraftMod.jewelrycraft);
}
}
}
diff --git a/common/darkknight/jewelrycraft/item/ItemMolds.java b/common/darkknight/jewelrycraft/item/ItemMolds.java
index 9beb03a..090d53a 100644
--- a/common/darkknight/jewelrycraft/item/ItemMolds.java
+++ b/common/darkknight/jewelrycraft/item/ItemMolds.java
@@ -14,7 +14,7 @@ import net.minecraft.util.MathHelper;
public class ItemMolds extends Item
{
/** List of molds color names */
- public static final String[] moldsItemNames = new String[] {"ingot", "ring", "necklace"};
+ public static final String[] moldsItemNames = new String[] {"ingot", "ring"};
@SideOnly(Side.CLIENT)
private Icon[] moldsIcons;
@@ -24,7 +24,6 @@ public class ItemMolds extends Item
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setMaxStackSize(1);
- this.setCreativeTab(CreativeTabs.tabMaterials);
}
@SideOnly(Side.CLIENT)
@@ -34,7 +33,7 @@ public class ItemMolds extends Item
*/
public Icon getIconFromDamage(int par1)
{
- int j = MathHelper.clamp_int(par1, 0, 2);
+ int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
return this.moldsIcons[j];
}
@@ -44,7 +43,7 @@ public class ItemMolds extends Item
*/
public String getUnlocalizedName(ItemStack par1ItemStack)
{
- int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 2);
+ int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1);
return super.getUnlocalizedName() + "." + moldsItemNames[i];
}
@@ -56,7 +55,7 @@ public class ItemMolds extends Item
*/
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
- for (int j = 0; j < 3; ++j)
+ for (int j = 0; j < moldsItemNames.length; ++j)
{
par3List.add(new ItemStack(par1, 1, j));
}
diff --git a/common/darkknight/jewelrycraft/item/ItemRing.java b/common/darkknight/jewelrycraft/item/ItemRing.java
new file mode 100644
index 0000000..155261c
--- /dev/null
+++ b/common/darkknight/jewelrycraft/item/ItemRing.java
@@ -0,0 +1,46 @@
+package darkknight.jewelrycraft.item;
+
+import java.util.List;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ItemRing extends ItemBase
+{
+ public ItemStack ingot;
+ public PotionEffect effect;
+
+ public ItemRing(int par1)
+ {
+ super(par1);
+ this.setMaxStackSize(1);
+ }
+
+ public ItemRing(int par1, ItemStack ingot)
+ {
+ this(par1);
+ this.ingot = ingot;
+ }
+
+ public ItemRing(int par1, ItemStack ingot, PotionEffect effect)
+ {
+ this(par1, ingot);
+ this.effect = effect;
+ }
+
+ public int getColor(ItemStack par1ItemStack)
+ {
+ return 65535;
+ }
+
+ /**
+ * allows items to add custom lines of information to the mouseover description
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
+ {
+ if(ingot != null) list.add(EnumChatFormatting.GRAY + ingot.getDisplayName());
+ if(effect != null) list.add(EnumChatFormatting.GREEN + effect.getEffectName());
+ }
+}
diff --git a/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java b/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
index 3a91770..054cabd 100644
--- a/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
+++ b/common/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
@@ -36,33 +36,6 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
modelMolder.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
if(me != null)
{
- if(me.hasJewelBase)
- {
- String texture = "textures/items/" + me.jewelBase.getDisplayName() + ".png";
- ResourceLocation lava = new ResourceLocation(null, "textures/items/iron_ingot.png");
- Minecraft.getMinecraft().renderEngine.bindTexture(lava);
- me.jewelBase.getIconIndex().getInterpolatedU(0);
- int decal = 32;
- double minu = me.jewelBase.getIconIndex().getInterpolatedU(0);
- double minv = me.jewelBase.getIconIndex().getInterpolatedV(0);
- double maxu = me.jewelBase.getIconIndex().getInterpolatedU(16);
- double maxv = me.jewelBase.getIconIndex().getInterpolatedV(16);
- GL11.glPushMatrix();
- GL11.glScalef(1f/16f, 1f/16f, 1f/16f);
- GL11.glDisable(GL11.GL_LIGHTING);
-
- for(float f = 0; f <= 1; f+=0.05)
- {
- tessellator.startDrawingQuads();
- tessellator.addVertexWithUV(5, 21+f, 5, minu, minv);
- tessellator.addVertexWithUV(-5, 21+f, 5, maxu, minv);
- tessellator.addVertexWithUV(-5, 21+f, -5, maxu, maxv);
- tessellator.addVertexWithUV(5, 21+f, -5, minu, maxv);
- tessellator.draw();
- }
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glPopMatrix();
- }
if(me.hasMold)
{
String name = me.mold.getDisplayName().substring(0, 1).toLowerCase() + me.mold.getDisplayName().trim().substring(1).replace(" M", "M");
@@ -81,7 +54,7 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
GL11.glScalef(1f/16f, 1f/16f, 1f/16f);
GL11.glDisable(GL11.GL_LIGHTING);
- for(float f = 0; f <= 1; f+=0.05)
+ for(float f = 0; f <= 2; f+=0.01)
{
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(5, 21+f, 5, minu, minv);
diff --git a/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java b/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
index adee8ec..48e5353 100644
--- a/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
+++ b/common/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
@@ -3,6 +3,7 @@ package darkknight.jewelrycraft.renders;
import org.lwjgl.opengl.GL11;
import darkknight.jewelrycraft.model.ModelSmelter;
+import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -40,11 +41,11 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
modelSmelter.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
Minecraft.getMinecraft().renderEngine.bindTexture(lava);
- Block.lavaStill.getIcon(0, 0).getInterpolatedU(0);
- double minu = Block.lavaStill.getIcon(2, 0).getInterpolatedU(0);
- double minv = Block.lavaStill.getIcon(2, 0).getInterpolatedV(0);
- double maxu = Block.lavaStill.getIcon(2, 0).getInterpolatedU(256);
- double maxv = Block.lavaStill.getIcon(2, 0).getInterpolatedV(256);
+ Block.lavaStill.getIcon(3, 0).getInterpolatedU(0);
+ double minu = Block.lavaStill.getIcon(3, 0).getInterpolatedU(0);
+ double minv = Block.lavaStill.getIcon(3, 0).getInterpolatedV(((TileEntitySmelter)te).flow);
+ double maxu = Block.lavaStill.getIcon(3, 0).getInterpolatedU(256);
+ double maxv = Block.lavaStill.getIcon(3, 0).getInterpolatedV(16 + ((TileEntitySmelter)te).flow);
GL11.glPushMatrix();
GL11.glScalef(1f/16f, 1f/16f, 1f/16f);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -55,10 +56,10 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
tessellator.addVertexWithUV(-5, 20, -6, maxu, maxv);
tessellator.addVertexWithUV(5, 20, -6, minu, maxv);
- tessellator.addVertexWithUV(4, 20, -6, maxu, maxv);
- tessellator.addVertexWithUV(-4, 20, -6, maxu, minv);
- tessellator.addVertexWithUV(-4, 20, -7, minu, minv);
- tessellator.addVertexWithUV(4, 20, -7, minu, maxv);
+ tessellator.addVertexWithUV(-4, 20, -7, maxu, maxv);
+ tessellator.addVertexWithUV(4, 20, -7, maxu, minv);
+ tessellator.addVertexWithUV(4, 20, -6, minu, minv);
+ tessellator.addVertexWithUV(-4, 20, -6, minu, maxv);
tessellator.addVertexWithUV(4, 20, 7, maxu, maxv);
tessellator.addVertexWithUV(-4, 20, 7, maxu, minv);
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
index 092bb47..27cd27e 100644
--- a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
+++ b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
@@ -1,8 +1,8 @@
package darkknight.jewelrycraft.tileentity;
+import darkknight.jewelrycraft.item.ItemList;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
@@ -12,13 +12,14 @@ public class TileEntityMolder extends TileEntity
{
public int cooling;
public boolean hasMoltenMetal, hasJewelBase, hasMold;
- public ItemStack mold, jewelBase, moltenMetal;
+ public ItemStack mold, jewelBase, moltenMetal, ringMetal;
public TileEntityMolder()
{
this.moltenMetal = new ItemStack(0, 0, 0);
this.jewelBase = new ItemStack(0, 0, 0);
this.mold = new ItemStack(0, 0, 0);
+ this.ringMetal = new ItemStack(0, 0, 0);
this.cooling = 0;
this.hasJewelBase = false;
this.hasMoltenMetal = false;
@@ -36,12 +37,15 @@ public class TileEntityMolder extends TileEntity
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound tag1 = new NBTTagCompound();
NBTTagCompound tag2 = new NBTTagCompound();
+ NBTTagCompound tag3 = new NBTTagCompound();
this.mold.writeToNBT(tag);
nbt.setCompoundTag("mold", tag);
this.jewelBase.writeToNBT(tag1);
nbt.setCompoundTag("jewelBase", tag1);
this.moltenMetal.writeToNBT(tag2);
nbt.setCompoundTag("moltenMetal", tag2);
+ this.ringMetal.writeToNBT(tag2);
+ nbt.setCompoundTag("ringMetal", tag3);
}
@Override
@@ -58,6 +62,8 @@ public class TileEntityMolder extends TileEntity
this.jewelBase.readFromNBT(nbt.getCompoundTag("jewelBase"));
this.moltenMetal = new ItemStack(0, 0, 0);
this.moltenMetal.readFromNBT(nbt.getCompoundTag("moltenMetal"));
+ this.ringMetal = new ItemStack(0, 0, 0);
+ this.ringMetal.readFromNBT(nbt.getCompoundTag("ringMetal"));
}
public void updateEntity()
@@ -65,22 +71,27 @@ public class TileEntityMolder extends TileEntity
super.updateEntity();
if(this.hasMoltenMetal && !this.hasJewelBase)
{
- while(cooling > 0)
- {
- this.cooling--;
- System.out.println(cooling);
- }
+ ringMetal = moltenMetal;
+ if(cooling > 0) this.cooling--;
+ System.out.println(mold.getItemDamage());
if(cooling == 0)
{
this.hasMoltenMetal = false;
- this.jewelBase = moltenMetal;
+ if(mold.getItemDamage() == 0) this.jewelBase = moltenMetal;
+ else this.jewelBase = new ItemStack(ItemList.ring);
this.moltenMetal = new ItemStack(0, 0, 0);
this.hasJewelBase = true;
}
+
+ this.worldObj.playSoundEffect((double)((float)xCoord + 0.5F), (double)((float)yCoord + 0.5F), (double)((float)zCoord + 0.5F), "random.fizz", 0.5F, 2.6F + 0.2F * 0.8F);
+ for (int l = 0; l < 4; ++l)
+ {
+ //EntityFX entityfx = new EntityReddustFX(this.worldObj, (double)xCoord + Math.random(), (double)yCoord + 0.2D, (double)zCoord + Math.random(), 0.0F, 0.0F, 0.0F);
+ this.worldObj.spawnParticle("reddust", (double)xCoord + Math.random(), (double)yCoord + 0.2F, (double)zCoord + Math.random(), 0.0D, 1.0D, 0.0D);
+ }
}
- System.out.print(hasJewelBase);
}
-
+
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
{
readFromNBT(pkt.data);
diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
index 3433945..cefd21e 100644
--- a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
+++ b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
@@ -1,5 +1,7 @@
package darkknight.jewelrycraft.tileentity;
+import java.util.Random;
+
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
@@ -8,13 +10,14 @@ import net.minecraft.tileentity.TileEntity;
public class TileEntitySmelter extends TileEntity
{
- public int melting;
+ public int melting, flow, n=0, p=0;
public boolean hasMetal, hasMoltenMetal;
public ItemStack metal, moltenMetal;
public TileEntitySmelter()
{
this.melting = 0;
+ this.flow = 0;
this.hasMetal = false;
this.hasMoltenMetal= false;
this.metal = new ItemStack(0, 0, 0);
@@ -52,13 +55,35 @@ public class TileEntitySmelter extends TileEntity
public void updateEntity()
{
super.updateEntity();
- if(this.hasMetal && !this.hasMoltenMetal)
- {
- while(melting > 0)
+ Random rand = new Random();
+ 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.melting > 0)
+ {
+ for (int l = 0; l < 5; ++l)
{
- this.melting--;
- System.out.println(melting);
+ //EntityFX entityfx = new EntityReddustFX(this.worldObj, (double)xCoord + Math.random(), (double)yCoord + 0.2D, (double)zCoord + Math.random(), 0.0F, 0.0F, 0.0F);
+ this.worldObj.spawnParticle("flame", (double)xCoord + Math.random(), (double)yCoord + 0.5F, (double)zCoord + Math.random(), 0.0D, 0.0D, 0.0D);
}
+ }
+ if(rand.nextInt(15) == 0){
+ double d5 = (double)((float)this.xCoord + rand.nextFloat());
+ double d7 = (double)this.yCoord;
+ double d6 = (double)((float)this.zCoord + rand.nextFloat());
+ //this.worldObj.spawnParticle("lava", d5, d7, d6, 0.0D, 0.0D, 0.0D);
+ this.worldObj.playSound(d5, d7, d6, "liquid.lavapop", 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
+ }
+ if(this.hasMetal)
+ {
+ if(melting > 0) this.melting--;
if(melting == 0)
{
this.hasMetal = false;