summaryrefslogtreecommitdiff
path: root/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-04-15 22:41:43 +0300
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-04-15 22:41:43 +0300
commit4b8b13b34d7a8fd0ee7c7b13f11be9c2bf3b5d18 (patch)
treeb49bc483d576ec3abeb2e18523e4511ecce353d3 /eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block
parent86398ed60db321f86e8d98f191107fdac2c93760 (diff)
More 1.7 stuff
Diffstat (limited to 'eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block')
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockDisplayer.java9
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelAltar.java8
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java11
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockList.java95
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockMolder.java11
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockMoltenMetal.java117
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java16
-rw-r--r--eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockSmelter.java10
8 files changed, 213 insertions, 64 deletions
diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockDisplayer.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockDisplayer.java
index be50e82..efdddff 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockDisplayer.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockDisplayer.java
@@ -71,6 +71,7 @@ public class BlockDisplayer extends BlockContainer
te.hasObject = true;
if (!entityPlayer.capabilities.isCreativeMode) item.stackSize = 0;
te.isDirty = true;
+ te.markDirty();
}
else if(te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage())
{
@@ -80,13 +81,15 @@ public class BlockDisplayer extends BlockContainer
te.object.stackSize = 1;
if (!entityPlayer.capabilities.isCreativeMode) item.stackSize = 0;
te.isDirty = true;
+ te.markDirty();
}
else if(!te.object.hasTagCompound() && !item.hasTagCompound())
{
te.quantity += item.stackSize;
te.object.stackSize = 1;
if (!entityPlayer.capabilities.isCreativeMode) item.stackSize = 0;
- te.isDirty = true;
+ te.isDirty = true;
+ te.markDirty();
}
}
}
@@ -119,6 +122,7 @@ public class BlockDisplayer extends BlockContainer
te.quantity = 0;
}
te.isDirty = true;
+ te.markDirty();
}
else
{
@@ -137,6 +141,7 @@ public class BlockDisplayer extends BlockContainer
te.quantity = 0;
}
te.isDirty = true;
+ te.markDirty();
}
}
}
@@ -159,7 +164,7 @@ public class BlockDisplayer extends BlockContainer
{
te.object.stackSize = te.quantity;
dropItem(te.getWorldObj(), (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.object);
- world.markBlockForUpdate(i, j, k);
+ world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, block, par6);
diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelAltar.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelAltar.java
index b4193f1..cbf7fef 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelAltar.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelAltar.java
@@ -35,7 +35,7 @@ public class BlockJewelAltar extends BlockContainer
return true;
}
- public void registerIcons(IIconRegister par1IconRegister)
+ public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.altarSide = par1IconRegister.registerIcon(this.getTextureName() + "_" + "side");
this.altarBottom = par1IconRegister.registerIcon(this.getTextureName() + "_" + "bottom");
@@ -54,12 +54,13 @@ public class BlockJewelAltar extends BlockContainer
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null && !world.isRemote)
{
- if(item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && (item.equals(ItemList.ring) || item.equals(ItemList.necklace)) && !te.hasObject)
+ 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();
te.isDirty = true;
+ te.markDirty();
te.hasObject = true;
}
@@ -69,6 +70,7 @@ public class BlockJewelAltar extends BlockContainer
te.object = new ItemStack(Item.getItemById(0), 0, 0);
te.playerName = "";
te.isDirty = true;
+ te.markDirty();
te.hasObject = false;
}
}
@@ -103,7 +105,7 @@ public class BlockJewelAltar extends BlockContainer
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);
- world.markBlockForUpdate(i, j, k);
+ world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, block, par6);
diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
index b4a0f31..a701467 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
@@ -66,6 +66,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
entityPlayer.inventory.markDirty();
world.setTileEntity(i, j, k, te);
te.isDirty = true;
+ te.markDirty();
}
}
if (!te.hasEndItem && !te.hasModifier && item != null && JewelrycraftUtil.isModifier(item))
@@ -81,6 +82,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
entityPlayer.inventory.markDirty();
world.setTileEntity(i, j, k, te);
te.isDirty = true;
+ te.markDirty();
}
}
if (!te.hasEndItem && !te.hasJewel && item != null && JewelrycraftUtil.isJewel(item))
@@ -96,6 +98,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
entityPlayer.inventory.markDirty();
world.setTileEntity(i, j, k, te);
te.isDirty = true;
+ te.markDirty();
}
}
if (te.timer <= 0 && !te.hasEndItem && te.hasJewelry && (te.hasModifier || te.hasJewel)){ te.timer = ConfigHandler.jewelryCraftingTime; te.angle = 0;}
@@ -109,6 +112,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.timer = 0;
te.angle = 0F;
te.isDirty = true;
+ te.markDirty();
world.markBlockForUpdate(i, j, k);
world.setTileEntity(i, j, k, te);
}
@@ -120,6 +124,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.timer = 0;
te.angle = 0F;
te.isDirty = true;
+ te.markDirty();
world.markBlockForUpdate(i, j, k);
world.setTileEntity(i, j, k, te);
}
@@ -131,6 +136,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.timer = 0;
te.angle = 0F;
te.isDirty = true;
+ te.markDirty();
world.markBlockForUpdate(i, j, k);
world.setTileEntity(i, j, k, te);
}
@@ -156,7 +162,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
if (te.hasJewelry) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewelry.copy());
if (te.hasJewel) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.jewel.copy());
if (te.hasEndItem) dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.endItem.copy());
- world.markBlockForUpdate(i, j, k);
+ world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, par5, par6);
}
@@ -180,6 +186,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.endItem = new ItemStack(Item.getItemById(0), 0, 0);
te.hasEndItem = false;
te.isDirty = true;
+ te.markDirty();
world.markBlockForUpdate(i, j, k);
world.setTileEntity(i, j, k, te);
}
@@ -208,7 +215,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
return -1;
}
- public void registerIcons(IIconRegister icon)
+ public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("jewelrycraft:jewelrsCraftingTable");
}
diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockList.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockList.java
index 1d91a45..60d4b96 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockList.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockList.java
@@ -1,9 +1,9 @@
package darkknight.jewelrycraft.block;
import net.minecraft.block.Block;
-import net.minecraft.block.BlockOre;
import net.minecraft.block.material.Material;
-import net.minecraft.item.ItemPickaxe;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import darkknight.jewelrycraft.JewelrycraftMod;
@@ -16,46 +16,53 @@ import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
public class BlockList
{
- public static Block shadowOre;
- public static Block glow;
- public static Block smelter;
- public static Block molder;
- public static Block displayer;
- public static Block jewelCraftingTable;
- public static Block shadowBlock;
- public static Block jewelAltar;
-
- private static boolean isInitialized = false;
-
- public static void preInit(FMLPreInitializationEvent e)
- {
- if (!isInitialized)
- {
- shadowOre = new BlockJCOre().setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypeStone).setBlockTextureName("jewelrycraft:oreShadow").setBlockName("Jewelrycraft.oreShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
- glow = new BlockGlow().setBlockName("Jewelrycraft.glow").setLightLevel(1F);
- smelter = new BlockSmelter(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypeStone).setBlockName("Jewelrycraft.smelter").setCreativeTab(JewelrycraftMod.jewelrycraft);
- molder = new BlockMolder(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypeStone).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);
- jewelCraftingTable = new BlockJewelrsCraftingTable(Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypeStone).setBlockName("Jewelrycraft.jewelCraftingTable").setCreativeTab(JewelrycraftMod.jewelrycraft);
- shadowBlock = new BlockShadow().setHardness(5.0F).setResistance(7.0F).setStepSound(Block.soundTypeMetal).setBlockTextureName("jewelrycraft:blockShadow").setBlockName("Jewelrycraft.blockShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
- jewelAltar = new BlockJewelAltar().setHardness(5.0F).setResistance(2.0F).setStepSound(Block.soundTypeMetal).setBlockTextureName("jewelrycraft:altar").setBlockName("Jewelrycraft.altar").setCreativeTab(JewelrycraftMod.jewelrycraft);
-
- GameRegistry.registerBlock(shadowOre, "shadowOre");
- GameRegistry.registerBlock(shadowBlock, "shadowBlock");
- GameRegistry.registerBlock(smelter, "Smelter");
- GameRegistry.registerBlock(molder, "Molder");
- GameRegistry.registerBlock(jewelCraftingTable, "jewelCraftingTable");
- GameRegistry.registerBlock(displayer, "Displayer");
- GameRegistry.registerBlock(jewelAltar, "Altar");
-
- GameRegistry.registerTileEntity(TileEntitySmelter.class, "30");
- GameRegistry.registerTileEntity(TileEntityMolder.class, "31");
- GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, "32");
- GameRegistry.registerTileEntity(TileEntityDisplayer.class, "33");
- GameRegistry.registerTileEntity(TileEntityBlockShadow.class, "34");
- GameRegistry.registerTileEntity(TileEntityAltar.class, "35");
-
- isInitialized = true;
- }
- }
+ public static Block shadowOre;
+ public static Block glow;
+ public static Block smelter;
+ public static Block molder;
+ public static Block displayer;
+ public static Block jewelCraftingTable;
+ public static Block shadowBlock;
+ public static Block jewelAltar;
+ public static BlockMoltenMetal moltenMetal;
+ public static Fluid moltenMetalFluid;
+
+ private static boolean isInitialized = false;
+
+ public static void preInit(FMLPreInitializationEvent e)
+ {
+ if (!isInitialized)
+ {
+ shadowOre = new BlockJCOre().setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypeStone).setBlockTextureName("jewelrycraft:oreShadow").setBlockName("Jewelrycraft.oreShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ glow = new BlockGlow().setBlockName("Jewelrycraft.glow").setLightLevel(1F);
+ smelter = new BlockSmelter(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypeStone).setBlockName("Jewelrycraft.smelter").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ molder = new BlockMolder(Material.rock).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundTypeStone).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);
+ jewelCraftingTable = new BlockJewelrsCraftingTable(Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundTypeStone).setBlockName("Jewelrycraft.jewelCraftingTable").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ shadowBlock = new BlockShadow().setHardness(5.0F).setResistance(7.0F).setStepSound(Block.soundTypeMetal).setBlockTextureName("jewelrycraft:blockShadow").setBlockName("Jewelrycraft.blockShadow").setCreativeTab(JewelrycraftMod.jewelrycraft);
+ jewelAltar = new BlockJewelAltar().setHardness(5.0F).setResistance(2.0F).setStepSound(Block.soundTypeMetal).setBlockTextureName("jewelrycraft:altar").setBlockName("Jewelrycraft.altar").setCreativeTab(JewelrycraftMod.jewelrycraft);
+
+ GameRegistry.registerBlock(shadowOre, "shadowOre");
+ GameRegistry.registerBlock(shadowBlock, "shadowBlock");
+ GameRegistry.registerBlock(smelter, "Smelter");
+ GameRegistry.registerBlock(molder, "Molder");
+ GameRegistry.registerBlock(jewelCraftingTable, "jewelCraftingTable");
+ GameRegistry.registerBlock(displayer, "Displayer");
+ GameRegistry.registerBlock(jewelAltar, "Altar");
+
+ GameRegistry.registerTileEntity(TileEntitySmelter.class, "30");
+ GameRegistry.registerTileEntity(TileEntityMolder.class, "31");
+ GameRegistry.registerTileEntity(TileEntityJewelrsCraftingTable.class, "32");
+ GameRegistry.registerTileEntity(TileEntityDisplayer.class, "33");
+ GameRegistry.registerTileEntity(TileEntityBlockShadow.class, "34");
+ GameRegistry.registerTileEntity(TileEntityAltar.class, "35");
+
+ 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/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockMolder.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockMolder.java
index bde50b5..1ed58d7 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockMolder.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockMolder.java
@@ -57,6 +57,7 @@ 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)
@@ -65,6 +66,7 @@ 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")));
}
@@ -88,7 +90,7 @@ public class BlockMolder extends BlockContainer
{
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());
- world.markBlockForUpdate(i, j, k);
+ world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, par5, par6);
@@ -115,11 +117,12 @@ public class BlockMolder extends BlockContainer
}
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.equals(ItemList.molds) && !me.hasMoltenMetal)
+ else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal)
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldisempty")));
- else if (!me.mold.equals(ItemList.molds))
+ else if (me.mold.getItem() != ItemList.molds)
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldismissing")));
me.isDirty = true;
+ me.markDirty();
}
}
@@ -141,7 +144,7 @@ public class BlockMolder extends BlockContainer
return -1;
}
- public void registerIcons(IIconRegister icon)
+ public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("jewelrycraft:molder");
}
diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockMoltenMetal.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockMoltenMetal.java
new file mode 100644
index 0000000..9adbf59
--- /dev/null
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockMoltenMetal.java
@@ -0,0 +1,117 @@
+package darkknight.jewelrycraft.block;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+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.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;
+import net.minecraftforge.fluids.Fluid;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+public class BlockMoltenMetal extends BlockFluidClassic {
+
+ @SideOnly(Side.CLIENT)
+ protected IIcon stillIcon;
+ @SideOnly(Side.CLIENT)
+ protected IIcon flowingIcon;
+
+ public BlockMoltenMetal(Fluid fluid, Material material) {
+ super(fluid, material);
+ setBlockName("Jewelrycraft.moltenMetal");
+ this.setQuantaPerBlock(100);
+ }
+
+ @Override
+ public IIcon getIcon(int side, int meta) {
+ return (side == 0 || side == 1)? stillIcon : flowingIcon;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister register) {
+ stillIcon = register.registerIcon("jewelrycraft:moltenMetalStill");
+ flowingIcon = register.registerIcon("jewelrycraft:moltenMetalFlow");
+ }
+
+ @Override
+ public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
+ if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
+ return super.canDisplace(world, x, y, z);
+ }
+
+ @Override
+ public boolean displaceIfPossible(World world, int x, int y, int z) {
+ if (world.getBlock(x, y, z).getMaterial().isLiquid()) return false;
+ return super.displaceIfPossible(world, x, y, z);
+ }
+
+ @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();
+// }
+ return 0;
+ }
+
+ public static int color(IBlockAccess world, int i, int j, int k) 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))));
+ int x=0, y=0, ok = 0, red, green, blue;
+ if (JewelryNBT.ingot(item) != null && JewelryNBT.ingot(item).getIconIndex() != null && JewelryNBT.ingotColor(item) == 16777215)
+ {
+ String ingotIconName = JewelryNBT.ingot(item).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(item).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(item, icon.getRGB(x, y));
+ }
+ if(JewelryNBT.ingot(item) != null) return JewelryNBT.ingotColor(item);
+ return 16777215;
+ }
+}
diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java
index 77b2051..acce92f 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java
@@ -1,5 +1,7 @@
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;
@@ -17,6 +19,7 @@ import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow;
public class BlockShadow extends BlockContainer
{
private IIcon[] iconArray;
+ private static final String __OBFID = "CL_00000312";
public BlockShadow()
{
@@ -60,7 +63,7 @@ public class BlockShadow extends BlockContainer
return new TileEntityBlockShadow();
}
- public void registerIcons(IIconRegister par1IconRegister)
+ public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.iconArray = new IIcon[16];
@@ -87,11 +90,6 @@ public class BlockShadow extends BlockContainer
if (this == BlockList.shadowBlock)
{
- if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]))
- {
- return true;
- }
-
if (block == this)
{
return false;
@@ -110,4 +108,10 @@ public class BlockShadow extends BlockContainer
{
return world.getBlockMetadata(x, y, z);
}
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int side, int meta)
+ {
+ return this.iconArray[meta];
+ }
}
diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockSmelter.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockSmelter.java
index 95c2697..176a6f2 100644
--- a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockSmelter.java
+++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockSmelter.java
@@ -57,7 +57,7 @@ public class BlockSmelter extends BlockContainer
TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
if (te != null && te.hasMetal){
dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy());
- world.markBlockForUpdate(i, j, k);
+ world.removeTileEntity(i, j, k);
}
super.breakBlock(world, i, j, k, par5, par6);
}
@@ -80,6 +80,7 @@ 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())));
@@ -95,6 +96,8 @@ 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);
}
@@ -126,7 +129,8 @@ public class BlockSmelter extends BlockContainer
me.cooling = ConfigHandler.ingotCoolingTime;
te.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
te.hasMoltenMetal = false;
- me.isDirty = true;
+ te.isDirty = true;
+ te.markDirty();
world.markBlockForUpdate(i, j, k);
world.setTileEntity(i, j, k, te);
}
@@ -185,7 +189,7 @@ public class BlockSmelter extends BlockContainer
return -1;
}
- public void registerIcons(IIconRegister icon)
+ public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("jewelrycraft:smelter");
}