From 2f93a3de229a3351d91708cf60fbc9ab7a1be97f Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Thu, 11 Jun 2015 19:59:48 +0100 Subject: Improved color detection system by 10000000%! (not rly, but it's better than b4) --- .../jewelrycraft/worldGen/WorldGenStructure2.java | 23 ++++++---------------- .../jewelrycraft/worldGen/WorldGenStructure5.java | 22 +++++---------------- 2 files changed, 11 insertions(+), 34 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/worldGen') diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java index b7662bb..5f094e4 100644 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure2.java @@ -45,23 +45,12 @@ public class WorldGenStructure2 extends WorldGenerator { world.setBlock(x, y, z, Blocks.air); ItemStack stack = new ItemStack(ItemList.bucket); JewelryNBT.addMetal(stack, JewelrycraftUtil.metal.get(rand.nextInt(JewelrycraftUtil.metal.size()))); - try { - if (stack != null && JewelryNBT.ingot(stack) != null) { - if (!world.isRemote) world.func_147480_a(x, y, z, true); - if (world.isRemote) { - int color = ItemMoltenMetalBucket.color(stack, 1); - JewelrycraftMod.saveData.setString(x + " " + y + " " + z + " " + world.provider.dimensionId, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) + ":" + JewelryNBT.ingot(stack).getItemDamage() + ":" + color); - JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, x, y, z, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()), JewelryNBT.ingot(stack).getItemDamage(), color)); - } - else{ - JewelrycraftMod.saveData.setString(x + " " + y + " " + z + " " + world.provider.dimensionId, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) + ":" + JewelryNBT.ingot(stack).getItemDamage() + ":" + rand.nextInt(16777216)); - JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, x, y, z, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()), JewelryNBT.ingot(stack).getItemDamage(), rand.nextInt(16777216))); - } - System.out.println(x + " " + y + " " + z); - world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3); - } - } catch (IOException e) { - e.printStackTrace(); + if (stack != null && JewelryNBT.ingot(stack) != null) { + if (!world.isRemote) world.func_147480_a(x, y, z, true); + JewelrycraftMod.saveData.setString(x + " " + y + " " + z + " " + world.provider.dimensionId, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) + ":" + JewelryNBT.ingot(stack).getItemDamage()); + JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, x, y, z, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()), JewelryNBT.ingot(stack).getItemDamage())); + System.out.println(x + " " + y + " " + z); + world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3); } return true; } diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java index 5518ef4..77ce6c1 100644 --- a/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java +++ b/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java @@ -76,23 +76,11 @@ public class WorldGenStructure5 extends WorldGenerator { if (rand.nextInt(5) == 0) { ItemStack stack = new ItemStack(ItemList.bucket); JewelryNBT.addMetal(stack, new ItemStack(Items.gold_ingot)); - try { - if (stack != null && JewelryNBT.ingot(stack) != null) { - if (!world.isRemote) world.func_147480_a(x, y, z, true); - if (world.isRemote) { - int color = ItemMoltenMetalBucket.color(stack, 1); - JewelrycraftMod.saveData.setString((x + 1) + " " + (y + 2) + " " + (z - 2) + " " + world.provider.dimensionId, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) + ":" + JewelryNBT.ingot(stack).getItemDamage() + ":" + color); - JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, x + 1, y + 2, z - 2, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()), JewelryNBT.ingot(stack).getItemDamage(), color)); - JewelrycraftMod.netWrapper.sendToServer(new PacketRequestLiquidData(Minecraft.getMinecraft().theWorld.provider.dimensionId, x + 1, y + 2, z - 2)); - } - else{ - JewelrycraftMod.saveData.setString(x + " " + y + " " + z + " " + world.provider.dimensionId, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) + ":" + JewelryNBT.ingot(stack).getItemDamage() + ":" + rand.nextInt(16777216)); - JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, x, y, z, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()), JewelryNBT.ingot(stack).getItemDamage(), rand.nextInt(16777216))); - } - world.setBlock(x + 1, y + 2, z - 2, BlockList.moltenMetal, 0, 3); - } - } catch (IOException e) { - e.printStackTrace(); + if (stack != null && JewelryNBT.ingot(stack) != null) { + if (!world.isRemote) world.func_147480_a(x, y, z, true); + JewelrycraftMod.saveData.setString((x + 1) + " " + (y + 2) + " " + (z - 2) + " " + world.provider.dimensionId, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) + ":" + JewelryNBT.ingot(stack).getItemDamage()); + JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, x + 1, y + 2, z - 2, Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()), JewelryNBT.ingot(stack).getItemDamage())); + world.setBlock(x + 1, y + 2, z - 2, BlockList.moltenMetal, 0, 3); } } else if (rand.nextBoolean()) world.setBlock(x + 1, y + 2, z - 2, Blocks.lava, 0, 3); else world.setBlock(x + 1, y + 2, z - 2, Blocks.water, 0, 3); -- cgit v1.2.3