summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-09-17 19:10:05 +0300
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2014-09-17 19:10:05 +0300
commit06f62473f0622efe6decc32b70516a7c5d3d3572 (patch)
treeebf54c96117f9917cd93740a89763c26abde06af
parent852cfd0e13631320624d528213ec8c80cffe8743 (diff)
1.7.10
-rw-r--r--.gitignore25
-rw-r--r--build.gradle47
-rw-r--r--eclipse/screenshots/2014-04-15_16.25.39.pngbin59772 -> 0 bytes
-rw-r--r--gradlew164
-rw-r--r--java/darkknight/jewelrycraft/CommonProxy.java (renamed from src/main/java/darkknight/jewelrycraft/CommonProxy.java)8
-rw-r--r--java/darkknight/jewelrycraft/CreativeTabLiquids.java38
-rw-r--r--java/darkknight/jewelrycraft/CreativeTabNecklaces.java39
-rw-r--r--java/darkknight/jewelrycraft/CreativeTabRings.java (renamed from src/main/java/darkknight/jewelrycraft/CreativeTabRings.java)21
-rw-r--r--java/darkknight/jewelrycraft/JewelrycraftMod.java (renamed from src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java)47
-rw-r--r--java/darkknight/jewelrycraft/block/BlockDisplayer.java (renamed from src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java)50
-rw-r--r--java/darkknight/jewelrycraft/block/BlockGlow.java (renamed from src/main/java/darkknight/jewelrycraft/block/BlockGlow.java)10
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJCOre.java (renamed from src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java)0
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJewelAltar.java (renamed from src/main/java/darkknight/jewelrycraft/block/BlockJewelAltar.java)22
-rw-r--r--java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java (renamed from src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java)47
-rw-r--r--java/darkknight/jewelrycraft/block/BlockList.java68
-rw-r--r--java/darkknight/jewelrycraft/block/BlockMolder.java (renamed from src/main/java/darkknight/jewelrycraft/block/BlockMolder.java)47
-rw-r--r--java/darkknight/jewelrycraft/block/BlockMoltenMetal.java310
-rw-r--r--java/darkknight/jewelrycraft/block/BlockShadow.java (renamed from src/main/java/darkknight/jewelrycraft/block/BlockShadow.java)21
-rw-r--r--java/darkknight/jewelrycraft/block/BlockSmelter.java239
-rw-r--r--java/darkknight/jewelrycraft/client/ClientProxy.java (renamed from src/main/java/darkknight/jewelrycraft/client/ClientProxy.java)0
-rw-r--r--java/darkknight/jewelrycraft/client/GuiGuide.java (renamed from src/main/java/darkknight/jewelrycraft/client/GuiGuide.java)151
-rw-r--r--java/darkknight/jewelrycraft/client/GuiRingChest.java (renamed from src/main/java/darkknight/jewelrycraft/client/GuiRingChest.java)0
-rw-r--r--java/darkknight/jewelrycraft/config/ConfigHandler.java (renamed from src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java)4
-rw-r--r--java/darkknight/jewelrycraft/container/ContainerGuide.java (renamed from src/main/java/darkknight/jewelrycraft/container/ContainerGuide.java)13
-rw-r--r--java/darkknight/jewelrycraft/container/ContainerRingChest.java (renamed from src/main/java/darkknight/jewelrycraft/container/ContainerRingChest.java)27
-rw-r--r--java/darkknight/jewelrycraft/container/GuiHandler.java (renamed from src/main/java/darkknight/jewelrycraft/container/GuiHandler.java)30
-rw-r--r--java/darkknight/jewelrycraft/container/GuiRectangle.java (renamed from src/main/java/darkknight/jewelrycraft/container/GuiRectangle.java)25
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTab.java (renamed from src/main/java/darkknight/jewelrycraft/container/GuiTab.java)28
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabBlocks.java (renamed from src/main/java/darkknight/jewelrycraft/container/GuiTabBlocks.java)76
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabItems.java (renamed from src/main/java/darkknight/jewelrycraft/container/GuiTabItems.java)85
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java70
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabNecklaces.java (renamed from src/main/java/darkknight/jewelrycraft/container/GuiTabNecklaces.java)194
-rw-r--r--java/darkknight/jewelrycraft/container/GuiTabRings.java (renamed from src/main/java/darkknight/jewelrycraft/container/GuiTabRings.java)282
-rw-r--r--java/darkknight/jewelrycraft/container/Page.java (renamed from src/main/java/darkknight/jewelrycraft/container/Page.java)127
-rw-r--r--java/darkknight/jewelrycraft/container/SlotRingChest.java (renamed from src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java)5
-rw-r--r--java/darkknight/jewelrycraft/events/BucketHandler.java83
-rw-r--r--java/darkknight/jewelrycraft/events/EntityEventHandler.java118
-rw-r--r--java/darkknight/jewelrycraft/item/ItemClayMolds.java (renamed from src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java)11
-rw-r--r--java/darkknight/jewelrycraft/item/ItemCrystal.java (renamed from src/main/java/darkknight/jewelrycraft/item/ItemCrystal.java)20
-rw-r--r--java/darkknight/jewelrycraft/item/ItemGuide.java (renamed from src/main/java/darkknight/jewelrycraft/item/ItemGuide.java)10
-rw-r--r--java/darkknight/jewelrycraft/item/ItemList.java (renamed from src/main/java/darkknight/jewelrycraft/item/ItemList.java)17
-rw-r--r--java/darkknight/jewelrycraft/item/ItemMolds.java (renamed from src/main/java/darkknight/jewelrycraft/item/ItemMolds.java)23
-rw-r--r--java/darkknight/jewelrycraft/item/ItemMoltenMetal.java101
-rw-r--r--java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java290
-rw-r--r--java/darkknight/jewelrycraft/item/ItemMultiIngot.java46
-rw-r--r--java/darkknight/jewelrycraft/item/ItemNecklace.java (renamed from src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java)211
-rw-r--r--java/darkknight/jewelrycraft/item/ItemRing.java (renamed from src/main/java/darkknight/jewelrycraft/item/ItemRing.java)400
-rw-r--r--java/darkknight/jewelrycraft/item/ItemThiefGloves.java (renamed from src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java)19
-rw-r--r--java/darkknight/jewelrycraft/lib/Reference.java9
-rw-r--r--java/darkknight/jewelrycraft/model/ModelDisplayer.java (renamed from src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java)14
-rw-r--r--java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java140
-rw-r--r--java/darkknight/jewelrycraft/model/ModelMolder.java (renamed from src/main/java/darkknight/jewelrycraft/model/ModelMolder.java)2
-rw-r--r--java/darkknight/jewelrycraft/model/ModelSmelter.java (renamed from src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java)2
-rw-r--r--java/darkknight/jewelrycraft/network/PacketClearColorCache.java32
-rw-r--r--java/darkknight/jewelrycraft/network/PacketHandler.java6
-rw-r--r--java/darkknight/jewelrycraft/network/PacketRequestLiquidData.java73
-rw-r--r--java/darkknight/jewelrycraft/network/PacketSendLiquidData.java72
-rw-r--r--java/darkknight/jewelrycraft/recipes/CraftingRecipes.java (renamed from src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java)28
-rw-r--r--java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java (renamed from src/main/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java)95
-rw-r--r--java/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java (renamed from src/main/java/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java)54
-rw-r--r--java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java (renamed from src/main/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java)38
-rw-r--r--java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java (renamed from src/main/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java)73
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java (renamed from src/main/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java)87
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java (renamed from src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java)34
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java (renamed from src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java)44
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java (renamed from src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java)35
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java (renamed from src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java)31
-rw-r--r--java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java185
-rw-r--r--java/darkknight/jewelrycraft/util/BlockUtils.java (renamed from src/main/java/darkknight/jewelrycraft/util/BlockUtils.java)88
-rw-r--r--java/darkknight/jewelrycraft/util/JewelryNBT.java (renamed from src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java)226
-rw-r--r--java/darkknight/jewelrycraft/util/JewelrycraftUtil.java (renamed from src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java)93
-rw-r--r--java/darkknight/jewelrycraft/util/PlayerUtils.java (renamed from src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java)40
-rw-r--r--java/darkknight/jewelrycraft/worldGen/Generation.java (renamed from src/main/java/darkknight/jewelrycraft/worldGen/Generation.java)10
-rw-r--r--java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java (renamed from src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java)284
-rw-r--r--java/darkknight/jewelrycraft/worldGen/village/JCTrades.java (renamed from src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java)77
-rw-r--r--java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java (renamed from src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java)10
-rw-r--r--resources/assets/jewelrycraft/Changelog.txt (renamed from src/main/resources/assets/jewelrycraft/Changelog.txt)34
-rw-r--r--resources/assets/jewelrycraft/lang/en_US.lang (renamed from src/main/resources/assets/jewelrycraft/lang/en_US.lang)7
-rw-r--r--resources/assets/jewelrycraft/pack.mcmeta (renamed from src/main/resources/assets/jewelrycraft/pack.mcmeta)0
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/altar_bottom.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/altar_bottom.png)bin391 -> 391 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/altar_side.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/altar_side.png)bin3220 -> 3220 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/altar_top.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/altar_top.png)bin3125 -> 3125 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow0.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow0.png)bin177 -> 177 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow1.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow1.png)bin315 -> 315 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow10.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow10.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow11.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow11.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow12.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow12.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow13.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow13.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow14.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow14.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow15.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow15.png)bin288 -> 288 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow2.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow2.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow3.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow3.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow4.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow4.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow5.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow5.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow6.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow6.png)bin312 -> 312 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow7.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow7.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow8.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow8.png)bin315 -> 315 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/blockShadow9.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow9.png)bin316 -> 316 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/displayer.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/displayer.png)bin3800 -> 3800 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/jewelrsCraftingTable.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/jewelrsCraftingTable.png)bin2064 -> 2064 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/molder.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/molder.png)bin1060 -> 1060 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png)bin10676 -> 10676 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png.mcmeta (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png.mcmeta)0
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png)bin9922 -> 9922 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png.mcmeta (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png.mcmeta)0
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/oreShadow.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/oreShadow.png)bin462 -> 462 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/blocks/smelter.png (renamed from src/main/resources/assets/jewelrycraft/textures/blocks/smelter.png)bin537 -> 537 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/entities/jeweler.png (renamed from src/main/resources/assets/jewelrycraft/textures/entities/jeweler.png)bin1265 -> 1265 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/gui/chest_ring.png (renamed from src/main/resources/assets/jewelrycraft/textures/gui/chest_ring.png)bin1993 -> 1993 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/gui/guidePage.png (renamed from src/main/resources/assets/jewelrycraft/textures/gui/guidePage.png)bin29547 -> 29547 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/gui/guidePageFlip.png (renamed from src/main/resources/assets/jewelrycraft/textures/gui/guidePageFlip.png)bin29469 -> 29469 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/bucketOverlay.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/bucketOverlay.png)bin293 -> 293 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/clayIngotMold.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/clayIngotMold.png)bin493 -> 493 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/clayNecklaceMold.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/clayNecklaceMold.png)bin584 -> 584 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/clayRingMold.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/clayRingMold.png)bin606 -> 606 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/crystal.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/crystal.png)bin285 -> 285 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/crystalOverlay.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/crystalOverlay.png)bin274 -> 274 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/guide.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/guide.png)bin350 -> 350 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/ingot3.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/ingot3.png)bin315 -> 315 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/ingot4.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/ingot4.png)bin308 -> 308 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/ingot6.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/ingot6.png)bin314 -> 314 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/ingot7.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/ingot7.png)bin307 -> 307 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/ingotMold.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/ingotMold.png)bin500 -> 500 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/ingotShadow.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/ingotShadow.png)bin467 -> 467 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/jewelNecklace.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/jewelNecklace.png)bin241 -> 241 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/jewelRing.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/jewelRing.png)bin244 -> 244 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/moltenMetalStill.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png)bin9922 -> 9922 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta (renamed from src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta)0
-rw-r--r--resources/assets/jewelrycraft/textures/items/necklace.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/necklace.png)bin284 -> 284 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/necklaceMold.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/necklaceMold.png)bin551 -> 551 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/ring.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/ring.png)bin272 -> 272 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/ringMold.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/ringMold.png)bin580 -> 580 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/test/ingot2.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/test/ingot2.png)bin313 -> 313 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/test/ingot5.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/test/ingot5.png)bin301 -> 301 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/items/thiefGloves.png (renamed from src/main/resources/assets/jewelrycraft/textures/items/thiefGloves.png)bin290 -> 290 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/tileentities/Displayer.png (renamed from src/main/resources/assets/jewelrycraft/textures/tileentities/Displayer.png)bin1232 -> 1232 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/tileentities/JewelrsCraftingBench.png (renamed from src/main/resources/assets/jewelrycraft/textures/tileentities/JewelrsCraftingBench.png)bin2005 -> 2005 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/tileentities/Molder.png (renamed from src/main/resources/assets/jewelrycraft/textures/tileentities/Molder.png)bin1020 -> 1020 bytes
-rw-r--r--resources/assets/jewelrycraft/textures/tileentities/Smelter.png (renamed from src/main/resources/assets/jewelrycraft/textures/tileentities/Smelter.png)bin886 -> 886 bytes
-rw-r--r--resources/mcmod.info16
-rw-r--r--src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java52
-rw-r--r--src/main/java/darkknight/jewelrycraft/CreativeTabNecklaces.java54
-rw-r--r--src/main/java/darkknight/jewelrycraft/block/BlockList.java68
-rw-r--r--src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java275
-rw-r--r--src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java189
-rw-r--r--src/main/java/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java87
-rw-r--r--src/main/java/darkknight/jewelrycraft/events/BucketHandler.java60
-rw-r--r--src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java100
-rw-r--r--src/main/java/darkknight/jewelrycraft/events/EventHandler.java65
-rw-r--r--src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java128
-rw-r--r--src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java309
-rw-r--r--src/main/java/darkknight/jewelrycraft/lib/Reference.java9
-rw-r--r--src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java140
-rw-r--r--src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java159
154 files changed, 3735 insertions, 3568 deletions
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index a7f49dc..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-*.class
-
-# Package Files #
-*.jar
-*.war
-*.ear
-
-includeCP/fmlbranding.properties
-eclipse/*
-eclipse - Copy/*
-build/*
-bin/*
-.gradle/*
-.settings/*
-.project
-.classpath
-*-fml.txt
-MinecraftForge-*.txt
-forge-*-changelog.txt
-gradle-app.setting
-*.iml
-*.ipr
-*.iws
-gradlew.*
-gradle/* \ No newline at end of file
diff --git a/build.gradle b/build.gradle
deleted file mode 100644
index 1f99a71..0000000
--- a/build.gradle
+++ /dev/null
@@ -1,47 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- maven {
- name = "forge"
- url = "http://files.minecraftforge.net/maven"
- }
- maven {
- name = "sonatype"
- url = "https://oss.sonatype.org/content/repositories/snapshots/"
- }
- }
- dependencies {
- classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
- }
-}
-
-apply plugin: 'forge'
-
-version = "1.4.4"
-group= "darknight.jewelrycraft" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
-archivesBaseName = "jewelrycraft"
-
-minecraft {
- version = "1.7.2-10.12.0.1057"
- assetDir = "eclipse/assets"
-}
-
-processResources
-{
- // this will ensure that this task is redone when the versions change.
- inputs.property "version", project.version
- inputs.property "mcversion", project.minecraft.version
-
- // replace stuff in mcmod.info, nothing else
- from(sourceSets.main.resources.srcDirs) {
- include 'mcmod.info'
-
- // replace version and mcversion
- expand 'version':project.version, 'mcversion':project.minecraft.version
- }
-
- // copy everything else, thats not the mcmod.info
- from(sourceSets.main.resources.srcDirs) {
- exclude 'mcmod.info'
- }
-}
diff --git a/eclipse/screenshots/2014-04-15_16.25.39.png b/eclipse/screenshots/2014-04-15_16.25.39.png
deleted file mode 100644
index 549411e..0000000
--- a/eclipse/screenshots/2014-04-15_16.25.39.png
+++ /dev/null
Binary files differ
diff --git a/gradlew b/gradlew
deleted file mode 100644
index 91a7e26..0000000
--- a/gradlew
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/src/main/java/darkknight/jewelrycraft/CommonProxy.java b/java/darkknight/jewelrycraft/CommonProxy.java
index 354f3a9..8ce261b 100644
--- a/src/main/java/darkknight/jewelrycraft/CommonProxy.java
+++ b/java/darkknight/jewelrycraft/CommonProxy.java
@@ -2,8 +2,8 @@ package darkknight.jewelrycraft;
public class CommonProxy
{
- public void registerRenderers()
- {
-
- }
+ public void registerRenderers()
+ {
+
+ }
}
diff --git a/java/darkknight/jewelrycraft/CreativeTabLiquids.java b/java/darkknight/jewelrycraft/CreativeTabLiquids.java
new file mode 100644
index 0000000..b1f56dd
--- /dev/null
+++ b/java/darkknight/jewelrycraft/CreativeTabLiquids.java
@@ -0,0 +1,38 @@
+package darkknight.jewelrycraft;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class CreativeTabLiquids extends CreativeTabs
+{
+ public CreativeTabLiquids(String par2Str)
+ {
+ super(par2Str);
+ }
+
+ @Override
+ public Item getTabIconItem()
+ {
+ return ItemList.bucket;
+ }
+
+ @SuppressWarnings(
+ { "rawtypes", "unchecked" })
+ public void displayAllReleventItems(List par1List)
+ {
+ for (int i = 0; i < JewelrycraftUtil.metal.size(); i++)
+ par1List.add(ItemList.bucket.getModifiedItemStack(JewelrycraftUtil.metal.get(i)));
+ }
+
+}
diff --git a/java/darkknight/jewelrycraft/CreativeTabNecklaces.java b/java/darkknight/jewelrycraft/CreativeTabNecklaces.java
new file mode 100644
index 0000000..77e8844
--- /dev/null
+++ b/java/darkknight/jewelrycraft/CreativeTabNecklaces.java
@@ -0,0 +1,39 @@
+package darkknight.jewelrycraft;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class CreativeTabNecklaces extends CreativeTabs
+{
+ public CreativeTabNecklaces(String par2Str)
+ {
+ super(par2Str);
+ }
+
+ @Override
+ public Item getTabIconItem()
+ {
+ return ItemList.necklace;
+ }
+
+ @SuppressWarnings(
+ { "rawtypes", "unchecked" })
+ public void displayAllReleventItems(List par1List)
+ {
+ for (int i = 0; i < JewelrycraftUtil.metal.size(); i++)
+ for (int j = 0; j < JewelrycraftUtil.modifiers.size(); j++)
+ for (int k = 0; k < JewelrycraftUtil.jewel.size(); k++)
+ par1List.add(ItemList.necklace.getModifiedItemStack(JewelrycraftUtil.metal.get(i).copy(), JewelrycraftUtil.modifiers.get(j).copy(), JewelrycraftUtil.jewel.get(k).copy()));
+ }
+
+}
diff --git a/src/main/java/darkknight/jewelrycraft/CreativeTabRings.java b/java/darkknight/jewelrycraft/CreativeTabRings.java
index 5cbe496..21b432e 100644
--- a/src/main/java/darkknight/jewelrycraft/CreativeTabRings.java
+++ b/java/darkknight/jewelrycraft/CreativeTabRings.java
@@ -14,13 +14,9 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class CreativeTabRings extends CreativeTabs
{
- public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
-
public CreativeTabRings(String par2Str)
{
super(par2Str);
- metal.add(new ItemStack(Items.gold_ingot));
- metal.add(new ItemStack(Items.iron_ingot));
}
@Override
@@ -33,23 +29,10 @@ public class CreativeTabRings extends CreativeTabs
{ "rawtypes", "unchecked" })
public void displayAllReleventItems(List par1List)
{
- int index = 0, index2 = 0;
- while (index < OreDictionary.getOreNames().length)
- {
- Iterator<ItemStack> i = OreDictionary.getOres(OreDictionary.getOreNames()[index]).iterator();
-
- while (i.hasNext())
- {
- ItemStack nextStack = i.next();
-
- if ((nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || nextStack.getItem().getUnlocalizedName().toLowerCase().contains("alloy")) && !metal.contains(nextStack)) metal.add(nextStack);
- }
- index++;
- }
- for (int i = 0; i < metal.size(); i++)
+ for (int i = 0; i < JewelrycraftUtil.metal.size(); i++)
for (int j = 0; j < JewelrycraftUtil.modifiers.size(); j++)
for (int k = 0; k < JewelrycraftUtil.jewel.size(); k++)
- par1List.add(ItemList.ring.getModifiedItemStack(metal.get(i), JewelrycraftUtil.modifiers.get(j), JewelrycraftUtil.jewel.get(k)));
+ par1List.add(ItemList.ring.getModifiedItemStack(JewelrycraftUtil.metal.get(i).copy(), JewelrycraftUtil.modifiers.get(j).copy(), JewelrycraftUtil.jewel.get(k).copy()));
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java b/java/darkknight/jewelrycraft/JewelrycraftMod.java
index 3ead767..cabc36f 100644
--- a/src/main/java/darkknight/jewelrycraft/JewelrycraftMod.java
+++ b/java/darkknight/jewelrycraft/JewelrycraftMod.java
@@ -33,8 +33,11 @@ import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.network.NetworkRegistry;
+import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.VillagerRegistry;
+import cpw.mods.fml.relauncher.Side;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.config.ConfigHandler;
import darkknight.jewelrycraft.container.GuiHandler;
@@ -42,6 +45,9 @@ import darkknight.jewelrycraft.events.BucketHandler;
import darkknight.jewelrycraft.events.EntityEventHandler;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.lib.Reference;
+import darkknight.jewelrycraft.network.PacketClearColorCache;
+import darkknight.jewelrycraft.network.PacketRequestLiquidData;
+import darkknight.jewelrycraft.network.PacketSendLiquidData;
import darkknight.jewelrycraft.recipes.CraftingRecipes;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import darkknight.jewelrycraft.worldGen.Generation;
@@ -54,17 +60,17 @@ public class JewelrycraftMod
{
@Instance(Reference.MODID)
public static JewelrycraftMod instance;
-
+
@Metadata(Reference.MODID)
public static ModMetadata metadata;
-
+
@SidedProxy(clientSide = "darkknight.jewelrycraft.client.ClientProxy", serverSide = "darkknight.jewelrycraft.CommonProxy")
public static CommonProxy proxy;
public static final Logger logger = Logger.getLogger("Jewelrycraft");
public static File dir;
- //TODO Look at how you did in ChowTime for files
-
+ // TODO Look at how you did in ChowTime for files
+
public static CreativeTabs jewelrycraft = new CreativeTabs("JewelryCraft")
{
@Override
@@ -76,9 +82,12 @@ 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 NBTTagCompound saveData = new NBTTagCompound();
- public static File liquidsConf;
-
+ public static NBTTagCompound saveData = new NBTTagCompound();
+ public static NBTTagCompound clientData = new NBTTagCompound();
+ public static File liquidsConf;
+
+ public static SimpleNetworkWrapper netWrapper;
+
@EventHandler
public void preInit(FMLPreInitializationEvent e) throws IOException
{
@@ -87,12 +96,6 @@ public class JewelrycraftMod
ItemList.preInit(e);
CraftingRecipes.preInit(e);
OreDictionary.registerOre("ingotShadow", new ItemStack(ItemList.shadowIngot));
- OreDictionary.registerOre("ingot2", new ItemStack(ItemList.ingot2));
- OreDictionary.registerOre("ingot3", new ItemStack(ItemList.ingot3));
- OreDictionary.registerOre("ingot4", new ItemStack(ItemList.ingot4));
- OreDictionary.registerOre("ingot5", new ItemStack(ItemList.ingot5));
- OreDictionary.registerOre("ingot6", new ItemStack(ItemList.ingot6));
- OreDictionary.registerOre("ingot7", new ItemStack(ItemList.ingot7));
OreDictionary.registerOre("oreShadow", new ItemStack(BlockList.shadowOre));
VillagerRegistry.instance().registerVillagerId(3000);
@@ -106,33 +109,39 @@ public class JewelrycraftMod
{
logger.severe("Error registering Jewelrycraft Structures with Vanilla Minecraft: this is expected in versions earlier than 1.7.2");
}
- MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
+ MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
BucketHandler.INSTANCE.buckets.put(BlockList.moltenMetal, ItemList.bucket);
proxy.registerRenderers();
ModMetadata metadata = e.getModMetadata();
-
+
List<String> authorList = new ArrayList<String>();
authorList.add("DarkKnight (or sor1n)");
authorList.add("bspkrs");
dir = e.getModConfigurationDirectory();
-
+
+ netWrapper = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
+
+ netWrapper.registerMessage(PacketRequestLiquidData.class, PacketRequestLiquidData.class, 0, Side.SERVER);
+ netWrapper.registerMessage(PacketSendLiquidData.class, PacketSendLiquidData.class, 1, Side.CLIENT);
+ netWrapper.registerMessage(PacketClearColorCache.class, PacketClearColorCache.class, 2, Side.CLIENT);
+
metadata.autogenerated = false;
metadata.authorList = authorList;
metadata.url = "https://github.com/sor1n/Modjam-Mod";
}
-
+
@EventHandler
public void init(FMLInitializationEvent e)
{
GameRegistry.registerWorldGenerator(new Generation(), 0);
new GuiHandler();
}
-
+
@EventHandler
public void postInit(FMLPostInitializationEvent e)
- {
+ {
JewelrycraftUtil.addMetals();
JewelrycraftUtil.addStuff();
JewelrycraftUtil.jamcrafters();
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java b/java/darkknight/jewelrycraft/block/BlockDisplayer.java
index efdddff..333cc94 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockDisplayer.java
+++ b/java/darkknight/jewelrycraft/block/BlockDisplayer.java
@@ -20,42 +20,42 @@ import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
public class BlockDisplayer extends BlockContainer
{
Random rand = new Random();
-
+
protected BlockDisplayer(Material par2Material)
{
super(par2Material);
}
-
+
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityDisplayer();
}
-
+
@Override
public boolean renderAsNormalBlock()
{
return false;
}
-
+
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
-
+
@Override
public boolean isOpaqueCube()
{
return false;
}
-
+
@Override
public int getRenderType()
{
return -1;
}
-
+
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
@@ -63,7 +63,7 @@ public class BlockDisplayer extends BlockContainer
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null && item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && !world.isRemote)
{
- if(!te.hasObject)
+ if (!te.hasObject)
{
te.object = item.copy();
te.object.stackSize = 1;
@@ -73,9 +73,9 @@ public class BlockDisplayer extends BlockContainer
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())
+ else if (te.object.getItem() == item.getItem() && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.object.getItemDamage() == item.getItemDamage())
{
- if(te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound()))
+ if (te.object.hasTagCompound() && item.hasTagCompound() && te.object.getTagCompound().equals(item.getTagCompound()))
{
te.quantity += item.stackSize;
te.object.stackSize = 1;
@@ -83,19 +83,19 @@ public class BlockDisplayer extends BlockContainer
te.isDirty = true;
te.markDirty();
}
- else if(!te.object.hasTagCompound() && !item.hasTagCompound())
+ 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.markDirty();
+ te.isDirty = true;
+ te.markDirty();
}
}
}
return true;
}
-
+
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
@@ -104,9 +104,9 @@ public class BlockDisplayer extends BlockContainer
{
if (te.hasObject && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && player.inventory.addItemStackToInventory(te.object))
{
- if(player.isSneaking())
+ if (player.isSneaking())
{
- if(te.quantity > te.object.getMaxStackSize())
+ if (te.quantity > te.object.getMaxStackSize())
{
te.object.stackSize = te.object.getMaxStackSize() - 1;
player.inventory.addItemStackToInventory(te.object);
@@ -126,7 +126,7 @@ public class BlockDisplayer extends BlockContainer
}
else
{
- if(te.quantity >= 2)
+ if (te.quantity >= 2)
{
player.inventory.addItemStackToInventory(te.object);
te.object.stackSize = 1;
@@ -142,11 +142,11 @@ public class BlockDisplayer extends BlockContainer
}
te.isDirty = true;
te.markDirty();
- }
+ }
}
}
}
-
+
public void dropItem(World world, double x, double y, double z, ItemStack stack)
{
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
@@ -155,28 +155,28 @@ public class BlockDisplayer extends BlockContainer
entityitem.motionY = 0.11000000298023224D;
world.spawnEntityInWorld(entityitem);
}
-
+
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
TileEntityDisplayer te = (TileEntityDisplayer) world.getTileEntity(i, j, k);
-
+
if (te != null && te.hasObject)
{
te.object.stackSize = te.quantity;
- dropItem(te.getWorldObj(), (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.object);
+ dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
world.removeTileEntity(i, j, k);
}
-
+
super.breakBlock(world, i, j, k, block, par6);
}
-
+
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
-
+
@Override
public void registerBlockIcons(IIconRegister icon)
{
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockGlow.java b/java/darkknight/jewelrycraft/block/BlockGlow.java
index f8a09d4..39f7b26 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockGlow.java
+++ b/java/darkknight/jewelrycraft/block/BlockGlow.java
@@ -11,27 +11,27 @@ public class BlockGlow extends Block
{
super(Material.air);
}
-
+
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i)
{
return null;
}
-
+
public boolean isCollidable()
{
return false;
}
-
+
public boolean isOpaqueCube()
{
return false;
}
-
+
public boolean renderAsNormalBlock()
{
return false;
}
-
+
public int getRenderType()
{
return -1;
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java b/java/darkknight/jewelrycraft/block/BlockJCOre.java
index e6bb31c..e6bb31c 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockJCOre.java
+++ b/java/darkknight/jewelrycraft/block/BlockJCOre.java
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJewelAltar.java b/java/darkknight/jewelrycraft/block/BlockJewelAltar.java
index cbf7fef..4e53832 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockJewelAltar.java
+++ b/java/darkknight/jewelrycraft/block/BlockJewelAltar.java
@@ -46,16 +46,16 @@ public class BlockJewelAltar extends BlockContainer
{
return par1 == 1 ? this.altarTop : (par1 == 0 ? this.altarBottom : this.altarSide);
}
-
+
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
TileEntityAltar te = (TileEntityAltar) world.getTileEntity(i, j, k);
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null && !world.isRemote)
- {
- if(item != null && item != new ItemStack(Item.getItemById(0), 0, 0) && (item.getItem() == ItemList.ring || item.getItem() == ItemList.necklace) && !te.hasObject)
- {
+ {
+ if (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();
@@ -64,7 +64,7 @@ public class BlockJewelAltar extends BlockContainer
te.hasObject = true;
}
- if(te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.hasObject && entityPlayer.isSneaking())
+ if (te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0) && te.hasObject && entityPlayer.isSneaking())
{
entityPlayer.inventory.addItemStackToInventory(te.object);
te.object = new ItemStack(Item.getItemById(0), 0, 0);
@@ -76,7 +76,7 @@ public class BlockJewelAltar extends BlockContainer
}
return true;
}
-
+
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
@@ -88,7 +88,7 @@ public class BlockJewelAltar extends BlockContainer
}
}
}
-
+
public void dropItem(World world, double x, double y, double z, ItemStack stack)
{
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.5D, z + 0.5D, stack);
@@ -97,17 +97,17 @@ public class BlockJewelAltar extends BlockContainer
entityitem.motionY = 0.11000000298023224D;
world.spawnEntityInWorld(entityitem);
}
-
+
public void breakBlock(World world, int i, int j, int k, Block block, int par6)
{
TileEntityAltar te = (TileEntityAltar) world.getTileEntity(i, j, k);
-
+
if (te != null && te.object != null && te.object != new ItemStack(Item.getItemById(0), 0, 0))
{
- dropItem(te.getWorldObj(), (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.object);
+ dropItem(te.getWorldObj(), (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.object);
world.removeTileEntity(i, j, k);
}
-
+
super.breakBlock(world, i, j, k, block, par6);
}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java b/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
index a701467..1c65970 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
+++ b/java/darkknight/jewelrycraft/block/BlockJewelrsCraftingTable.java
@@ -24,25 +24,25 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class BlockJewelrsCraftingTable extends BlockContainer
{
Random rand = new Random();
-
+
protected BlockJewelrsCraftingTable(Material par2Material)
{
super(par2Material);
this.setBlockBounds(0.0F, 0F, 0.0F, 1.0F, 0.8F, 1.0F);
}
-
+
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityJewelrsCraftingTable();
}
-
+
@Override
public boolean renderAsNormalBlock()
{
return false;
}
-
+
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
@@ -52,12 +52,9 @@ public class BlockJewelrsCraftingTable extends BlockContainer
{
if (!te.hasEndItem && !te.hasJewelry && item != null && JewelrycraftUtil.isJewelry(item))
{
- if(te.hasModifier && te.hasJewel && item.hasTagCompound() && item.getTagCompound().hasKey("modifier") && item.getTagCompound().hasKey("jewel"))
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrymodifiedfull")));
- else if(te.hasJewel && item.hasTagCompound() && item.getTagCompound().hasKey("jewel"))
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsjewel")));
- else if(te.hasModifier && item.hasTagCompound() && item.getTagCompound().hasKey("modifier"))
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsmodifier")));
+ if (te.hasModifier && te.hasJewel && item.hasTagCompound() && item.getTagCompound().hasKey("modifier") && item.getTagCompound().hasKey("jewel")) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrymodifiedfull")));
+ else if (te.hasJewel && item.hasTagCompound() && item.getTagCompound().hasKey("jewel")) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsjewel")));
+ else if (te.hasModifier && item.hasTagCompound() && item.getTagCompound().hasKey("modifier")) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsmodifier")));
else
{
te.jewelry = item.copy();
@@ -71,8 +68,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
}
if (!te.hasEndItem && !te.hasModifier && item != null && JewelrycraftUtil.isModifier(item))
{
- if(te.hasJewelry && te.jewelry.hasTagCompound() && te.jewelry.getTagCompound().hasKey("modifier"))
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsmodifier")));
+ if (te.hasJewelry && te.jewelry.hasTagCompound() && te.jewelry.getTagCompound().hasKey("modifier")) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsmodifier")));
else
{
te.modifier = item.copy();
@@ -87,8 +83,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
}
if (!te.hasEndItem && !te.hasJewel && item != null && JewelrycraftUtil.isJewel(item))
{
- if(te.hasJewelry && te.jewelry.hasTagCompound() && te.jewelry.getTagCompound().hasKey("jewel"))
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsjewel")));
+ if (te.hasJewelry && te.jewelry.hasTagCompound() && te.jewelry.getTagCompound().hasKey("jewel")) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.jewelrycontainsjewel")));
else
{
te.jewel = item.copy();
@@ -101,9 +96,13 @@ public class BlockJewelrsCraftingTable extends BlockContainer
te.markDirty();
}
}
- if (te.timer <= 0 && !te.hasEndItem && te.hasJewelry && (te.hasModifier || te.hasJewel)){ te.timer = ConfigHandler.jewelryCraftingTime; te.angle = 0;}
+ if (te.timer <= 0 && !te.hasEndItem && te.hasJewelry && (te.hasModifier || te.hasJewel))
+ {
+ te.timer = ConfigHandler.jewelryCraftingTime;
+ te.angle = 0;
+ }
if (te.hasEndItem && item != null) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.hasenditem")));
-
+
if (te.hasModifier && entityPlayer.isSneaking())
{
dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.modifier.copy());
@@ -143,7 +142,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
}
return true;
}
-
+
public void dropItem(World world, double x, double y, double z, ItemStack stack)
{
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1D, z + 0.5D, stack);
@@ -152,7 +151,7 @@ public class BlockJewelrsCraftingTable extends BlockContainer
entityitem.motionY = 0.21000000298023224D;
world.spawnEntityInWorld(entityitem);
}
-
+
public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
{
TileEntityJewelrsCraftingTable te = (TileEntityJewelrsCraftingTable) world.getTileEntity(i, j, k);
@@ -166,14 +165,14 @@ public class BlockJewelrsCraftingTable extends BlockContainer
}
super.breakBlock(world, i, j, k, par5, par6);
}
-
+
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
{
int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
-
+
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
@@ -196,25 +195,25 @@ public class BlockJewelrsCraftingTable extends BlockContainer
else if (!te.hasModifier || !te.hasJewel) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.table.missingmodifierorjewel")));
}
}
-
+
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
-
+
@Override
public boolean isOpaqueCube()
{
return false;
}
-
+
@Override
public int getRenderType()
{
return -1;
}
-
+
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("jewelrycraft:jewelrsCraftingTable");
diff --git a/java/darkknight/jewelrycraft/block/BlockList.java b/java/darkknight/jewelrycraft/block/BlockList.java
new file mode 100644
index 0000000..75efbaa
--- /dev/null
+++ b/java/darkknight/jewelrycraft/block/BlockList.java
@@ -0,0 +1,68 @@
+package darkknight.jewelrycraft.block;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+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;
+import darkknight.jewelrycraft.tileentity.TileEntityAltar;
+import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow;
+import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
+import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
+import darkknight.jewelrycraft.tileentity.TileEntityMolder;
+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;
+ 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/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java b/java/darkknight/jewelrycraft/block/BlockMolder.java
index 4b26044..8b7d47d 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockMolder.java
+++ b/java/darkknight/jewelrycraft/block/BlockMolder.java
@@ -24,25 +24,25 @@ import darkknight.jewelrycraft.tileentity.TileEntityMolder;
public class BlockMolder extends BlockContainer
{
Random rand = new Random();
-
+
protected BlockMolder(Material par2Material)
{
super(par2Material);
this.setBlockBounds(0.1F, 0F, 0.1F, 0.9F, 0.2F, 0.9F);
}
-
+
@Override
public TileEntity createNewTileEntity(World world, int var2)
{
return new TileEntityMolder();
}
-
+
@Override
public boolean renderAsNormalBlock()
{
return false;
}
-
+
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{
@@ -50,7 +50,7 @@ public class BlockMolder extends BlockContainer
ItemStack item = entityPlayer.inventory.getCurrentItem();
if (te != null && !world.isRemote)
{
- if(item != null && !te.hasMold && item.getItem() == ItemList.molds)
+ if (item != null && !te.hasMold && item.getItem() == ItemList.molds)
{
te.mold = item.copy();
te.hasMold = true;
@@ -60,16 +60,16 @@ public class BlockMolder extends BlockContainer
}
if (te.hasMold && entityPlayer.isSneaking() && !te.hasMoltenMetal)
{
- dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.mold.copy());
+ dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.mold.copy());
te.mold = new ItemStack(Item.getItemById(0), 0, 0);
te.hasMold = false;
te.isDirty = true;
}
- else if(te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.hasmoltenmetal")));
+ else if (te.hasMoltenMetal) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.hasmoltenmetal")));
}
return true;
}
-
+
public void dropItem(World world, double x, double y, double z, ItemStack stack)
{
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
@@ -78,18 +78,18 @@ public class BlockMolder extends BlockContainer
entityitem.motionY = 0.11000000298023224D;
world.spawnEntityInWorld(entityitem);
}
-
+
public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
{
TileEntityMolder te = (TileEntityMolder) world.getTileEntity(i, j, k);
-
+
if (te != null)
{
- if(te.hasJewelBase) dropItem(te.getWorldObj(), (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.jewelBase.copy());
- if(te.hasMold) dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.mold.copy());
+ 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.removeTileEntity(i, j, k);
}
-
+
super.breakBlock(world, i, j, k, par5, par6);
}
@@ -99,7 +99,7 @@ public class BlockMolder extends BlockContainer
int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
}
-
+
@Override
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
{
@@ -108,38 +108,35 @@ public class BlockMolder extends BlockContainer
{
if (me.hasJewelBase)
{
- dropItem(me.getWorldObj(), (double)me.xCoord, (double)me.yCoord, (double)me.zCoord, me.jewelBase.copy());
+ dropItem(me.getWorldObj(), (double) me.xCoord, (double) me.yCoord, (double) me.zCoord, me.jewelBase.copy());
me.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
me.hasJewelBase = false;
}
- else if (me.hasMoltenMetal && me.cooling > 0)
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.metaliscooling") + " (" + ((ConfigHandler.ingotCoolingTime - me.cooling)*100/ConfigHandler.ingotCoolingTime) + "%)"));
- else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal)
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldisempty")));
- else if (me.mold.getItem() != ItemList.molds)
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldismissing")));
+ else if (me.hasMoltenMetal && me.cooling >= 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.metaliscooling") + " (" + ((ConfigHandler.ingotCoolingTime - me.cooling) * 100 / ConfigHandler.ingotCoolingTime) + "%)"));
+ else if (me.mold.getItem() == ItemList.molds && !me.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldisempty")));
+ else if (me.mold.getItem() != ItemList.molds) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.molder.moldismissing")));
me.isDirty = true;
}
}
-
+
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
return false;
}
-
+
@Override
public boolean isOpaqueCube()
{
return false;
}
-
+
@Override
public int getRenderType()
{
return -1;
}
-
+
public void registerBlockIcons(IIconRegister icon)
{
this.blockIcon = icon.registerIcon("jewelrycraft:molder");
diff --git a/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java b/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
new file mode 100644
index 0000000..9c1daea
--- /dev/null
+++ b/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
@@ -0,0 +1,310 @@
+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.renderer.texture.TextureManager;
+import net.minecraft.client.resources.IResourceManager;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import net.minecraftforge.fluids.BlockFluidClassic;
+import net.minecraftforge.fluids.Fluid;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.network.PacketRequestLiquidData;
+import darkknight.jewelrycraft.network.PacketSendLiquidData;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+public class BlockMoltenMetal extends BlockFluidClassic
+{
+
+ @SideOnly(Side.CLIENT)
+ protected IIcon stillIcon;
+ @SideOnly(Side.CLIENT)
+ protected IIcon flowingIcon;
+
+ public BlockMoltenMetal(Fluid fluid, Material material)
+ {
+ super(fluid, material);
+ setBlockName("Jewelrycraft.moltenMetal");
+ this.setQuantaPerBlock(5);
+ setLightLevel(15f);
+ }
+
+ @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);
+ }
+
+ @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, false, null);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return 0;
+ }
+
+ @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.getString(stringFromLocation(x, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
+ (world.getBlock(x - 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
+ (world.getBlock(x + 1, y2, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y2, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
+ (world.getBlock(x, y2, z - 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) ||
+ (world.getBlock(x, y2, z + 1) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y2, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))))
+ {
+ expQuanta = quantaPerBlock - 1;
+ }
+ else
+ {
+ int maxQuanta = -100;
+ if(JewelrycraftMod.saveData.getString(stringFromLocation(x - 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x - 1, y, z, maxQuanta);
+ if(JewelrycraftMod.saveData.getString(stringFromLocation(x + 1, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x + 1, y, z, maxQuanta);
+ if(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z - 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z - 1, maxQuanta);
+ if(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z + 1, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)))) maxQuanta = getLargerQuanta(world, x, y, z + 1, maxQuanta);
+
+ 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);
+ }
+
+ String originData = JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId));
+
+ // Flow vertically if possible
+ if (canDisplace(world, x, y + densityDir, z))
+ {
+ JewelrycraftMod.saveData.setString(stringFromLocation(x, y + densityDir, z, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
+ flowIntoBlock(world, x, y + densityDir, z, 1, originData);
+ return;
+ }
+
+ // Flow outward if possible
+ int flowMeta = quantaPerBlock - quantaRemaining + 1;
+ if (flowMeta >= quantaPerBlock) { return; }
+
+ if (isSourceBlock(world, x, y, z) || !isFlowingVertically(world, x, y, z))
+ {
+ if (world.getBlock(x, y - densityDir, z) == this && JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)).equals(JewelrycraftMod.saveData.getString(stringFromLocation(x, y - densityDir, z, world.provider.dimensionId))))
+ {
+ flowMeta = 1;
+ }
+ boolean flowTo[] = getOptimalFlowDirections(world, x, y, z);
+
+ if (flowTo[0])
+ {
+ if (JewelrycraftMod.saveData.getTag(stringFromLocation(x - 1, y, z, world.provider.dimensionId)) == null || world.getBlock(x - 1, y, z).isAir(world, x - 1, y, z)) JewelrycraftMod.saveData.setString(stringFromLocation(x - 1, y, z, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
+ flowIntoBlock(world, x - 1, y, z, flowMeta, originData);
+ }
+ if (flowTo[1])
+ {
+ if (JewelrycraftMod.saveData.getTag(stringFromLocation(x + 1, y, z, world.provider.dimensionId)) == null || world.getBlock(x + 1, y, z).isAir(world, x + 1, y, z)) JewelrycraftMod.saveData.setString(stringFromLocation(x + 1, y, z, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
+ flowIntoBlock(world, x + 1, y, z, flowMeta, originData);
+ }
+ if (flowTo[2])
+ {
+ if (JewelrycraftMod.saveData.getTag(stringFromLocation(x, y, z - 1, world.provider.dimensionId)) == null || world.getBlock(x, y, z - 1).isAir(world, x, y, z - 1)) JewelrycraftMod.saveData.setString(stringFromLocation(x, y, z - 1, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
+ flowIntoBlock(world, x, y, z - 1, flowMeta, originData);
+ }
+ if (flowTo[3])
+ {
+ if (JewelrycraftMod.saveData.getTag(stringFromLocation(x, y, z + 1, world.provider.dimensionId)) == null || world.getBlock(x, y, z + 1).isAir(world, x, y, z + 1)) JewelrycraftMod.saveData.setString(stringFromLocation(x, y, z + 1, world.provider.dimensionId), JewelrycraftMod.saveData.getString(stringFromLocation(x, y, z, world.provider.dimensionId)));
+ flowIntoBlock(world, x, y, z + 1, flowMeta, originData);
+ }
+ }
+ }
+
+ public void flowIntoBlock(World world, int x, int y, int z, int meta, String originData)
+ {
+ if (meta < 0 || world.isRemote) return;
+ if (displaceIfPossible(world, x, y, z))
+ {
+ world.setBlock(x, y, z, this, meta, 3);
+ JewelrycraftMod.saveData.setString(stringFromLocation(x, y, z, world.provider.dimensionId), originData);
+ String[] data = originData.split(":");
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, x, y, z, Integer.parseInt(data[0]), Integer.parseInt(data[1])));
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ 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);
+ String ingotData = JewelrycraftMod.clientData.getString(String.valueOf(i) + " " + String.valueOf(j) + " " + String.valueOf(k) + " " + Minecraft.getMinecraft().theWorld.provider.dimensionId);
+ if (ingotData == "")
+ {
+ JewelrycraftMod.netWrapper.sendToServer(new PacketRequestLiquidData(Minecraft.getMinecraft().theWorld.provider.dimensionId, i, j, k));
+ return 0xFFFFFF;
+ }
+ else
+ {
+ String[] splitData = ingotData.split(":");
+ if (splitData.length == 2)
+ {
+ int itemID, itemDamage;
+ try
+ {
+ itemID = Integer.parseInt(splitData[0]);
+ itemDamage = Integer.parseInt(splitData[1]);
+
+ JewelryNBT.addMetal(item, new ItemStack(Item.getItemById(itemID), 1, itemDamage));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ if (forcecolor) JewelryNBT.addMetal(item, new ItemStack(itemC));
+ int x = 0, y = 0, ok = 0, red, green, blue;
+ if (item != null && JewelryNBT.ingot(item) != null && JewelryNBT.ingot(item).getIconIndex() != null && JewelryNBT.ingotColor(item) == 16777215)
+ {
+ IIcon itemIcon = JewelryNBT.ingot(item).getItem().getIcon(JewelryNBT.ingot(item), 0);
+ String ingotIconName = itemIcon.getIconName();
+
+ if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim();
+ else domain = "minecraft";
+
+ texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png";
+ ResourceLocation ingot = null;
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
+
+ if (texturemanager.getResourceLocation(JewelryNBT.ingot(item).getItemSpriteNumber()).toString().contains("items")) ingot = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
+ else ingot = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
+
+ icon = ImageIO.read(rm.getResource(ingot).getInputStream());
+ while (ok == 0)
+ {
+ red = (icon.getRGB(x, y) >> 16) & 0xFF;
+ green = (icon.getRGB(x, y) >> 8) & 0xFF;
+ blue = icon.getRGB(x, y) & 0xFF;
+ if (!isColorPretty(red, green, blue))
+ {
+ 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;
+ }
+
+ public static boolean isColorPretty(int r, int g, int b)
+ {
+ if ((r >= 100 && g >= 100 && b >= 100 && r < 200 && b < 200 && g < 200) || ((r >= 100 && (g < 100 || b < 100)) || (g >= 100 && (r < 100 || b < 100)) || (b >= 100 && (g < 100 || r < 100)))) return true;
+ else return false;
+ }
+
+ public static String stringFromLocation(int x, int y, int z, int dimID)
+ {
+ return x + " " + y + " " + z + " " + dimID;
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java b/java/darkknight/jewelrycraft/block/BlockShadow.java
index acce92f..4e8acf5 100644
--- a/src/main/java/darkknight/jewelrycraft/block/BlockShadow.java
+++ b/java/darkknight/jewelrycraft/block/BlockShadow.java
@@ -20,13 +20,13 @@ public class BlockShadow extends BlockContainer
{
private IIcon[] iconArray;
private static final String __OBFID = "CL_00000312";
-
+
public BlockShadow()
{
super(Material.iron);
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
-
+
public int getRenderBlockPass()
{
return 1;
@@ -66,16 +66,16 @@ public class BlockShadow extends BlockContainer
public void registerBlockIcons(IIconRegister par1IconRegister)
{
this.iconArray = new IIcon[16];
-
+
for (int i = 0; i < this.iconArray.length; ++i)
{
this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + (15 - i));
}
}
-
+
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
{
- if(world.getBlockMetadata(x, y, z) == 15) return null;
+ if (world.getBlockMetadata(x, y, z) == 15) return null;
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
@@ -83,19 +83,16 @@ public class BlockShadow extends BlockContainer
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
-
+
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_)
{
Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
-
+
if (this == BlockList.shadowBlock)
{
- if (block == this)
- {
- return false;
- }
+ if (block == this) { return false; }
}
-
+
return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
}
diff --git a/java/darkknight/jewelrycraft/block/BlockSmelter.java b/java/darkknight/jewelrycraft/block/BlockSmelter.java
new file mode 100644
index 0000000..b64f142
--- /dev/null
+++ b/java/darkknight/jewelrycraft/block/BlockSmelter.java
@@ -0,0 +1,239 @@
+package darkknight.jewelrycraft.block;
+
+import java.util.Random;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+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.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.network.PacketSendLiquidData;
+import darkknight.jewelrycraft.tileentity.TileEntityMolder;
+import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
+import darkknight.jewelrycraft.util.JewelryNBT;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+public class BlockSmelter extends BlockContainer
+{
+ Random rand = new Random();
+
+ protected BlockSmelter(Material par2Material)
+ {
+ super(par2Material);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(World world, int var2)
+ {
+ return new TileEntitySmelter();
+ }
+
+ @Override
+ public boolean renderAsNormalBlock()
+ {
+ return false;
+ }
+
+ public void dropItem(World world, double x, double y, double z, ItemStack stack)
+ {
+ EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.3D, z + 0.5D, stack);
+ entityitem.motionX = 0;
+ entityitem.motionZ = 0;
+ entityitem.motionY = 0.11000000298023224D;
+ world.spawnEntityInWorld(entityitem);
+ }
+
+ public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
+ {
+ TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
+ if (te != null)
+ {
+ if (te.hasMetal) dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.metal.copy());
+ if (te.hasMoltenMetal && te.moltenMetal != null && Item.getIdFromItem(te.moltenMetal.getItem()) > 0)
+ {
+ JewelrycraftMod.saveData.setString(i + " " + j + " " + k + " " + world.provider.dimensionId, Item.getIdFromItem(te.moltenMetal.getItem()) + ":" + te.moltenMetal.getItemDamage());
+ JewelrycraftMod.netWrapper.sendToAll(new PacketSendLiquidData(world.provider.dimensionId, i, j, k, Item.getIdFromItem(te.moltenMetal.getItem()), te.moltenMetal.getItemDamage()));
+
+ world.setBlock(i, j, k, BlockList.moltenMetal, 0, 3);
+ int quant = (int) (te.quantity * 10);
+ if (quant == 1) world.setBlockMetadataWithNotify(i, j, k, 4, 3);
+ if (quant == 2) world.setBlockMetadataWithNotify(i, j, k, 4, 3);
+ if (quant == 3) world.setBlockMetadataWithNotify(i, j, k, 3, 3);
+ if (quant == 4) world.setBlockMetadataWithNotify(i, j, k, 3, 3);
+ if (quant == 5) world.setBlockMetadataWithNotify(i, j, k, 2, 3);
+ if (quant == 6) world.setBlockMetadataWithNotify(i, j, k, 2, 3);
+ if (quant == 7) world.setBlockMetadataWithNotify(i, j, k, 1, 3);
+ if (quant == 8) world.setBlockMetadataWithNotify(i, j, k, 1, 3);
+ if (quant == 9) world.setBlockMetadataWithNotify(i, j, k, 0, 3);
+ }
+ world.removeTileEntity(i, j, k);
+ }
+ super.breakBlock(world, i, j, k, par5, par6);
+ }
+
+ @Override
+ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
+ {
+ TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
+ ItemStack item = entityPlayer.inventory.getCurrentItem();
+ if(te != null && te.hasMoltenMetal && te.quantity >= 0.9f && !te.pouring && item != null && item.getItem() == Items.bucket)
+ {
+ te.quantity = 0f;
+ te.hasMoltenMetal = false;
+ ItemStack metalBucket = new ItemStack(ItemList.bucket, 1);
+ JewelryNBT.addMetal(metalBucket, te.moltenMetal);
+ --item.stackSize;
+ entityPlayer.inventory.addItemStackToInventory(metalBucket);
+ te.isDirty = true;
+ return true;
+ }
+ if (te != null && !world.isRemote)
+ {
+ int index = -1;
+ for (int a = 0; a < JewelrycraftUtil.jamcraftPlayers.size(); a++)
+ if (entityPlayer.getDisplayName().equals(JewelrycraftUtil.jamcraftPlayers.get(a))) index = a;
+ boolean canPlace = item != null && (JewelrycraftUtil.isMetal(item) || JewelrycraftUtil.isOre(item) || index != -1);
+ boolean isOre = false;
+ boolean oreCoincidesWithMetal = false;
+ if(item != null && Item.getIdFromItem(item.getItem()) != 0) isOre = JewelrycraftUtil.isOre(item);
+ if(isOre && te.moltenMetal != null && item != null && Item.getIdFromItem(te.moltenMetal.getItem()) != 0)
+ oreCoincidesWithMetal = te.moltenMetal.getItem().equals(JewelrycraftUtil.getIngotFromOre(item.getItem()).getItem()) && te.moltenMetal.getItemDamage() == JewelrycraftUtil.getIngotFromOre(item.getItem()).getItemDamage();
+ if (!te.hasMetal && !te.hasMoltenMetal && !te.pouring && item != null && canPlace)
+ {
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.nowsmeltingingot", item.getDisplayName())));
+ te.metal = item.copy();
+ te.metal.stackSize = 1;
+ te.hasMetal = true;
+ te.melting = ConfigHandler.ingotMeltingTime;
+ if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ te.isDirty = true;
+ }
+ else if (te.hasMetal && !te.hasMoltenMetal && item != null && canPlace && item.getUnlocalizedName().equals(te.metal.getUnlocalizedName()) && (!isOre && te.metal.stackSize < 9 || isOre && te.metal.stackSize < 4))
+ {
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("Smelting extra " + (isOre ? "ores" : "ingots") + " (" + (te.metal.stackSize + 1) + ")")));
+ te.metal.stackSize++;
+ if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ te.isDirty = true;
+ }
+ else if (!te.hasMetal && te.hasMoltenMetal && item != null && canPlace && ((!isOre && item.getUnlocalizedName().equals(te.moltenMetal.getUnlocalizedName()) && te.moltenMetal.stackSize < 9) || (isOre && oreCoincidesWithMetal && te.moltenMetal.stackSize < 8)))
+ {
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("Smelting extra " + (isOre ? "ore" : "ingot") + ".")));
+ te.metal = item.copy();
+ te.metal.stackSize = 1;
+ te.hasMetal = true;
+ te.melting = ConfigHandler.ingotMeltingTime;
+ if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ te.isDirty = true;
+ }
+ else if (te.hasMetal && te.hasMoltenMetal && item != null && canPlace && item.getUnlocalizedName().equals(te.moltenMetal.getUnlocalizedName()))
+ {
+ if ((!isOre && te.moltenMetal.stackSize < 9 && te.metal.stackSize < 9 && (te.metal.stackSize + te.moltenMetal.stackSize) < 9) || (isOre && oreCoincidesWithMetal && te.metal.stackSize*2 < 9 && (te.metal.stackSize*2 + te.moltenMetal.stackSize) < 9))
+ {
+ entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("Smelting extra ingots (" + (te.metal.stackSize + 1) + ")")));
+ te.metal.stackSize++;
+ te.hasMetal = true;
+ te.melting = ConfigHandler.ingotMeltingTime;
+ if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
+ te.isDirty = true;
+ }
+ }
+ else if ((te.hasMetal || te.hasMoltenMetal) && item != null && canPlace && ((te.moltenMetal != null && te.moltenMetal.stackSize > 0 && item.getUnlocalizedName().equals(te.moltenMetal.getUnlocalizedName())) || (te.metal != null && te.metal.stackSize > 0 && item.getUnlocalizedName().equals(te.metal.getUnlocalizedName()))) && ((te.moltenMetal != null && te.moltenMetal.stackSize >= 9) || (te.metal != null && te.metal.stackSize >= 9))) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("Smelter is at full capacity.")));
+ else if (te.hasMetal && !te.hasMoltenMetal && item != null && canPlace) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.alreadyhasingot", te.metal.getDisplayName())));
+ else if (te.hasMoltenMetal && Item.getIdFromItem(te.moltenMetal.getItem()) > 0) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.hasmolteningot", te.moltenMetal.getDisplayName())));
+ else if (item != null && !item.getUnlocalizedName().toLowerCase().contains("ingot") && canPlace) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.itemrenamedtoingot")));
+ else if (item != null && (!item.getUnlocalizedName().toLowerCase().contains("ingot") || item.getUnlocalizedName().toLowerCase().contains("mold"))) entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.itemneedstobeingot")));
+
+ if (te.hasMetal && entityPlayer.isSneaking())
+ {
+ dropItem(world, (double) te.xCoord, (double) te.yCoord, (double) te.zCoord, te.metal.copy());
+ te.hasMetal = false;
+ te.melting = -1;
+ te.isDirty = true;
+ }
+ if (te != null) world.setTileEntity(i, j, k, te);
+ }
+ return true;
+ }
+
+ @Override
+ public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
+ {
+ TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
+ TileEntityMolder me = null;
+ if (world.getBlockMetadata(i, j, k) == 0 && world.getTileEntity(i, j, k - 1) != null && world.getTileEntity(i, j, k - 1) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i, j, k - 1);
+ else if (world.getBlockMetadata(i, j, k) == 1 && world.getTileEntity(i + 1, j, k) != null && world.getTileEntity(i + 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i + 1, j, k);
+ else if (world.getBlockMetadata(i, j, k) == 2 && world.getTileEntity(i, j, k + 1) != null && world.getTileEntity(i, j, k + 1) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i, j, k + 1);
+ else if (world.getBlockMetadata(i, j, k) == 3 && world.getTileEntity(i - 1, j, k) != null && world.getTileEntity(i - 1, j, k) instanceof TileEntityMolder) me = (TileEntityMolder) world.getTileEntity(i - 1, j, k);
+
+ if (te != null && me != null && !world.isRemote)
+ {
+ if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me != null && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase)
+ {
+ te.pouring = true;
+ te.isDirty = true;
+ }
+ else if (te.hasMetal && te.melting > 0) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.metalismelting", te.metal.getDisplayName()) + " (" + ((ConfigHandler.ingotMeltingTime - te.melting) * 100 / ConfigHandler.ingotMeltingTime) + "%)"));
+ else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k)) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderismissing")));
+ else if (!me.hasMold && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasnomold")));
+ else if (me.hasMoltenMetal && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasmoltenmetal")));
+ else if (me.hasJewelBase && te.hasMoltenMetal) player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.modlerhasitem")));
+ else player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.empty")));
+ }
+
+ }
+
+ public boolean isConnectedToMolder(World world, int i, int j, int k)
+ {
+ int blockMeta = world.getBlockMetadata(i, j, k);
+ if (blockMeta == 0 && world.getBlock(i, j, k - 1) instanceof BlockMolder) return true;
+ else if (blockMeta == 1 && world.getBlock(i + 1, j, k) instanceof BlockMolder) return true;
+ else if (blockMeta == 2 && world.getBlock(i, j, k + 1) instanceof BlockMolder) return true;
+ else if (blockMeta == 3 && world.getBlock(i - 1, j, k) instanceof BlockMolder) return true;
+ return false;
+ }
+
+ @Override
+ public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
+ {
+ int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
+ world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
+ }
+
+ @Override
+ public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube()
+ {
+ return false;
+ }
+
+ @Override
+ public int getRenderType()
+ {
+ return -1;
+ }
+
+ public void registerBlockIcons(IIconRegister icon)
+ {
+ this.blockIcon = icon.registerIcon("jewelrycraft:smelter");
+ }
+
+}
diff --git a/src/main/java/darkknight/jewelrycraft/client/ClientProxy.java b/java/darkknight/jewelrycraft/client/ClientProxy.java
index e086e94..e086e94 100644
--- a/src/main/java/darkknight/jewelrycraft/client/ClientProxy.java
+++ b/java/darkknight/jewelrycraft/client/ClientProxy.java
diff --git a/src/main/java/darkknight/jewelrycraft/client/GuiGuide.java b/java/darkknight/jewelrycraft/client/GuiGuide.java
index fbf02ee..cf562a8 100644
--- a/src/main/java/darkknight/jewelrycraft/client/GuiGuide.java
+++ b/java/darkknight/jewelrycraft/client/GuiGuide.java
@@ -24,108 +24,111 @@ import darkknight.jewelrycraft.container.GuiTabJewelsAndModifiers;
import darkknight.jewelrycraft.container.GuiTabNecklaces;
import darkknight.jewelrycraft.container.GuiTabRings;
-public class GuiGuide extends GuiContainer
+public class GuiGuide extends GuiContainer
{
public int page, rot, del;
public boolean prevHover, nextHover;
World world;
private final GuiTab[] tabs;
private GuiTab activeTab;
-
- public GuiGuide(Container container, World world)
+
+ public GuiGuide(Container container, World world)
{
super(container);
page = 1;
rot = 0;
del = 0;
this.world = world;
-
- tabs = new GuiTab[] {
- new GuiTabBlocks(0),
- new GuiTabItems(1),
- new GuiTabJewelsAndModifiers(2),
- new GuiTabRings(3),
- new GuiTabNecklaces(4)
- };
-
+
+ tabs = new GuiTab[]
+ { new GuiTabBlocks(0), new GuiTabItems(1), new GuiTabJewelsAndModifiers(2), new GuiTabRings(3), new GuiTabNecklaces(4) };
+
activeTab = tabs[0];
}
-
+
@Override
- protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
+ protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
nextHover = false;
prevHover = false;
- if(del == 0) rot++;
+ if (del == 0) rot++;
del++;
- if(del >= 2) del = 0;
+ if (del >= 2) del = 0;
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePage.png"));
- drawTexturedModalRect(guiLeft + 147/2 + 20, guiTop - 10, 0, 0, 145, 180);
+ drawTexturedModalRect(guiLeft + 147 / 2 + 20, guiTop - 10, 0, 0, 145, 180);
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png"));
- drawTexturedModalRect(guiLeft - 147/2 + 21, guiTop - 10, 0, 0, 145, 180);
-
- for (GuiRectangle tab : tabs) {
+ drawTexturedModalRect(guiLeft - 147 / 2 + 21, guiTop - 10, 0, 0, 145, 180);
+
+ for (GuiRectangle tab : tabs)
+ {
int srcX = 24;
int sizeX = 19;
-
- if (tab == activeTab) {
+
+ if (tab == activeTab)
+ {
srcX += 38;
- sizeX +=3;
- }else if(tab.inRect(this, i, j)) {
+ sizeX += 3;
+ }
+ else if (tab.inRect(this, i, j))
+ {
srcX += 19;
}
-
- tab.draw(this, srcX, 180, sizeX, 18);
+
+ tab.draw(this, srcX, 180, sizeX, 18);
}
-
- if(i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages())
+
+ if (i >= guiLeft + 195 + 20 && i <= guiLeft + 195 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page + 2 <= activeTab.getMaxPages())
{
drawTexturedModalRect(guiLeft + 195 + 20, guiTop + 127 + 20, 0, 180, 11, 14);
nextHover = true;
}
-
- if(i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page - 2 > 0)
+
+ if (i >= guiLeft + 20 - 61 && i <= guiLeft - 61 + 20 + 11 && j >= guiTop + 127 + 20 && j <= guiTop + 127 + 20 + 14 && page - 2 > 0)
{
drawTexturedModalRect(guiLeft - 61 + 20, guiTop + 127 + 20, 11, 180, 11, 14);
prevHover = true;
}
-
+
activeTab.drawBackground(this, i, j, page);
activeTab.drawBackground(this, i, j, page + 1);
-
+
ArrayList<String> text = new ArrayList<String>();
text.add(Integer.toString(page));
this.drawHoveringText(text, guiLeft - 10 + 20 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
text.remove(Integer.toString(page));
text.add(Integer.toString(page + 1));
this.drawHoveringText(text, guiLeft - 10 + 20 + 147 - text.get(0).length(), guiTop + 150 + 20, fontRendererObj);
-
- for(int tab = 0; tab < tabs.length; tab++)
- renderItem(tabs[tab].getIcon(), guiLeft - 52, guiTop + 26 + tab*19, activeTab.getIcon());
-
+
+ for (int tab = 0; tab < tabs.length; tab++)
+ renderItem(tabs[tab].getIcon(), guiLeft - 52, guiTop + 26 + tab * 19, activeTab.getIcon());
+
}
-
- protected void drawGuiContainerForegroundLayer(int x, int y)
- {
+
+ protected void drawGuiContainerForegroundLayer(int x, int y)
+ {
activeTab.drawForeground(this, x, y, page);
activeTab.drawForeground(this, x, y, page + 1);
-
- for (GuiTab tab : tabs) {
+
+ for (GuiTab tab : tabs)
+ {
tab.drawString(this, x, y, tab.getName());
}
}
-
+
@Override
- protected void mouseClicked(int x, int y, int button)
+ protected void mouseClicked(int x, int y, int button)
{
- if(nextHover && page+2 <= activeTab.getMaxPages()) page+=2;
- else if (prevHover && page > 1) page-=2;
-
+ if (nextHover && page + 2 <= activeTab.getMaxPages()) page += 2;
+ else if (prevHover && page > 1) page -= 2;
+
activeTab.mouseClick(this, x, y, button);
-
- for (GuiTab tab : tabs) {
- if (activeTab != tab) {
- if (tab.inRect(this, x, y)) {
+
+ for (GuiTab tab : tabs)
+ {
+ if (activeTab != tab)
+ {
+ if (tab.inRect(this, x, y))
+ {
activeTab = tab;
page = 1;
break;
@@ -133,32 +136,31 @@ public class GuiGuide extends GuiContainer
}
}
}
-
+
public void renderItem(ItemStack item, float x, float y, ItemStack activeIcon)
- {
+ {
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
entityitem.hoverStart = 0.0F;
- if(item.isItemEqual(new ItemStack(BlockList.jewelAltar)))
+ if (item.isItemEqual(new ItemStack(BlockList.jewelAltar)))
{
- y-=4;
+ y -= 4;
}
GL11.glTranslatef(x, y, 100);
-
+
float scale = 30F;
GL11.glScalef(-scale, scale, scale);
-
- if(activeIcon != null && item.isItemEqual(activeIcon)) GL11.glRotatef(rot, 0, 1, 0);
- if(item.isItemEqual(new ItemStack(BlockList.jewelAltar)))
+
+ if (activeIcon != null && item.isItemEqual(activeIcon)) GL11.glRotatef(rot, 0, 1, 0);
+ if (item.isItemEqual(new ItemStack(BlockList.jewelAltar)))
{
GL11.glRotatef(160.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
- if(RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else
{
GL11.glRotatef(180F, 0F, 1F, 0F);
@@ -168,21 +170,20 @@ public class GuiGuide extends GuiContainer
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
-
+
}
-
+
public void renderItem(ItemStack item, float x, float y, float scale)
- {
+ {
GL11.glPushMatrix();
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, item);
entityitem.hoverStart = 0.0F;
- GL11.glTranslatef(x, y, 100);
- GL11.glScalef(-scale, scale, scale);
+ GL11.glTranslatef(x, y, 100);
+ GL11.glScalef(-scale, scale, scale);
GL11.glRotatef(160.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(rot, 0.0F, 1.0F, 0.0F);
- if(RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else
{
RenderManager.instance.options.fancyGraphics = true;
@@ -191,25 +192,25 @@ public class GuiGuide extends GuiContainer
}
GL11.glPopMatrix();
}
-
- public int getLeft()
+
+ public int getLeft()
{
return guiLeft;
}
-
- public int getTop()
+
+ public int getTop()
{
return guiTop;
}
-
+
public FontRenderer getFont()
{
return fontRendererObj;
}
-
+
@SuppressWarnings("rawtypes")
- public void drawHoverString(List lst, int x, int y)
+ public void drawHoverString(List lst, int x, int y)
{
drawHoveringText(lst, x, y, fontRendererObj);
- }
+ }
} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/client/GuiRingChest.java b/java/darkknight/jewelrycraft/client/GuiRingChest.java
index f711558..f711558 100644
--- a/src/main/java/darkknight/jewelrycraft/client/GuiRingChest.java
+++ b/java/darkknight/jewelrycraft/client/GuiRingChest.java
diff --git a/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java b/java/darkknight/jewelrycraft/config/ConfigHandler.java
index 4bfd893..1a165ae 100644
--- a/src/main/java/darkknight/jewelrycraft/config/ConfigHandler.java
+++ b/java/darkknight/jewelrycraft/config/ConfigHandler.java
@@ -6,9 +6,9 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
public class ConfigHandler
{
private static Configuration config;
- public static int ingotCoolingTime = 200;
+ public static int ingotCoolingTime = 100;
public static int ingotMeltingTime = 1500;
- public static int jewelryCraftingTime = 2000;
+ public static int jewelryCraftingTime = 1000;
private static boolean isInitialized = false;
public static boolean generateVillageNetherstar = false;
diff --git a/src/main/java/darkknight/jewelrycraft/container/ContainerGuide.java b/java/darkknight/jewelrycraft/container/ContainerGuide.java
index ef05cc4..53f5bb8 100644
--- a/src/main/java/darkknight/jewelrycraft/container/ContainerGuide.java
+++ b/java/darkknight/jewelrycraft/container/ContainerGuide.java
@@ -6,13 +6,16 @@ import net.minecraft.inventory.Container;
/**
* User: joel / Date: 16.12.13 / Time: 22:36
*/
-public class ContainerGuide extends Container {
-
- public ContainerGuide() {
+public class ContainerGuide extends Container
+{
+
+ public ContainerGuide()
+ {
}
-
+
@Override
- public boolean canInteractWith(EntityPlayer entityplayer) {
+ public boolean canInteractWith(EntityPlayer entityplayer)
+ {
return true;
}
} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/container/ContainerRingChest.java b/java/darkknight/jewelrycraft/container/ContainerRingChest.java
index 2728941..91bb346 100644
--- a/src/main/java/darkknight/jewelrycraft/container/ContainerRingChest.java
+++ b/java/darkknight/jewelrycraft/container/ContainerRingChest.java
@@ -22,50 +22,45 @@ public class ContainerRingChest extends Container
for (y = 0; y < 3; y++)
for (x = 0; x < 9; x++)
addSlotToContainer(new Slot(inv, x + 9 + (y * 9), 8 + (18 * x), 84 + (y * 18)));
-
+
for (y = 0; y < 3; y++)
for (x = 0; x < 9; x++)
addSlotToContainer(new SlotRingChest(chest, 26 - (x + (y * 9)), 8 + (18 * (8 - x)), 17 + ((2 - y) * 18), false));
}
+
@Override
public boolean canInteractWith(EntityPlayer player)
{
return true;
}
-
+
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack itemstack = null;
- Slot slot = (Slot)this.inventorySlots.get(par2);
-
+ Slot slot = (Slot) this.inventorySlots.get(par2);
+
if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
-
+
if (par2 < 27)
{
- if (!this.mergeItemStack(itemstack1, 27, this.inventorySlots.size(), true))
- {
- return null;
- }
- }
- else if (!this.mergeItemStack(itemstack1, 0, 27, false))
- {
- return null;
+ if (!this.mergeItemStack(itemstack1, 27, this.inventorySlots.size(), true)) { return null; }
}
-
+ else if (!this.mergeItemStack(itemstack1, 0, 27, false)) { return null; }
+
if (itemstack1.stackSize == 0)
{
- slot.putStack((ItemStack)null);
+ slot.putStack((ItemStack) null);
}
else
{
slot.onSlotChanged();
}
}
-
+
return itemstack;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/container/GuiHandler.java b/java/darkknight/jewelrycraft/container/GuiHandler.java
index 3efe71c..cd9d72e 100644
--- a/src/main/java/darkknight/jewelrycraft/container/GuiHandler.java
+++ b/java/darkknight/jewelrycraft/container/GuiHandler.java
@@ -15,26 +15,32 @@ public class GuiHandler implements IGuiHandler
{
NetworkRegistry.INSTANCE.registerGuiHandler(JewelrycraftMod.instance, this);
}
-
+
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
- {
- switch(ID)
+ {
+ switch (ID)
{
- case 0: return new ContainerRingChest(player.inventory, (TileEntityChest) world.getTileEntity(x, y, z));
- case 1: return new ContainerGuide();
- default: return null;
+ case 0:
+ return new ContainerRingChest(player.inventory, (TileEntityChest) world.getTileEntity(x, y, z));
+ case 1:
+ return new ContainerGuide();
+ default:
+ return null;
}
}
-
+
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
- {
- switch(ID)
+ {
+ switch (ID)
{
- case 0: return new GuiRingChest((ContainerRingChest) getServerGuiElement(ID, player, world, x, y, z));
- case 1: return new GuiGuide((ContainerGuide) getServerGuiElement(ID, player, world, x, y, z), world);
- default: return null;
+ case 0:
+ return new GuiRingChest((ContainerRingChest) getServerGuiElement(ID, player, world, x, y, z));
+ case 1:
+ return new GuiGuide((ContainerGuide) getServerGuiElement(ID, player, world, x, y, z), world);
+ default:
+ return null;
}
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/container/GuiRectangle.java b/java/darkknight/jewelrycraft/container/GuiRectangle.java
index 76dee04..3ecf20c 100644
--- a/src/main/java/darkknight/jewelrycraft/container/GuiRectangle.java
+++ b/java/darkknight/jewelrycraft/container/GuiRectangle.java
@@ -6,15 +6,15 @@ import net.minecraft.item.ItemStack;
import darkknight.jewelrycraft.client.GuiGuide;
-public class GuiRectangle
+public class GuiRectangle
{
-
+
private int x;
private int y;
private int w;
private int h;
- public GuiRectangle(int x, int y, int w, int h)
+ public GuiRectangle(int x, int y, int w, int h)
{
this.x = x;
this.y = y;
@@ -22,7 +22,7 @@ public class GuiRectangle
this.h = h;
}
- public boolean inRect(GuiGuide gui, int mouseX, int mouseY)
+ public boolean inRect(GuiGuide gui, int mouseX, int mouseY)
{
mouseX -= gui.getLeft();
mouseY -= gui.getTop();
@@ -30,35 +30,34 @@ public class GuiRectangle
return x <= mouseX && mouseX <= x + w && y <= mouseY && mouseY <= y + h;
}
- public void setX(int x)
+ public void setX(int x)
{
this.x = x;
}
- public void setY(int y)
+ public void setY(int y)
{
this.y = y;
}
-
- public void draw(GuiGuide gui, int srcX, int srcY)
+ public void draw(GuiGuide gui, int srcX, int srcY)
{
gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, w, h);
}
-
- public void draw(GuiGuide gui, int srcX, int srcY, int width, int height)
+ public void draw(GuiGuide gui, int srcX, int srcY, int width, int height)
{
gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, width, height);
}
- public void drawString(GuiGuide gui, int mouseX, int mouseY, String str)
+ public void drawString(GuiGuide gui, int mouseX, int mouseY, String str)
{
- if (inRect(gui, mouseX, mouseY)) {
+ if (inRect(gui, mouseX, mouseY))
+ {
gui.drawHoverString(Arrays.asList(str.split("\n")), mouseX - gui.getLeft(), mouseY - gui.getTop());
}
}
-
+
public ItemStack getIcon()
{
return null;
diff --git a/src/main/java/darkknight/jewelrycraft/container/GuiTab.java b/java/darkknight/jewelrycraft/container/GuiTab.java
index c092ba6..959fef7 100644
--- a/src/main/java/darkknight/jewelrycraft/container/GuiTab.java
+++ b/java/darkknight/jewelrycraft/container/GuiTab.java
@@ -5,30 +5,40 @@ import cpw.mods.fml.relauncher.SideOnly;
import darkknight.jewelrycraft.client.GuiGuide;
@SideOnly(Side.CLIENT)
-public abstract class GuiTab extends GuiRectangle
+public abstract class GuiTab extends GuiRectangle
{
int values, del;
private String name;
-
- public GuiTab(String name, int id)
+
+ public GuiTab(String name, int id)
{
- super(-62, 10 + 19*id, 19, 18);
+ super(-62, 10 + 19 * id, 19, 18);
this.name = name;
values = 0;
del = 0;
}
- public String getName()
+ public String getName()
{
return name;
}
public abstract void drawBackground(GuiGuide gui, int x, int y, int page);
+
public abstract void drawForeground(GuiGuide gui, int x, int y, int page);
- public void mouseClick(GuiGuide gui, int x, int y, int button) {}
- public void mouseMoveClick(GuiGuide gui, int x, int y, int button, long timeSinceClicked) {}
- public void mouseReleased(GuiGuide gui, int x, int y, int button) {}
-
+
+ public void mouseClick(GuiGuide gui, int x, int y, int button)
+ {
+ }
+
+ public void mouseMoveClick(GuiGuide gui, int x, int y, int button, long timeSinceClicked)
+ {
+ }
+
+ public void mouseReleased(GuiGuide gui, int x, int y, int button)
+ {
+ }
+
public int getMaxPages()
{
return 1;
diff --git a/src/main/java/darkknight/jewelrycraft/container/GuiTabBlocks.java b/java/darkknight/jewelrycraft/container/GuiTabBlocks.java
index 9627cf1..507808b 100644
--- a/src/main/java/darkknight/jewelrycraft/container/GuiTabBlocks.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabBlocks.java
@@ -12,26 +12,26 @@ import darkknight.jewelrycraft.item.ItemList;
public class GuiTabBlocks extends GuiTab
{
-
+
public GuiTabBlocks(int id)
{
super("Blocks", id);
}
-
+
public ItemStack getIcon()
- {
+ {
return new ItemStack(BlockList.jewelAltar);
}
-
+
@Override
public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
+ {
ArrayList<String> text = new ArrayList<String>();
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
- int xPos = (page%2==0)?107:-35;
- switch(page)
- {
- case 1:
+ int xPos = (page % 2 == 0) ? 107 : -35;
+ switch (page)
+ {
+ case 1:
text.add(" This ore is extremely");
text.add("rare and can be found");
text.add("only between Y level 5");
@@ -40,7 +40,7 @@ public class GuiTabBlocks extends GuiTab
text.add("pickaxe.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(BlockList.shadowOre), text, 90f);
break;
- case 2:
+ case 2:
text.add(" The Shadow Block is");
text.add("crafted using 9 shadow");
text.add("ingots. It has been");
@@ -49,10 +49,11 @@ public class GuiTabBlocks extends GuiTab
text.add("properties in the");
text.add("shadow. The darker it");
items.add(new ItemStack(BlockList.shadowBlock));
- for(int i = 1; i <= 9; i++) items.add(new ItemStack(ItemList.shadowIngot));
+ for (int i = 1; i <= 9; i++)
+ items.add(new ItemStack(ItemList.shadowIngot));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 3:
+ case 3:
text.add("is, the more");
text.add("transparent it will be,");
text.add("until it becomes");
@@ -64,7 +65,7 @@ public class GuiTabBlocks extends GuiTab
text.add("darkness it is in.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 4:
+ case 4:
text.add(" The smelter is one of");
text.add("the first blocks needed");
text.add("to get started with");
@@ -84,7 +85,7 @@ public class GuiTabBlocks extends GuiTab
items.add(new ItemStack(Blocks.cobblestone));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 5:
+ case 5:
text.add("block as it can melt");
text.add("ingots which can be");
text.add("made into pieces of");
@@ -99,7 +100,7 @@ public class GuiTabBlocks extends GuiTab
text.add("percentage it is done.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 6:
+ case 6:
text.add("If left clicked when");
text.add("it's done smelting,");
text.add("a message will be");
@@ -108,7 +109,7 @@ public class GuiTabBlocks extends GuiTab
text.add("block.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 7:
+ case 7:
text.add(" The molder is a key");
text.add("piece in creating");
text.add("jewellery. You need");
@@ -121,10 +122,11 @@ public class GuiTabBlocks extends GuiTab
items.add(new ItemStack(Blocks.cobblestone));
items.add(null);
items.add(new ItemStack(Blocks.cobblestone));
- for(int i = 1; i <= 3; i++) items.add(new ItemStack(Blocks.cobblestone));
+ for (int i = 1; i <= 3; i++)
+ items.add(new ItemStack(Blocks.cobblestone));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 8:
+ case 8:
text.add("molder. But before");
text.add("pouring the molten");
text.add("metal in it, you must");
@@ -139,7 +141,7 @@ public class GuiTabBlocks extends GuiTab
text.add("an empty hand.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 9:
+ case 9:
text.add(" Once you have a mold");
text.add("inside, left click on");
text.add("the smelter and wait");
@@ -154,7 +156,7 @@ public class GuiTabBlocks extends GuiTab
text.add(EnumChatFormatting.DARK_RED + "otherwise it won't work!");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 10:
+ case 10:
text.add(" Your jewellery on");
text.add("their own don't do");
text.add("much. They need to be");
@@ -162,12 +164,13 @@ public class GuiTabBlocks extends GuiTab
text.add("only way to do that is");
text.add("by using this block.");
text.add("Simply right click the");
- if(del == 0) values++;
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values >= 4) values = 0;
+ if (del >= 300) del = 0;
+ if (values >= 4) values = 0;
items.add(new ItemStack(BlockList.jewelCraftingTable));
- for(int i = 1; i <= 3; i++)items.add(new ItemStack(Blocks.planks, 1, values));
+ for (int i = 1; i <= 3; i++)
+ items.add(new ItemStack(Blocks.planks, 1, values));
items.add(new ItemStack(Blocks.cobblestone));
items.add(null);
items.add(new ItemStack(Blocks.cobblestone));
@@ -176,7 +179,7 @@ public class GuiTabBlocks extends GuiTab
items.add(new ItemStack(Blocks.cobblestone));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 11:
+ case 11:
text.add("block while holding the");
text.add("jewellery to place it in.");
text.add("After that just add in");
@@ -191,7 +194,7 @@ public class GuiTabBlocks extends GuiTab
text.add("you wish to know how");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 12:
+ case 12:
text.add("much is left before the");
text.add("transformation is done,");
text.add("simply left click on the");
@@ -202,7 +205,7 @@ public class GuiTabBlocks extends GuiTab
text.add("tab.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 13:
+ case 13:
text.add(" This block can store");
text.add("any jewellery in it");
text.add("and activate their");
@@ -222,7 +225,7 @@ public class GuiTabBlocks extends GuiTab
items.add(new ItemStack(Blocks.nether_brick));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 14:
+ case 14:
text.add("find out which jewellery");
text.add("works by looking in");
text.add("their apropriate tab.");
@@ -233,7 +236,7 @@ public class GuiTabBlocks extends GuiTab
text.add("block.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 15:
+ case 15:
text.add(" The Storage");
text.add("Displayer, as the");
text.add("name suggests, can");
@@ -253,7 +256,7 @@ public class GuiTabBlocks extends GuiTab
items.add(new ItemStack(Blocks.emerald_block));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 16:
+ case 16:
text.add("infromation about the");
text.add("object in it, such as");
text.add("the name, durability,");
@@ -268,7 +271,7 @@ public class GuiTabBlocks extends GuiTab
text.add("or blocks will be");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 17:
+ case 17:
text.add("immediately stored");
text.add("inside. To retrieve");
text.add("a single item just");
@@ -278,18 +281,19 @@ public class GuiTabBlocks extends GuiTab
text.add("crouch and left click.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- default:;
+ default:
+ ;
}
}
-
+
public int getMaxPages()
{
return 17;
}
-
+
@Override
public void drawForeground(GuiGuide gui, int x, int y, int page)
- {
+ {
}
-
+
}
diff --git a/src/main/java/darkknight/jewelrycraft/container/GuiTabItems.java b/java/darkknight/jewelrycraft/container/GuiTabItems.java
index a4ea44e..60d4fb6 100644
--- a/src/main/java/darkknight/jewelrycraft/container/GuiTabItems.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabItems.java
@@ -14,26 +14,26 @@ import darkknight.jewelrycraft.item.ItemList;
public class GuiTabItems extends GuiTab
{
-
+
public GuiTabItems(int id)
{
super("Items", id);
}
-
+
public ItemStack getIcon()
- {
+ {
return new ItemStack(ItemList.thiefGloves);
}
-
+
@Override
public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
+ {
ArrayList<String> text = new ArrayList<String>();
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
- int xPos = (page%2==0)?107:-35;
- switch(page)
- {
- case 1:
+ int xPos = (page % 2 == 0) ? 107 : -35;
+ switch (page)
+ {
+ case 1:
text.add(" Shadow ingots are");
text.add("obtained by smelting");
text.add("shadow ore. They are");
@@ -45,7 +45,7 @@ public class GuiTabItems extends GuiTab
items.add(new ItemStack(ItemList.shadowIngot));
Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y);
break;
- case 2:
+ case 2:
text.add(" These gloves allow");
text.add("you to steal the trades");
text.add("the pesky Testificates");
@@ -65,7 +65,7 @@ public class GuiTabItems extends GuiTab
items.add(new ItemStack(Blocks.wool, 1, 15));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 3:
+ case 3:
text.add("right click on the them");
text.add("to steal the trades.");
text.add("A villager has 7 of the");
@@ -80,14 +80,14 @@ public class GuiTabItems extends GuiTab
text.add("then he will have that");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 4:
+ case 4:
text.add("many times less of the");
text.add("item. This has a maximum");
text.add("of 10 uses before it");
text.add("breaks.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 5:
+ case 5:
text.add(" In order to get the");
text.add("ingot back from the");
text.add("smelter you need a");
@@ -101,7 +101,7 @@ public class GuiTabItems extends GuiTab
items.add(new ItemStack(Items.clay_ball));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y);
break;
- case 6:
+ case 6:
text.add(" By smelting the clay_ball");
text.add("mold you get a harder");
text.add("version which can be");
@@ -114,7 +114,7 @@ public class GuiTabItems extends GuiTab
items.add(new ItemStack(ItemList.molds, 1, 0));
Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y);
break;
- case 7:
+ case 7:
text.add(" In order to create a");
text.add("ring you need a mold");
text.add("for it. However, this");
@@ -134,7 +134,7 @@ public class GuiTabItems extends GuiTab
items.add(null);
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 8:
+ case 8:
text.add(" By smelting the clay_ball");
text.add("mold you get a harder");
text.add("version which can be");
@@ -147,7 +147,7 @@ public class GuiTabItems extends GuiTab
items.add(new ItemStack(ItemList.molds, 1, 1));
Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y);
break;
- case 9:
+ case 9:
text.add(" In order to create a");
text.add("necklace you need a");
text.add("mold for it. However,");
@@ -161,13 +161,13 @@ public class GuiTabItems extends GuiTab
items.add(new ItemStack(Items.clay_ball));
items.add(new ItemStack(Items.clay_ball));
items.add(null);
- items.add(new ItemStack(Items.clay_ball));
+ items.add(new ItemStack(Items.clay_ball));
items.add(null);
items.add(new ItemStack(Items.clay_ball));
items.add(null);
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 10:
+ case 10:
text.add(" By smelting the clay_ball");
text.add("mold you get a harder");
text.add("version which can be");
@@ -180,7 +180,7 @@ public class GuiTabItems extends GuiTab
items.add(new ItemStack(ItemList.molds, 1, 2));
Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y);
break;
- case 11:
+ case 11:
text.add(" Crystals don't do");
text.add("much. They can be dyed");
text.add("in any color and used");
@@ -198,11 +198,11 @@ public class GuiTabItems extends GuiTab
items.add(null);
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y);
break;
- case 12:
- if(del == 0) values++;
+ case 12:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values >= 15) values = 0;
+ if (del >= 300) del = 0;
+ if (values >= 15) values = 0;
items.add(new ItemStack(ItemList.crystal, 1, values));
items.add(new ItemStack(Items.dye, 1, values));
items.add(new ItemStack(ItemList.crystal, 1, 15));
@@ -213,11 +213,11 @@ public class GuiTabItems extends GuiTab
items.add(new ItemStack(ItemList.crystal, 1, values));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop() + 60, true, text, items, x, y);
break;
- case 13:
- if(del == 0) values++;
+ case 13:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values >= 3) values = 0;
+ if (del >= 300) del = 0;
+ if (values >= 3) values = 0;
text.add(" It's this exact guide.");
text.add("I don't even know why");
text.add("you're reading this.");
@@ -231,9 +231,9 @@ public class GuiTabItems extends GuiTab
items.add(new ItemStack(Items.book));
Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y);
break;
- case 14:
+ case 14:
String link = "HERE";
- if(x >= gui.getLeft() + 138 && x <= gui.getLeft() + 168 && y >= gui.getTop() + 98 && y <= gui.getTop() + 108) link = EnumChatFormatting.DARK_BLUE + "HERE" + EnumChatFormatting.BLACK;
+ if (x >= gui.getLeft() + 138 && x <= gui.getLeft() + 168 && y >= gui.getTop() + 98 && y <= gui.getTop() + 108) link = EnumChatFormatting.DARK_BLUE + "HERE" + EnumChatFormatting.BLACK;
text.add("see all the recipes.");
text.add("Since you are reading");
text.add("this, how about making");
@@ -249,30 +249,33 @@ public class GuiTabItems extends GuiTab
text.add("you got this)");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- default:;
+ default:
+ ;
}
}
-
+
public int getMaxPages()
{
return 13;
}
-
- public void mouseClick(GuiGuide gui, int x, int y, int button)
+
+ public void mouseClick(GuiGuide gui, int x, int y, int button)
{
- if(gui.page == 13 && x >= gui.getLeft() + 138 && x <= gui.getLeft() + 168 && y >= gui.getTop() + 98 && y <= gui.getTop() + 108)
+ if (gui.page == 13 && x >= gui.getLeft() + 138 && x <= gui.getLeft() + 168 && y >= gui.getTop() + 98 && y <= gui.getTop() + 108)
{
- try
+ try
{
Desktop.getDesktop().browse(new URL("http://www.minecraftforum.net/topic/2210959-164smp-ssp-jewelrycraft-version-12/").toURI());
- }
- catch (Exception e) {}
+ }
+ catch (Exception e)
+ {
+ }
}
}
-
+
@Override
public void drawForeground(GuiGuide gui, int x, int y, int page)
- {
+ {
}
-
+
}
diff --git a/java/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java b/java/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java
new file mode 100644
index 0000000..d7f552d
--- /dev/null
+++ b/java/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java
@@ -0,0 +1,70 @@
+package darkknight.jewelrycraft.container;
+
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import org.lwjgl.opengl.GL11;
+
+import darkknight.jewelrycraft.client.GuiGuide;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+public class GuiTabJewelsAndModifiers extends GuiTab
+{
+ public GuiTabJewelsAndModifiers(int id)
+ {
+ super("Jewels, modifiers and ingots", id);
+ }
+
+ public ItemStack getIcon()
+ {
+ return new ItemStack(Items.emerald);
+ }
+
+ @Override
+ public void drawBackground(GuiGuide gui, int x, int y, int page)
+ {
+ int xPos = (page % 2 == 0) ? 107 : -35;
+ for (int i = (page - 1) * 9; i < page * 9; i++)
+ if (i < JewelrycraftUtil.jewel.size())
+ {
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Jewels", gui.getLeft() + xPos + 40, gui.getTop(), 0);
+ gui.renderItem(JewelrycraftUtil.jewel.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f);
+ gui.getFont().drawString(JewelrycraftUtil.jewel.get(i).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16 * (i - 9 * (page - 1)), 0);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ }
+ page -= (JewelrycraftUtil.jewel.size() / 9 + 1);
+ for (int i = (page - 1) * 9; i < page * 9; i++)
+ {
+ if (i < JewelrycraftUtil.modifiers.size() && page > 0)
+ {
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Modifiers", gui.getLeft() + xPos + 40, gui.getTop(), 0);
+ gui.renderItem(JewelrycraftUtil.modifiers.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f);
+ gui.getFont().drawString(JewelrycraftUtil.modifiers.get(i).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16 * (i - 9 * (page - 1)), 0);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ }
+ }
+ page -= (JewelrycraftUtil.modifiers.size() / 9 + 1);
+ for (int i = (page - 1) * 9; i < page * 9; i++)
+ {
+ if (i < JewelrycraftUtil.metal.size() && page > 0)
+ {
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Ingots", gui.getLeft() + xPos + 40, gui.getTop(), 0);
+ gui.renderItem(JewelrycraftUtil.metal.get(i).copy(), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f);
+ gui.getFont().drawString(JewelrycraftUtil.metal.get(i).copy().getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16 * (i - 9 * (page - 1)), 0);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ }
+ }
+ }
+
+ public int getMaxPages()
+ {
+ return JewelrycraftUtil.jewel.size() / 9 + JewelrycraftUtil.modifiers.size() / 9 + JewelrycraftUtil.metal.size() / 9 + 2;
+ }
+
+ @Override
+ public void drawForeground(GuiGuide gui, int x, int y, int page)
+ {
+ }
+
+}
diff --git a/src/main/java/darkknight/jewelrycraft/container/GuiTabNecklaces.java b/java/darkknight/jewelrycraft/container/GuiTabNecklaces.java
index 4271928..08e93c9 100644
--- a/src/main/java/darkknight/jewelrycraft/container/GuiTabNecklaces.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabNecklaces.java
@@ -15,6 +15,7 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class GuiTabNecklaces extends GuiTab
{
int jValues;
+
public GuiTabNecklaces(int id)
{
super("Necklaces", id);
@@ -22,31 +23,31 @@ public class GuiTabNecklaces extends GuiTab
}
public ItemStack getIcon()
- {
+ {
ItemStack it = new ItemStack(ItemList.necklace);
JewelryNBT.addMetal(it, new ItemStack(Items.iron_ingot));
- JewelryNBT.addJewel(it, new ItemStack(Blocks.redstone_block));
+ JewelryNBT.addJewel(it, new ItemStack(Blocks.redstone_block));
return it;
}
-
+
@Override
public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
+ {
ArrayList<String> text = new ArrayList<String>();
ArrayList<ItemStack> jewels = new ArrayList<ItemStack>();
ItemStack item = new ItemStack(ItemList.necklace);
- int xPos = (page%2==0)?107:-35;
- switch(page)
- {
- case 1:
- if(del == 0) values++;
+ int xPos = (page % 2 == 0) ? 107 : -35;
+ switch (page)
+ {
+ case 1:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, new ItemStack(Items.ender_pearl));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Ender Pearl");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "None");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -60,7 +61,7 @@ public class GuiTabNecklaces extends GuiTab
text.add("click any time you want");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 2:
+ case 2:
text.add("to teleport there.");
text.add(EnumChatFormatting.DARK_RED + "\u00a7nAltar Effect");
text.add(" This teleports anyone");
@@ -72,16 +73,16 @@ public class GuiTabNecklaces extends GuiTab
text.add("dimension.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 3:
- if(del == 0) values++;
+ case 3:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, new ItemStack(Items.ender_pearl));
JewelryNBT.addModifier(item, new ItemStack(Items.bed));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Ender Pearl");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Bed");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -95,7 +96,7 @@ public class GuiTabNecklaces extends GuiTab
text.add("dimensions with this.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 4:
+ case 4:
text.add(EnumChatFormatting.DARK_RED + "\u00a7nAltar Effect");
text.add(" This teleports anyone");
text.add("or anything that step");
@@ -107,22 +108,26 @@ public class GuiTabNecklaces extends GuiTab
text.add("travels.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 5:
+ case 5:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.blaze_powder));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Blaze Powder");
@@ -136,7 +141,7 @@ public class GuiTabNecklaces extends GuiTab
text.add("right click with it.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 6:
+ case 6:
text.add("Depending on the jewel");
text.add("used, you and the");
text.add("others get " + EnumChatFormatting.DARK_RED + "Fire");
@@ -147,22 +152,26 @@ public class GuiTabNecklaces extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 7:
+ case 7:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.sugar));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Sugar");
@@ -176,7 +185,7 @@ public class GuiTabNecklaces extends GuiTab
text.add("right click with it.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 8:
+ case 8:
text.add("Depending on the jewel");
text.add("used, you and the");
text.add("others get " + EnumChatFormatting.DARK_RED + "Speed" + EnumChatFormatting.BLACK + " I");
@@ -186,22 +195,26 @@ public class GuiTabNecklaces extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 9:
+ case 9:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.iron_pickaxe));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Iron Pickaxe");
@@ -215,7 +228,7 @@ public class GuiTabNecklaces extends GuiTab
text.add("right click with it.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 10:
+ case 10:
text.add("Depending on the jewel");
text.add("used, you and the");
text.add("others get " + EnumChatFormatting.DARK_RED + "Haste" + EnumChatFormatting.BLACK + " I");
@@ -225,22 +238,26 @@ public class GuiTabNecklaces extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 11:
+ case 11:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.feather));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Feather");
@@ -254,7 +271,7 @@ public class GuiTabNecklaces extends GuiTab
text.add("right click with it.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 12:
+ case 12:
text.add("Depending on the jewel");
text.add("used, you and the");
text.add("others get " + EnumChatFormatting.DARK_RED + "Jump Boost");
@@ -264,22 +281,26 @@ public class GuiTabNecklaces extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 13:
+ case 13:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.potionitem, 1, 8270));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "8min Potion of");
@@ -293,7 +314,7 @@ public class GuiTabNecklaces extends GuiTab
text.add("deactivate it simply");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 14:
+ case 14:
text.add("right click with it.");
text.add("Depending on the jewel");
text.add("used, you and the");
@@ -304,22 +325,26 @@ public class GuiTabNecklaces extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 15:
+ case 15:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0){values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.dye, 1, 15));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Bone Meal");
@@ -333,7 +358,7 @@ public class GuiTabNecklaces extends GuiTab
text.add("The are it affects is");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 16:
+ case 16:
text.add("determined by the jewel");
text.add("used. For none, the");
text.add("area is a block, diamond");
@@ -348,11 +373,11 @@ public class GuiTabNecklaces extends GuiTab
text.add("7x3x7 area.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 17:
+ case 17:
JewelryNBT.addMetal(item, new ItemStack(ItemList.shadowIngot));
JewelryNBT.addJewel(item, new ItemStack(Items.nether_star));
JewelryNBT.addModifier(item, new ItemStack(Items.diamond_pickaxe));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Diamond Pick");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Shadow Ingot");
@@ -363,18 +388,19 @@ public class GuiTabNecklaces extends GuiTab
text.add("begin.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- default:;
+ default:
+ ;
}
}
-
+
public int getMaxPages()
{
return 17;
}
-
+
@Override
public void drawForeground(GuiGuide gui, int x, int y, int page)
- {
+ {
}
-
+
}
diff --git a/src/main/java/darkknight/jewelrycraft/container/GuiTabRings.java b/java/darkknight/jewelrycraft/container/GuiTabRings.java
index 646a78b..5a924f0 100644
--- a/src/main/java/darkknight/jewelrycraft/container/GuiTabRings.java
+++ b/java/darkknight/jewelrycraft/container/GuiTabRings.java
@@ -14,6 +14,7 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class GuiTabRings extends GuiTab
{
int jValues;
+
public GuiTabRings(int id)
{
super("Rings", id);
@@ -21,31 +22,31 @@ public class GuiTabRings extends GuiTab
}
public ItemStack getIcon()
- {
+ {
ItemStack it = new ItemStack(ItemList.ring);
JewelryNBT.addMetal(it, new ItemStack(Items.gold_ingot));
- JewelryNBT.addJewel(it, new ItemStack(Items.ender_pearl));
+ JewelryNBT.addJewel(it, new ItemStack(Items.ender_pearl));
return it;
}
-
+
@Override
public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
+ {
ArrayList<String> text = new ArrayList<String>();
ArrayList<ItemStack> jewels = new ArrayList<ItemStack>();
ItemStack item = new ItemStack(ItemList.ring);
- int xPos = (page%2==0)?107:-35;
- switch(page)
- {
- case 1:
- if(del == 0) values++;
+ int xPos = (page % 2 == 0) ? 107 : -35;
+ switch (page)
+ {
+ case 1:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, new ItemStack(Items.ender_pearl));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Ender Pearl");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "None");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -59,7 +60,7 @@ public class GuiTabRings extends GuiTab
text.add("want to teleport there.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 2:
+ case 2:
text.add(EnumChatFormatting.DARK_RED + "\u00a7nAltar Effect");
text.add(" If this ring is placed");
text.add("in the altar and if the");
@@ -74,16 +75,16 @@ public class GuiTabRings extends GuiTab
text.add("well, not just players.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 3:
- if(del == 0) values++;
+ case 3:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, new ItemStack(Items.ender_pearl));
JewelryNBT.addModifier(item, new ItemStack(Items.bed));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Ender Pearl");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Bed");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -96,7 +97,7 @@ public class GuiTabRings extends GuiTab
text.add("dimensions.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 4:
+ case 4:
text.add(EnumChatFormatting.DARK_RED + "\u00a7nAltar Effect");
text.add(" Just like the other");
text.add("one, when in the altar");
@@ -111,22 +112,26 @@ public class GuiTabRings extends GuiTab
text.add("well.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 5:
+ case 5:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.blaze_powder));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Blaze Powder");
@@ -140,7 +145,7 @@ public class GuiTabRings extends GuiTab
text.add("jewel you used, you");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 6:
+ case 6:
text.add("get " + EnumChatFormatting.DARK_RED + "Fire Resistance" + EnumChatFormatting.BLACK + " I");
text.add("if you haven't got any");
text.add("jewel, II for Diamond,");
@@ -148,22 +153,26 @@ public class GuiTabRings extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 7:
+ case 7:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.sugar));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Sugar");
@@ -177,7 +186,7 @@ public class GuiTabRings extends GuiTab
text.add("jewel you used, you");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 8:
+ case 8:
text.add("get " + EnumChatFormatting.DARK_RED + "Speed" + EnumChatFormatting.BLACK + " I if you");
text.add("haven't got any jewel,");
text.add("II for Diamond,");
@@ -185,22 +194,26 @@ public class GuiTabRings extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 9:
+ case 9:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.iron_pickaxe));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Iron Pickaxe");
@@ -214,7 +227,7 @@ public class GuiTabRings extends GuiTab
text.add("jewel you used, you");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 10:
+ case 10:
text.add("get " + EnumChatFormatting.DARK_RED + "Haste" + EnumChatFormatting.BLACK + " I if you");
text.add("haven't got any jewel,");
text.add("II for Diamond,");
@@ -222,22 +235,26 @@ public class GuiTabRings extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 11:
+ case 11:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.feather));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Feather");
@@ -251,7 +268,7 @@ public class GuiTabRings extends GuiTab
text.add("right click with it.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 12:
+ case 12:
text.add("Depending on the jewel");
text.add("you used, you get");
text.add(EnumChatFormatting.DARK_RED + "Jump Boost" + EnumChatFormatting.BLACK + " I if you");
@@ -261,22 +278,26 @@ public class GuiTabRings extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 13:
+ case 13:
jewels.add(null);
jewels.add(new ItemStack(Items.diamond));
jewels.add(new ItemStack(Items.emerald));
jewels.add(new ItemStack(Items.nether_star));
- if(del == 0) { values++; jValues++;}
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > jewels.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > jewels.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, jewels.get(jValues));
JewelryNBT.addModifier(item, new ItemStack(Items.potionitem, 1, 8270));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "None, Diamond");
text.add("Emerald or Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "8min Potion of");
@@ -290,7 +311,7 @@ public class GuiTabRings extends GuiTab
text.add("To deactivate it simply");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 14:
+ case 14:
text.add("right click with it.");
text.add("Depending on the jewel");
text.add("you used, you get");
@@ -301,16 +322,16 @@ public class GuiTabRings extends GuiTab
text.add("VIII for Nether Star.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 15:
- if(del == 0) values++;
+ case 15:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, new ItemStack(Items.nether_star));
JewelryNBT.addModifier(item, new ItemStack(Items.book));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Book");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -324,7 +345,7 @@ public class GuiTabRings extends GuiTab
text.add("when it is being held.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 16:
+ case 16:
text.add(EnumChatFormatting.DARK_PURPLE + "\u00a7nDisenchanting" + EnumChatFormatting.BLACK + "");
text.add(" If the ring is held");
text.add("and an enchanted item");
@@ -339,7 +360,7 @@ public class GuiTabRings extends GuiTab
text.add("however, because if");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 17:
+ case 17:
text.add("there is no room in");
text.add("your inventory for the");
text.add("books, the enchantments");
@@ -354,7 +375,7 @@ public class GuiTabRings extends GuiTab
text.add("damage the item a bit.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 18:
+ case 18:
text.add(EnumChatFormatting.DARK_PURPLE + "\u00a7nEnchanting" + EnumChatFormatting.BLACK + "");
text.add(" This mode allows you");
text.add("to give a random");
@@ -369,7 +390,7 @@ public class GuiTabRings extends GuiTab
text.add("The higher the number");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 19:
+ case 19:
text.add("the better, as the level");
text.add("of the enchantment will");
text.add("be equal with the amount");
@@ -382,7 +403,7 @@ public class GuiTabRings extends GuiTab
text.add("limit normally).");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 20:
+ case 20:
text.add(EnumChatFormatting.DARK_PURPLE + "\u00a7nEnchantment Transfer" + EnumChatFormatting.BLACK + "");
text.add(" This mode is very");
text.add("special as it lets you");
@@ -397,7 +418,7 @@ public class GuiTabRings extends GuiTab
text.add("the ring, the item you");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 21:
+ case 21:
text.add("want to transfer the");
text.add("enchs to. The ring can");
text.add("only transfer an ench");
@@ -410,16 +431,16 @@ public class GuiTabRings extends GuiTab
text.add(EnumChatFormatting.DARK_RED + "being held!");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 22:
- if(del == 0) values++;
+ case 22:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, new ItemStack(Items.ender_pearl));
JewelryNBT.addModifier(item, new ItemStack(Blocks.chest));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Ender Pearl");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Chest");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -433,7 +454,7 @@ public class GuiTabRings extends GuiTab
text.add("to open that inventory.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 23:
+ case 23:
text.add("This only works if you");
text.add("are in range to the");
text.add("chest. You can go");
@@ -448,16 +469,16 @@ public class GuiTabRings extends GuiTab
text.add("again.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 24:
- if(del == 0) values++;
+ case 24:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, new ItemStack(Blocks.obsidian));
JewelryNBT.addModifier(item, new ItemStack(Items.ender_eye));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Obsidian");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Eye of Ender");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -468,16 +489,16 @@ public class GuiTabRings extends GuiTab
text.add("ender chest gui.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 25:
- if(del == 0) values++;
+ case 25:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, new ItemStack(Items.nether_star));
JewelryNBT.addModifier(item, new ItemStack(Blocks.chest));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Chest");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -491,23 +512,27 @@ public class GuiTabRings extends GuiTab
text.add("such as villagers).");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 26:
+ case 26:
text.add("Right click again on the");
text.add("ground to release the");
text.add("entity in that spot.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 27:
- if(del == 0){values++; jValues++;}
+ case 27:
+ if (del == 0)
+ {
+ values++;
+ jValues++;
+ }
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
- if(jValues > JewelrycraftUtil.jewel.size() - 1) jValues = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
- JewelryNBT.addJewel(item, JewelrycraftUtil.jewel.get(jValues));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+ if (jValues > JewelrycraftUtil.jewel.size() - 1) jValues = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
+ JewelryNBT.addJewel(item, JewelrycraftUtil.jewel.get(jValues).copy());
JewelryNBT.addModifier(item, new ItemStack(Items.dye, 1, 15));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Any");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Bone Meal");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -521,7 +546,7 @@ public class GuiTabRings extends GuiTab
text.add("bit. Better keep right");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 28:
+ case 28:
text.add("clicking if you want to");
text.add("see an actual effect.");
text.add(EnumChatFormatting.DARK_RED + "\u00a7nAltar Effect");
@@ -533,16 +558,16 @@ public class GuiTabRings extends GuiTab
text.add("3x3x3 area.");
Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text);
break;
- case 29:
- if(del == 0) values++;
+ case 29:
+ if (del == 0) values++;
del++;
- if(del >= 300) del = 0;
- if(values > JewelrycraftUtil.metal.size() - 1) values = 0;
-
- JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values));
+ if (del >= 300) del = 0;
+ if (values > JewelrycraftUtil.metal.size() - 1) values = 0;
+
+ JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy());
JewelryNBT.addJewel(item, new ItemStack(Items.ender_pearl));
JewelryNBT.addModifier(item, new ItemStack(Items.diamond_pickaxe));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Ender Pearl");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Diamond Pick");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Any");
@@ -556,11 +581,11 @@ public class GuiTabRings extends GuiTab
text.add("create golems/withers.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- case 30:
+ case 30:
JewelryNBT.addMetal(item, new ItemStack(ItemList.shadowIngot));
JewelryNBT.addJewel(item, new ItemStack(Items.nether_star));
JewelryNBT.addModifier(item, new ItemStack(Items.diamond_pickaxe));
-
+
text.add(EnumChatFormatting.DARK_GREEN + "Jewel: " + EnumChatFormatting.BLACK + "Nether Star");
text.add(EnumChatFormatting.DARK_GREEN + "Modifier: " + EnumChatFormatting.BLACK + "Diamond Pick");
text.add(EnumChatFormatting.DARK_GREEN + "Ingot: " + EnumChatFormatting.BLACK + "Shadow Ingot");
@@ -570,18 +595,19 @@ public class GuiTabRings extends GuiTab
text.add("break instantly.");
Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10, false, 45, 0);
break;
- default:;
+ default:
+ ;
}
}
-
+
public int getMaxPages()
{
return 30;
}
-
+
@Override
public void drawForeground(GuiGuide gui, int x, int y, int page)
- {
+ {
}
-
+
}
diff --git a/src/main/java/darkknight/jewelrycraft/container/Page.java b/java/darkknight/jewelrycraft/container/Page.java
index da12663..77a0fa2 100644
--- a/src/main/java/darkknight/jewelrycraft/container/Page.java
+++ b/java/darkknight/jewelrycraft/container/Page.java
@@ -11,162 +11,183 @@ import net.minecraft.util.ResourceLocation;
import darkknight.jewelrycraft.client.GuiGuide;
public class Page
-{
+{
public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, ArrayList<String> text, ArrayList<ItemStack> items, int mouseX, int mouseY)
{
- y+=5;
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items.get(0).getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items.get(0).getDisplayName())/2) - 10, y - 2, 0);
+ y += 5;
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items.get(0).getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items.get(0).getDisplayName()) / 2) - 10, y - 2, 0);
GL11.glColor4f(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png"));
ArrayList<String> name = new ArrayList<String>();
- if(isSmall){
+ if (isSmall)
+ {
gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, 46);
gui.renderItem(items.get(0), x + 89, y + 22 + 10, 30f);
-// gui.drawRect(x, y + 10, x + 111, y + 46, 325325);
- if(items.size() > 1 && items.get(1) != null){
+ // gui.drawRect(x, y + 10, x + 111, y + 46, 325325);
+ if (items.size() > 1 && items.get(1) != null)
+ {
gui.renderItem(items.get(1), x + 8, y + 16 + 10, 30f);
- if(x - gui.getLeft() >= x + 8) gui.drawHoverString(text, x, y);
+ if (x - gui.getLeft() >= x + 8) gui.drawHoverString(text, x, y);
name.add(items.get(1).getDisplayName());
- if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x - 8, y + 10);
+ if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x - 8, y + 10);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 2 && items.get(2) != null){
+ if (items.size() > 2 && items.get(2) != null)
+ {
gui.renderItem(items.get(2), x + 30, y + 16 + 10, 30f);
name.add(items.get(2).getDisplayName());
- if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 15, y + 10);
+ if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 15, y + 10);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 3 && items.get(3) != null){
+ if (items.size() > 3 && items.get(3) != null)
+ {
gui.renderItem(items.get(3), x + 8, y + 40 + 10, 30f);
name.add(items.get(3).getDisplayName());
- if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x - 8, y + 35);
+ if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x - 8, y + 35);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 4 && items.get(4) != null){
+ if (items.size() > 4 && items.get(4) != null)
+ {
gui.renderItem(items.get(4), x + 30, y + 40 + 10, 30f);
name.add(items.get(4).getDisplayName());
- if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x + 15, y + 35);
+ if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x + 15, y + 35);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 55 + i*12, 0);
+ for (int i = 0; i < text.size(); i++)
+ gui.getFont().drawString(text.get(i), x, y + 55 + i * 12, 0);
}
- else{
+ else
+ {
gui.drawTexturedModalRect(x, y + 10, 145, 0, 111, 54);
gui.renderItem(items.get(0), x + 91, y + 28 + 10, 30f);
- if(items.size() > 1 && items.get(1) != null){
+ if (items.size() > 1 && items.get(1) != null)
+ {
gui.renderItem(items.get(1), x + 8, y + 20, 30f);
name.add(items.get(1).getDisplayName());
- if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 8, y + 10);
+ if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 8, y + 10);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 2 && items.get(2) != null){
+ if (items.size() > 2 && items.get(2) != null)
+ {
gui.renderItem(items.get(2), x + 28, y + 20, 30f);
name.add(items.get(2).getDisplayName());
- if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 28, y + 10);
+ if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 28, y + 10);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 3 && items.get(3) != null){
+ if (items.size() > 3 && items.get(3) != null)
+ {
gui.renderItem(items.get(3), x + 45, y + 20, 30f);
name.add(items.get(3).getDisplayName());
- if(mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 45, y + 10);
+ if (mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 45, y + 10);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 4 && items.get(4) != null){
+ if (items.size() > 4 && items.get(4) != null)
+ {
gui.renderItem(items.get(4), x + 8, y + 37, 30f);
name.add(items.get(4).getDisplayName());
- if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 8, y + 27);
+ if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 8, y + 27);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 5 && items.get(5) != null){
+ if (items.size() > 5 && items.get(5) != null)
+ {
gui.renderItem(items.get(5), x + 28, y + 37, 30f);
name.add(items.get(5).getDisplayName());
- if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 28, y + 27);
+ if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 28, y + 27);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 6 && items.get(6) != null){
+ if (items.size() > 6 && items.get(6) != null)
+ {
gui.renderItem(items.get(6), x + 45, y + 37, 30f);
name.add(items.get(6).getDisplayName());
- if(mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 45, y + 27);
+ if (mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 45, y + 27);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 7 && items.get(7) != null){
+ if (items.size() > 7 && items.get(7) != null)
+ {
gui.renderItem(items.get(7), x + 8, y + 57, 30f);
name.add(items.get(7).getDisplayName());
- if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 47 && mouseY <= y + 47 + 16) gui.drawHoverString(name, x + 8, y + 47);
+ if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 47 && mouseY <= y + 47 + 16) gui.drawHoverString(name, x + 8, y + 47);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 8 && items.get(8) != null){
+ if (items.size() > 8 && items.get(8) != null)
+ {
gui.renderItem(items.get(8), x + 28, y + 57, 30f);
name.add(items.get(8).getDisplayName());
- if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 47 && mouseY <= y + 47 + 16) gui.drawHoverString(name, x + 28, y + 47);
+ if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 47 && mouseY <= y + 47 + 16) gui.drawHoverString(name, x + 28, y + 47);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- if(items.size() > 9 && items.get(9) != null){
+ if (items.size() > 9 && items.get(9) != null)
+ {
gui.renderItem(items.get(9), x + 45, y + 57, 30f);
name.add(items.get(9).getDisplayName());
- if(mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 47 && mouseY <= y + 47 + 16) gui.drawHoverString(name, x + 45, y + 47);
+ if (mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 47 && mouseY <= y + 47 + 16) gui.drawHoverString(name, x + 45, y + 47);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
}
- for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 62 + i*12, 0);
+ for (int i = 0; i < text.size(); i++)
+ gui.getFont().drawString(text.get(i), x, y + 62 + i * 12, 0);
GL11.glColor4f(1, 1, 1, 1);
}
}
-
+
public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, ArrayList<String> text, ArrayList<ItemStack> items, int mouseX, int mouseY)
{
ArrayList<String> name = new ArrayList<String>();
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items.get(1).getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items.get(0).getDisplayName())/2), y + 2, 0);
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items.get(1).getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items.get(0).getDisplayName()) / 2), y + 2, 0);
GL11.glColor4f(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip" + ".png"));
gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 46);
-
+
gui.renderItem(items.get(0), x + 13, y + 20 + 10, 50f);
name.add(items.get(0).getDisplayName());
- if(mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 20 + 16) gui.drawHoverString(name, x, y + 20);
+ if (mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 20 + 16) gui.drawHoverString(name, x, y + 20);
name.removeAll(name);
GL11.glDisable(GL11.GL_LIGHTING);
-
+
gui.renderItem(items.get(1), x + 77, y + 28 + 10, 50f);
-
- for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 60 + i*12, 0);
+
+ for (int i = 0; i < text.size(); i++)
+ gui.getFont().drawString(text.get(i), x, y + 60 + i * 12, 0);
GL11.glColor4f(1, 1, 1, 1);
}
-
+
public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, ArrayList<String> text, float size)
{
- y+=5;
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName())/2) - 10, y + 2, 0);
+ y += 5;
+ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + 2, 0);
GL11.glColor4f(1, 1, 1, 1);
gui.renderItem(item, x + 13, y + 18, size);
- for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 30 + i*12, 0);
+ for (int i = 0; i < text.size(); i++)
+ gui.getFont().drawString(text.get(i), x, y + 30 + i * 12, 0);
}
-
+
public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, ArrayList<String> text, float size, int txtX, int txtY, boolean showName, int imgX, int imgY)
{
- y+=5;
- if(showName) gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName())/2) - 10, y + 2, 0);
+ y += 5;
+ if (showName) gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + 2, 0);
GL11.glColor4f(1, 1, 1, 1);
gui.renderItem(item, x + 13 + imgX, y + 18 + imgY, size);
- for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x + txtX, y + 30 + txtY + i*12, 0);
+ for (int i = 0; i < text.size(); i++)
+ gui.getFont().drawString(text.get(i), x + txtX, y + 30 + txtY + i * 12, 0);
}
-
+
public static void addTextPage(GuiGuide gui, int x, int y, ArrayList<String> text)
{
- y-=25;
- for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 30 + i*12, 0);
+ y -= 25;
+ for (int i = 0; i < text.size(); i++)
+ gui.getFont().drawString(text.get(i), x, y + 30 + i * 12, 0);
GL11.glColor4f(1, 1, 1, 1);
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java b/java/darkknight/jewelrycraft/container/SlotRingChest.java
index 576dee7..fe4cdd0 100644
--- a/src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java
+++ b/java/darkknight/jewelrycraft/container/SlotRingChest.java
@@ -24,10 +24,7 @@ public class SlotRingChest extends Slot
@Override
public ItemStack decrStackSize(int amount)
{
- if (!locked)
- {
- return super.decrStackSize(amount);
- }
+ if (!locked) { return super.decrStackSize(amount); }
return null;
}
diff --git a/java/darkknight/jewelrycraft/events/BucketHandler.java b/java/darkknight/jewelrycraft/events/BucketHandler.java
new file mode 100644
index 0000000..ec0b280
--- /dev/null
+++ b/java/darkknight/jewelrycraft/events/BucketHandler.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
+ *
+ * BuildCraft is distributed under the terms of the Minecraft Mod Public License
+ * 1.0, or MMPL. Please check the contents of the license located in
+ * http://www.mod-buildcraft.com/MMPL-1.0.txt
+ */
+package darkknight.jewelrycraft.events;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MovingObjectPosition;
+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
+{
+
+ public static BucketHandler INSTANCE = new BucketHandler();
+ public Map<Block, Item> buckets = new HashMap<Block, Item>();
+
+ private BucketHandler()
+ {
+ }
+
+ @SubscribeEvent
+ public void onBucketFill(FillBucketEvent event)
+ {
+
+ ItemStack result = fillCustomBucket(event.world, event.target);
+
+ if (result == null) return;
+
+ event.result = result;
+ event.setResult(Result.ALLOW);
+ }
+
+ private ItemStack fillCustomBucket(World world, MovingObjectPosition pos)
+ {
+
+ Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
+ Item bucket = buckets.get(block);
+
+ if (bucket != null && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) != Blocks.air && world.getBlock(pos.blockX, pos.blockY, pos.blockZ) instanceof BlockMoltenMetal)
+ {
+ world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
+ ItemStack item = new ItemStack(bucket);
+ String ingotData = JewelrycraftMod.saveData.getString(pos.blockX + " " + pos.blockY + " " + pos.blockZ + " " + world.provider.dimensionId);
+ if (ingotData != null && ingotData != "")
+ {
+ String[] splitData = ingotData.split(":");
+ if (splitData.length == 2)
+ {
+ int itemID, itemDamage;
+ try
+ {
+ itemID = Integer.parseInt(splitData[0]);
+ itemDamage = Integer.parseInt(splitData[1]);
+
+ JewelryNBT.addMetal(item, new ItemStack(Item.getItemById(itemID), 1, itemDamage));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ return item;
+ }
+ else return null;
+ }
+} \ No newline at end of file
diff --git a/java/darkknight/jewelrycraft/events/EntityEventHandler.java b/java/darkknight/jewelrycraft/events/EntityEventHandler.java
new file mode 100644
index 0000000..ed7c3e7
--- /dev/null
+++ b/java/darkknight/jewelrycraft/events/EntityEventHandler.java
@@ -0,0 +1,118 @@
+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.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.CompressedStreamTools;
+import net.minecraft.nbt.NBTTagCompound;
+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 cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.network.PacketClearColorCache;
+import darkknight.jewelrycraft.util.BlockUtils;
+import darkknight.jewelrycraft.util.PlayerUtils;
+
+/**
+ * Code taken from OpenBlocks
+ */
+
+public class EntityEventHandler
+{
+ public static final String OPENBLOCKS_PERSIST_TAG = "Jewelrycraft";
+ public static final String GIVEN_GUIDE_TAG = "givenGuive";
+
+ @SubscribeEvent
+ @SideOnly(Side.SERVER)
+ public void onEntityJoinWorld(EntityJoinWorldEvent event)
+ {
+ if (event.entity instanceof EntityPlayerMP) JewelrycraftMod.netWrapper.sendTo(new PacketClearColorCache(), (EntityPlayerMP) event.entity);
+
+ final Entity entity = event.entity;
+
+ if (!event.world.isRemote && entity instanceof EntityPlayer)
+ {
+ EntityPlayer player = (EntityPlayer) entity;
+ NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+
+ boolean shouldGiveManual = ItemList.guide != null && !persistTag.getBoolean(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)
+ {
+ if (!event.world.isRemote)
+ {
+ new File(JewelrycraftMod.dir + File.separator + "Jewelrycraft").mkdirs();
+ JewelrycraftMod.liquidsConf = new File(JewelrycraftMod.dir + File.separator + "Jewelrycraft", "JLP" + event.world.getWorldInfo().getWorldName() + ".cfg");
+ try
+ {
+ 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/item/ItemClayMolds.java b/java/darkknight/jewelrycraft/item/ItemClayMolds.java
index 323a298..8c2eafa 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemClayMolds.java
+++ b/java/darkknight/jewelrycraft/item/ItemClayMolds.java
@@ -14,7 +14,8 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemClayMolds extends Item
{
/** List of molds color names */
- public static final String[] moldsItemNames = new String[] { "clayIngot", "clayRing", "clayNecklace" };
+ public static final String[] moldsItemNames = new String[]
+ { "clayIngot", "clayRing", "clayNecklace" };
@SideOnly(Side.CLIENT)
private IIcon[] moldsIcons;
@@ -37,8 +38,9 @@ public class ItemClayMolds extends Item
}
/**
- * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on
- * their damage or NBT.
+ * Returns the unlocalized name of this item. This version accepts an
+ * ItemStack so different stacks can have different names based on their
+ * damage or NBT.
*/
public String getUnlocalizedNameInefficiently(ItemStack par1ItemStack)
{
@@ -46,7 +48,8 @@ public class ItemClayMolds extends Item
return super.getUnlocalizedName() + "." + moldsItemNames[i];
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings(
+ { "unchecked", "rawtypes" })
@SideOnly(Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: molds returns 16 items)
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemCrystal.java b/java/darkknight/jewelrycraft/item/ItemCrystal.java
index 2009309..8c3e938 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemCrystal.java
+++ b/java/darkknight/jewelrycraft/item/ItemCrystal.java
@@ -13,40 +13,42 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemCrystal extends Item
{
public IIcon overlay;
- public static final int[] dyeColors = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
-
+ public static final int[] dyeColors = new int[]
+ { 1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320 };
+
public ItemCrystal()
{
super();
this.setHasSubtypes(true);
this.setMaxDamage(0);
}
-
+
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:crystal");
overlay = iconRegister.registerIcon("jewelrycraft:crystalOverlay");
}
-
+
@Override
public boolean requiresMultipleRenderPasses()
{
return true;
}
-
+
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass)
{
- if(pass == 1 && this.getDamage(stack) != 16) return dyeColors[this.getDamage(stack)];
+ if (pass == 1 && this.getDamage(stack) != 16) return dyeColors[this.getDamage(stack)];
return 16777215;
}
-
+
public IIcon getIcon(ItemStack stack, int pass)
{
return pass == 0 ? itemIcon : overlay;
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings(
+ { "unchecked", "rawtypes" })
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int j = 0; j < 16; ++j)
@@ -54,5 +56,5 @@ public class ItemCrystal extends Item
par3List.add(new ItemStack(par1, 1, j));
}
}
-
+
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java b/java/darkknight/jewelrycraft/item/ItemGuide.java
index b4d300d..62f645e 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemGuide.java
+++ b/java/darkknight/jewelrycraft/item/ItemGuide.java
@@ -6,21 +6,21 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import darkknight.jewelrycraft.JewelrycraftMod;
-public class ItemGuide extends Item
+public class ItemGuide extends Item
{
- public ItemGuide()
+ public ItemGuide()
{
super();
}
@Override
- public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
- if (world.isRemote)
+ if (world.isRemote)
{
player.openGui(JewelrycraftMod.instance, 1, player.worldObj, 0, 0, 0);
}
-
+
return stack;
}
} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemList.java b/java/darkknight/jewelrycraft/item/ItemList.java
index 1113a55..fa718df 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemList.java
+++ b/java/darkknight/jewelrycraft/item/ItemList.java
@@ -14,7 +14,7 @@ import darkknight.jewelrycraft.block.BlockList;
public class ItemList
{
public static Item thiefGloves;
- public static Item shadowIngot, ingot2, ingot3, ingot4, ingot5, ingot6, ingot7;
+ public static Item shadowIngot;
public static Item molds;
public static Item clayMolds;
public static Item crystal;
@@ -41,14 +41,6 @@ public class ItemList
bucket = (ItemMoltenMetalBucket) new ItemMoltenMetalBucket().setUnlocalizedName("Jewelrycraft.bucket");
metal = (ItemMoltenMetal) new ItemMoltenMetal().setUnlocalizedName("Jewelrycraft.bucket");
- // Test Ingots
- ingot2 = new Item().setUnlocalizedName("Jewelrycraft.ingot2").setTextureName("jewelrycraft:test/ingot2").setCreativeTab(JewelrycraftMod.jewelrycraft);
- ingot3 = new Item().setUnlocalizedName("Jewelrycraft.ingot3").setTextureName("jewelrycraft:ingot3").setCreativeTab(JewelrycraftMod.jewelrycraft);
- ingot4 = new Item().setUnlocalizedName("Jewelrycraft.ingot4").setTextureName("jewelrycraft:ingot4").setCreativeTab(JewelrycraftMod.jewelrycraft);
- ingot5 = new Item().setUnlocalizedName("Jewelrycraft.ingot5").setTextureName("jewelrycraft:test/ingot5").setCreativeTab(JewelrycraftMod.jewelrycraft);
- ingot6 = new Item().setUnlocalizedName("Jewelrycraft.ingot6").setTextureName("jewelrycraft:ingot6").setCreativeTab(JewelrycraftMod.jewelrycraft);
- ingot7 = new Item().setUnlocalizedName("Jewelrycraft.ingot7").setTextureName("jewelrycraft:ingot7").setCreativeTab(JewelrycraftMod.jewelrycraft);
-
GameRegistry.registerItem(thiefGloves, "thiefGloves");
GameRegistry.registerItem(shadowIngot, "shadowIngot");
GameRegistry.registerItem(molds, "molds");
@@ -60,13 +52,6 @@ public class ItemList
GameRegistry.registerItem(bucket, "moltenMetalBucket");
GameRegistry.registerItem(metal, "moltenMetal");
- GameRegistry.registerItem(ingot2, "ingot2");
- GameRegistry.registerItem(ingot3, "ingot3");
- GameRegistry.registerItem(ingot4, "ingot4");
- GameRegistry.registerItem(ingot5, "ingot5");
- GameRegistry.registerItem(ingot6, "ingot6");
- GameRegistry.registerItem(ingot7, "ingot7");
-
isInitialized = true;
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java b/java/darkknight/jewelrycraft/item/ItemMolds.java
index 0ebb5d1..a335df8 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemMolds.java
+++ b/java/darkknight/jewelrycraft/item/ItemMolds.java
@@ -14,10 +14,11 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemMolds extends Item
{
/** List of molds color names */
- public static final String[] moldsItemNames = new String[] { "ingot", "ring", "necklace" };
+ public static final String[] moldsItemNames = new String[]
+ { "ingot", "ring", "necklace" };
@SideOnly(Side.CLIENT)
private IIcon[] moldsIcons;
-
+
public ItemMolds()
{
super();
@@ -25,7 +26,7 @@ public class ItemMolds extends Item
this.setMaxDamage(0);
this.setMaxStackSize(1);
}
-
+
@SideOnly(Side.CLIENT)
/**
* Gets an icon index based on an item's damage value
@@ -35,18 +36,20 @@ public class ItemMolds extends Item
int j = MathHelper.clamp_int(par1, 0, moldsItemNames.length - 1);
return this.moldsIcons[j];
}
-
+
/**
- * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on
- * their damage or NBT.
+ * Returns the unlocalized name of this item. This version accepts an
+ * ItemStack so different stacks can have different names based on their
+ * damage or NBT.
*/
public String getUnlocalizedName(ItemStack par1ItemStack)
{
int i = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, moldsItemNames.length - 1);
return super.getUnlocalizedName() + "." + moldsItemNames[i];
}
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
+
+ @SuppressWarnings(
+ { "unchecked", "rawtypes" })
@SideOnly(Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: molds returns 16 items)
@@ -58,12 +61,12 @@ public class ItemMolds extends Item
par3List.add(new ItemStack(par1, 1, j));
}
}
-
+
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
{
this.moldsIcons = new IIcon[moldsItemNames.length];
-
+
for (int i = 0; i < moldsItemNames.length; ++i)
{
this.moldsIcons[i] = par1IconRegister.registerIcon("jewelrycraft:" + moldsItemNames[i] + this.getIconString());
diff --git a/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java b/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java
new file mode 100644
index 0000000..53f1926
--- /dev/null
+++ b/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java
@@ -0,0 +1,101 @@
+package darkknight.jewelrycraft.item;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.client.renderer.texture.TextureManager;
+import net.minecraft.client.resources.IResourceManager;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.ResourceLocation;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+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 && JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0 && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215)
+ {
+ IIcon itemIcon = JewelryNBT.ingot(stack).getItem().getIcon(JewelryNBT.ingot(stack), 0);
+ String ingotIconName = itemIcon.getIconName();
+
+ if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim();
+ else domain = "minecraft";
+
+ texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png";
+ ResourceLocation ingot = null;
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
+
+ if (texturemanager.getResourceLocation(JewelryNBT.ingot(stack).getItemSpriteNumber()).toString().contains("items")) ingot = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
+ else ingot = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
+
+ icon = ImageIO.read(rm.getResource(ingot).getInputStream());
+ while (ok == 0)
+ {
+ red = (icon.getRGB(x, y) >> 16) & 0xFF;
+ green = (icon.getRGB(x, y) >> 8) & 0xFF;
+ blue = icon.getRGB(x, y) & 0xFF;
+ if (!isColorPretty(red, green, blue))
+ {
+ 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;
+ }
+
+ public static boolean isColorPretty(int r, int g, int b)
+ {
+ if ((r >= 100 && g >= 100 && b >= 100 && r < 230 && b < 230 && g < 230) || ((r >= 100 && (g < 100 || b < 100)) || (g >= 100 && (r < 100 || b < 100)) || (b >= 100 && (g < 100 || r < 100)))) return true;
+ else return false;
+ }
+}
diff --git a/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java b/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
new file mode 100644
index 0000000..1b3fd1f
--- /dev/null
+++ b/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
@@ -0,0 +1,290 @@
+package darkknight.jewelrycraft.item;
+
+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.renderer.texture.TextureManager;
+import net.minecraft.client.resources.IResourceManager;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.FillBucketEvent;
+import cpw.mods.fml.common.eventhandler.Event;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.block.BlockList;
+import darkknight.jewelrycraft.network.PacketSendLiquidData;
+import darkknight.jewelrycraft.util.JewelryNBT;
+
+public class ItemMoltenMetalBucket extends Item
+{
+ public IIcon liquid;
+
+ public ItemMoltenMetalBucket()
+ {
+ this.maxStackSize = 1;
+ }
+
+ /**
+ * Called whenever this item is equipped and the right mouse button is
+ * pressed. Args: itemStack, world, entityPlayer
+ */
+ public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer)
+ {
+ boolean flag = BlockList.moltenMetal == Blocks.air;
+ MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, flag);
+
+ if (movingobjectposition == null)
+ {
+ return stack;
+ }
+ else
+ {
+ FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, stack, par2World, movingobjectposition);
+ if (MinecraftForge.EVENT_BUS.post(event)) { return stack; }
+
+ if (event.getResult() == Event.Result.ALLOW)
+ {
+ if (par3EntityPlayer.capabilities.isCreativeMode) { return stack; }
+
+ if (--stack.stackSize <= 0) { return event.result; }
+
+ if (!par3EntityPlayer.inventory.addItemStackToInventory(event.result))
+ {
+ par3EntityPlayer.dropPlayerItemWithRandomChoice(event.result, false);
+ }
+
+ return stack;
+ }
+ if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
+ {
+ int i = movingobjectposition.blockX;
+ int j = movingobjectposition.blockY;
+ int k = movingobjectposition.blockZ;
+
+ if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) { return stack; }
+
+ if (flag)
+ {
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) { return stack; }
+
+ Material material = par2World.getBlock(i, j, k).getMaterial();
+ int l = par2World.getBlockMetadata(i, j, k);
+ par2World.setBlockToAir(i, j, k);
+ return this.func_150910_a(stack, par3EntityPlayer, ItemList.bucket);
+ }
+ else
+ {
+ if (BlockList.moltenMetal == Blocks.air) { return new ItemStack(Items.bucket); }
+
+ if (movingobjectposition.sideHit == 0)
+ {
+ --j;
+ }
+
+ if (movingobjectposition.sideHit == 1)
+ {
+ ++j;
+ }
+
+ if (movingobjectposition.sideHit == 2)
+ {
+ --k;
+ }
+
+ if (movingobjectposition.sideHit == 3)
+ {
+ ++k;
+ }
+
+ if (movingobjectposition.sideHit == 4)
+ {
+ --i;
+ }
+
+ if (movingobjectposition.sideHit == 5)
+ {
+ ++i;
+ }
+
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack)) { return stack; }
+
+ try
+ {
+ if (this.tryPlaceContainedLiquid(par2World, i, j, k, stack) && !par3EntityPlayer.capabilities.isCreativeMode) { return new ItemStack(Items.bucket); }
+ }
+ catch (IOException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return stack;
+ }
+ }
+
+ private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_)
+ {
+ if (p_150910_2_.capabilities.isCreativeMode)
+ {
+ return p_150910_1_;
+ }
+ else if (--p_150910_1_.stackSize <= 0)
+ {
+ return new ItemStack(p_150910_3_);
+ }
+ else
+ {
+ if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_)))
+ {
+ p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false);
+ }
+
+ return p_150910_1_;
+ }
+ }
+
+ /**
+ * Attempts to place the liquid contained inside the bucket.
+ *
+ * @throws IOException
+ */
+ public boolean tryPlaceContainedLiquid(World world, int x, int y, int z, ItemStack stack) throws IOException
+ {
+ if (BlockList.moltenMetal == Blocks.air)
+ {
+ return false;
+ }
+ else
+ {
+ Material material = world.getBlock(x, y, z).getMaterial();
+ boolean flag = !material.isSolid();
+
+ if (!world.isAirBlock(x, y, z) && !flag) return false;
+ else if (stack != null && JewelryNBT.ingot(stack) != null)
+ {
+ if (!world.isRemote && flag && !material.isLiquid()) 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()));
+
+ world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3);
+ return true;
+ }
+ else return false;
+ }
+ }
+
+ public void registerIcons(IIconRegister iconRegister)
+ {
+ itemIcon = iconRegister.registerIcon("bucket_empty");
+ liquid = iconRegister.registerIcon("jewelrycraft:bucketOverlay");
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack stack, int pass)
+ {
+ try
+ {
+ return color(stack, pass);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ return 16777215;
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
+ public IIcon getIcon(ItemStack stack, int pass)
+ {
+ if (pass == 0) return itemIcon;
+ if (pass == 1) return liquid;
+ return itemIcon;
+ }
+
+ 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 (pass == 1 && stack != null && JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0 && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215)
+ {
+ IIcon itemIcon = JewelryNBT.ingot(stack).getItem().getIcon(JewelryNBT.ingot(stack), 0);
+ String ingotIconName = itemIcon.getIconName();
+
+ if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim();
+ else domain = "minecraft";
+
+ texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png";
+ ResourceLocation ingot = null;
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
+
+ if (texturemanager.getResourceLocation(JewelryNBT.ingot(stack).getItemSpriteNumber()).toString().contains("items")) ingot = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
+ else ingot = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
+
+ icon = ImageIO.read(rm.getResource(ingot).getInputStream());
+ while (ok == 0)
+ {
+ red = (icon.getRGB(x, y) >> 16) & 0xFF;
+ green = (icon.getRGB(x, y) >> 8) & 0xFF;
+ blue = icon.getRGB(x, y) & 0xFF;
+ if (!isColorPretty(red, green, blue))
+ {
+ 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 && pass == 1) return JewelryNBT.ingotColor(stack);
+ return 16777215;
+ }
+
+ public static boolean isColorPretty(int r, int g, int b)
+ {
+ if ((r >= 100 && g >= 100 && b >= 100 && r < 230 && b < 230 && g < 230) || ((r >= 100 && (g < 100 || b < 100)) || (g >= 100 && (r < 100 || b < 100)) || (b >= 100 && (g < 100 || r < 100)))) return true;
+ else return false;
+ }
+
+ public ItemStack getModifiedItemStack(ItemStack ingot)
+ {
+ ItemStack itemstack = new ItemStack(this);
+ JewelryNBT.addMetal(itemstack, ingot);
+ return itemstack;
+ }
+
+ public String getItemStackDisplayName(ItemStack stack)
+ {
+ if (JewelryNBT.ingot(stack) != null) return (StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim() + " " + JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim();
+ return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim() + " Metal";
+ }
+}
diff --git a/java/darkknight/jewelrycraft/item/ItemMultiIngot.java b/java/darkknight/jewelrycraft/item/ItemMultiIngot.java
new file mode 100644
index 0000000..8e29690
--- /dev/null
+++ b/java/darkknight/jewelrycraft/item/ItemMultiIngot.java
@@ -0,0 +1,46 @@
+package darkknight.jewelrycraft.item;
+
+import java.util.List;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class ItemMultiIngot extends Item
+{
+ public IIcon[] icons = new IIcon[2];
+
+ public ItemMultiIngot()
+ {
+ super();
+ setHasSubtypes(true);
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List items)
+ {
+ items.add(new ItemStack(item, 1, 0));
+ items.add(new ItemStack(item, 1, 1));
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack)
+ {
+ return super.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+
+ @Override
+ public void registerIcons(IIconRegister register)
+ {
+ icons[0] = register.registerIcon("jewelrycraft:test/ingot2");
+ icons[1] = register.registerIcon("jewelrycraft:ingot3");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int dmg)
+ {
+ return dmg == 1 ? icons[1] : icons[0];
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java b/java/darkknight/jewelrycraft/item/ItemNecklace.java
index 96ef364..0d548e0 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemNecklace.java
+++ b/java/darkknight/jewelrycraft/item/ItemNecklace.java
@@ -32,25 +32,25 @@ public class ItemNecklace extends Item
public IIcon jewel;
private double amplifier;
int index = 0;
-
+
public ItemNecklace()
{
super();
this.setMaxStackSize(1);
}
-
+
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:necklace");
jewel = iconRegister.registerIcon("jewelrycraft:jewelNecklace");
}
-
+
@Override
public boolean requiresMultipleRenderPasses()
{
return true;
}
-
+
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass)
{
@@ -64,21 +64,22 @@ public class ItemNecklace extends Item
}
return 16777215;
}
-
+
public IIcon getIcon(ItemStack stack, int pass)
{
- if(pass == 0) return itemIcon;
- if(pass == 1 && JewelryNBT.jewel(stack) != null) return jewel;
+ if (pass == 0) return itemIcon;
+ if (pass == 1 && JewelryNBT.jewel(stack) != null) return jewel;
return itemIcon;
}
-
+
public String getItemStackDisplayName(ItemStack stack)
{
- if(JewelryNBT.ingot(stack) != null) return JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() + " " + ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
+ if (JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) return JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() + " " + ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
}
-
- @SuppressWarnings({ "rawtypes" })
+
+ @SuppressWarnings(
+ { "rawtypes" })
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (!world.isRemote)
@@ -90,34 +91,42 @@ public class ItemNecklace extends Item
if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Items.bed)) && JewelryNBT.dimension(stack) != -2 && JewelryNBT.dimName(stack) != null)
{
int dimension = JewelryNBT.dimension(stack);
- for (int i = 1; i <= 20; i++) world.spawnParticle("largesmoke", player.posX - 0.5D + Math.random(), player.posY - 1.5D + Math.random(), player.posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ for (int i = 1; i <= 20; i++)
+ world.spawnParticle("largesmoke", player.posX - 0.5D + Math.random(), player.posY - 1.5D + Math.random(), player.posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
if (!JewelryNBT.isDimensionX(stack, player.dimension)) player.travelToDimension(dimension);
- for (int i = 0; i < entities.size(); i++) ((EntityLivingBase)entities.get(i)).setPositionAndUpdate(posX, posY, posZ);
- for (int i = 1; i <= 300; i++) world.spawnParticle("portal", posX - 0.5D + Math.random(), posY + Math.random(), posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ for (int i = 0; i < entities.size(); i++)
+ ((EntityLivingBase) entities.get(i)).setPositionAndUpdate(posX, posY, posZ);
+ for (int i = 1; i <= 300; i++)
+ world.spawnParticle("portal", posX - 0.5D + Math.random(), posY + Math.random(), posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
}
- else if(JewelryNBT.isDimensionX(stack, player.dimension))
+ else if (JewelryNBT.isDimensionX(stack, player.dimension))
{
- for (int i = 1; i <= 20; i++) world.spawnParticle("largesmoke", player.posX - 0.5D + Math.random(), player.posY - 1.5D + Math.random(), player.posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
- for (int i = 0; i < entities.size(); i++) ((EntityLivingBase)entities.get(i)).setPositionAndUpdate(posX, posY, posZ);
- for (int i = 1; i <= 300; i++) world.spawnParticle("portal", posX - 0.5D + Math.random(), posY + Math.random(), posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ for (int i = 1; i <= 20; i++)
+ world.spawnParticle("largesmoke", player.posX - 0.5D + Math.random(), player.posY - 1.5D + Math.random(), player.posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ for (int i = 0; i < entities.size(); i++)
+ ((EntityLivingBase) entities.get(i)).setPositionAndUpdate(posX, posY, posZ);
+ for (int i = 1; i <= 300; i++)
+ world.spawnParticle("portal", posX - 0.5D + Math.random(), posY + Math.random(), posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
}
else player.addChatMessage(new ChatComponentText("You can't teleport to these coordonates! You need to be in the same dimension they were set!"));
}
- else if(JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Items.bed)) && JewelryNBT.dimension(stack) == -2 && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1){
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Items.bed)) && JewelryNBT.dimension(stack) == -2 && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1)
+ {
JewelryNBT.addCoordonatesAndDimension(stack, player.posX, player.posY, player.posZ, world.provider.dimensionId, world.provider.getDimensionName());
JewelryNBT.addFakeEnchantment(stack);
}
- else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && !JewelryNBT.hasTag(stack, "modifier") && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1){
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && !JewelryNBT.hasTag(stack, "modifier") && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1)
+ {
JewelryNBT.addCoordonatesAndDimension(stack, player.posX, player.posY, player.posZ, world.provider.dimensionId, world.provider.getDimensionName());
JewelryNBT.addFakeEnchantment(stack);
}
- if(JewelryNBT.hasTag(stack, "mode"))
+ if (JewelryNBT.hasTag(stack, "mode"))
{
String mode = "";
- if(JewelryNBT.isModeX(stack, "Activated")) mode = "Deactivated";
- else if(JewelryNBT.isModeX(stack, "Deactivated")) mode = "Activated";
- if(mode != "")
+ if (JewelryNBT.isModeX(stack, "Activated")) mode = "Deactivated";
+ else if (JewelryNBT.isModeX(stack, "Deactivated")) mode = "Activated";
+ if (mode != "")
{
player.addChatMessage(new ChatComponentText("The Necklace has been " + mode));
JewelryNBT.addMode(stack, mode);
@@ -126,19 +135,23 @@ public class ItemNecklace extends Item
}
return stack;
}
-
-// @Override
-// public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity)
-// {
-// if (!player.worldObj.isRemote && entity instanceof EntityLivingBase && JewelryNBT.isJewelX(stack, new ItemStack(Item.netherStar)) && JewelryNBT.isModifierX(stack, new ItemStack(Block.chest)) && JewelryNBT.entity(stack, player) == null){
-// JewelryNBT.addEntity(stack, entity);
-// JewelryNBT.addEntityID(stack, entity);
-// entity.setDead();
-// JewelryNBT.addFakeEnchantment(stack);
-// }
-// return true;
-// }
-
+
+ // @Override
+ // public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer
+ // player, EntityLivingBase entity)
+ // {
+ // if (!player.worldObj.isRemote && entity instanceof EntityLivingBase &&
+ // JewelryNBT.isJewelX(stack, new ItemStack(Item.netherStar)) &&
+ // JewelryNBT.isModifierX(stack, new ItemStack(Block.chest)) &&
+ // JewelryNBT.entity(stack, player) == null){
+ // JewelryNBT.addEntity(stack, entity);
+ // JewelryNBT.addEntityID(stack, entity);
+ // entity.setDead();
+ // JewelryNBT.addFakeEnchantment(stack);
+ // }
+ // return true;
+ // }
+
/**
* allows items to add custom lines of information to the mouseover
* description
@@ -148,101 +161,98 @@ public class ItemNecklace extends Item
if (stack.hasTagCompound())
{
ItemStack ingot = JewelryNBT.ingot(stack);
- if (ingot != null) list.add("Ingot: " + EnumChatFormatting.YELLOW + ingot.getDisplayName());
-
+ if (ingot != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) list.add("Ingot: " + EnumChatFormatting.YELLOW + ingot.getDisplayName());
+
ItemStack jewel = JewelryNBT.jewel(stack);
if (jewel != null) list.add("Jewel: " + EnumChatFormatting.BLUE + jewel.getDisplayName());
-
+
ItemStack modifier = JewelryNBT.modifier(stack);
- if(modifier != null) list.add("Modifier: " + EnumChatFormatting.DARK_PURPLE + modifier.getDisplayName());
-
+ if (modifier != null) list.add("Modifier: " + EnumChatFormatting.DARK_PURPLE + modifier.getDisplayName());
+
double playerPosX = JewelryNBT.playerPosX(stack), playerPosY = JewelryNBT.playerPosY(stack), playerPosZ = JewelryNBT.playerPosZ(stack);
- if(playerPosX != -1 && playerPosY != -1 && playerPosZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) playerPosX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) playerPosY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) playerPosZ);
-
- int posX = JewelryNBT.blockCoordX(stack), posY = JewelryNBT.blockCoordY(stack), posZ = JewelryNBT.blockCoordZ(stack);
- if(posX != -1 && posY != -1 && posZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) posX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) posY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) posZ);
-
+ if (playerPosX != -1 && playerPosY != -1 && playerPosZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) playerPosX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) playerPosY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) playerPosZ);
+
+ int posX = JewelryNBT.blockCoordX(stack), posY = JewelryNBT.blockCoordY(stack), posZ = JewelryNBT.blockCoordZ(stack);
+ if (posX != -1 && posY != -1 && posZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) posX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) posY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) posZ);
+
String name = JewelryNBT.dimName(stack);
- if(name != null) list.add("Dimension: " + EnumChatFormatting.DARK_GREEN + name);
-
+ if (name != null) list.add("Dimension: " + EnumChatFormatting.DARK_GREEN + name);
+
EntityLivingBase entity = JewelryNBT.entity(stack, player);
if (entity != null) list.add("Entity: " + EnumChatFormatting.GOLD + entity.getCommandSenderName());
-
+
String modeN = JewelryNBT.modeName(stack);
- if(modeN != null) list.add("Mode: " + modeN);
-
+ if (modeN != null) list.add("Mode: " + modeN);
+
int block = JewelryNBT.blockID(stack);
- if(block != -1) list.add("Block: " + StatCollector.translateToLocalFormatted(Block.getBlockById(block).getUnlocalizedName()));
-
+ if (block != -1) list.add("Block: " + StatCollector.translateToLocalFormatted(Block.getBlockById(block).getUnlocalizedName()));
+
int blockmeta = JewelryNBT.blockMetadata(stack);
- if(blockmeta != -1) list.add("Block Metadata: " + blockmeta);
-
+ if (blockmeta != -1) list.add("Block Metadata: " + blockmeta);
+
TileEntity tile = JewelryNBT.tileEntity(stack);
- if(tile != null) list.add(EnumChatFormatting.RED + "Contains a tile entity");
-
+ if (tile != null) list.add(EnumChatFormatting.RED + "Contains a tile entity");
+
int blockX = JewelryNBT.blockCoordX(stack);
- if(blockX != -1) list.add("Block Coords X: " + blockX);
-
+ if (blockX != -1) list.add("Block Coords X: " + blockX);
+
int blockY = JewelryNBT.blockCoordY(stack);
- if(blockY != -1) list.add("Block Coords Y: " + blockY);
-
+ if (blockY != -1) list.add("Block Coords Y: " + blockY);
+
int blockZ = JewelryNBT.blockCoordZ(stack);
- if(blockZ != -1) list.add("Block Coords Z: " + blockZ);
-
- // int colorI = JewelryNBT.ingotColor(stack);
- // if(colorI != -1) list.add("Ingot Color: " + colorI);
- //
- // int colorJ = JewelryNBT.jewelColor(stack);
- // if(colorJ != -1) list.add("Jewel Color: " + colorJ);
+ if (blockZ != -1) list.add("Block Coords Z: " + blockZ);
+
+ // int colorI = JewelryNBT.ingotColor(stack);
+ // if(colorI != -1) list.add("Ingot Color: " + colorI);
+ //
+ // int colorJ = JewelryNBT.jewelColor(stack);
+ // if(colorJ != -1) list.add("Jewel Color: " + colorJ);
}
}
-
+
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int i, int j, int k, int side, float par8, float par9, float par10)
{
amplifier = 0;
if (JewelryNBT.isJewelX(stack, new ItemStack(Items.diamond))) amplifier = 1D;
else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.emerald))) amplifier = 2D;
else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star))) amplifier = 5D;
-
+
if (!world.isRemote)
{
onItemRightClick(stack, world, player);
- if(JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15)))
- for(int x = (int) - amplifier; x <= amplifier; x++)
- for(int z = (int) - amplifier; z <= amplifier; z++)
- world.scheduleBlockUpdate(i + x, j, k + z, world.getBlock(i + x, j, k + z), 7 - (int)amplifier);
-
- for(int x = (int) - 1; x <= 1; x++)
- for(int z = (int) - 1; z <= 1; z++)
- if(JewelryNBT.isModifierX(stack, new ItemStack(Items.diamond_pickaxe)) && JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star)) && JewelryNBT.isIngotX(stack, new ItemStack(ItemList.shadowIngot)))
- if((side == 0 || side == 1) && j > 0 && world.getBlock(i, j + x, k + z) != Blocks.air && world.getBlock(i + x, j, k + z).getBlockHardness(world, i + x, j, k + z) > 0F) world.func_147480_a(i + x, j, k + z, true);
- else if((side == 2 || side == 3) && j + x > 0 && world.getBlock(i, j + x, k + z) != Blocks.air && world.getBlock(i + z, j + x, k).getBlockHardness(world, i + z, j + x, k) > 0F) world.func_147480_a(i + z, j + x, k, true);
- else if((side == 4 || side == 5) && j + x > 0 && world.getBlock(i, j + x, k + z) != Blocks.air && world.getBlock(i, j + x, k + z).getBlockHardness(world, i, j + x, k + z) > 0F) world.func_147480_a(i, j + x, k + z, true);
+ if (JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15))) for (int x = (int) -amplifier; x <= amplifier; x++)
+ for (int z = (int) -amplifier; z <= amplifier; z++)
+ world.scheduleBlockUpdate(i + x, j, k + z, world.getBlock(i + x, j, k + z), 7 - (int) amplifier);
+
+ for (int x = (int) -1; x <= 1; x++)
+ for (int z = (int) -1; z <= 1; z++)
+ if (JewelryNBT.isModifierX(stack, new ItemStack(Items.diamond_pickaxe)) && JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star)) && JewelryNBT.isIngotX(stack, new ItemStack(ItemList.shadowIngot))) if ((side == 0 || side == 1) && j > 0 && world.getBlock(i, j + x, k + z) != Blocks.air && world.getBlock(i + x, j, k + z).getBlockHardness(world, i + x, j, k + z) > 0F) world.func_147480_a(i + x, j, k + z, true);
+ else if ((side == 2 || side == 3) && j + x > 0 && world.getBlock(i, j + x, k + z) != Blocks.air && world.getBlock(i + z, j + x, k).getBlockHardness(world, i + z, j + x, k) > 0F) world.func_147480_a(i + z, j + x, k, true);
+ else if ((side == 4 || side == 5) && j + x > 0 && world.getBlock(i, j + x, k + z) != Blocks.air && world.getBlock(i, j + x, k + z).getBlockHardness(world, i, j + x, k + z) > 0F) world.func_147480_a(i, j + x, k + z, true);
}
return true;
}
-
+
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
amplifier = 0D;
if (!world.isRemote)
{
EntityPlayer entityplayer = (EntityPlayer) entity;
- int posX = (int)Math.floor(entityplayer.posX), posY = (int)Math.floor(entityplayer.posY), posZ = (int)Math.floor(entityplayer.posZ);
-
+ int posX = (int) Math.floor(entityplayer.posX), posY = (int) Math.floor(entityplayer.posY), posZ = (int) Math.floor(entityplayer.posZ);
+
if (JewelryNBT.isJewelX(stack, new ItemStack(Items.diamond))) amplifier = 1D;
else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.emerald))) amplifier = 2D;
- else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star))) amplifier = 5D;
-
- if(JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15)) && world.getBlock(posX, posY - 1, posZ) == Blocks.farmland)
- for(int i = (int) - amplifier; i <= amplifier; i++)
- for(int j = (int) - amplifier; j <= amplifier; j++)
- world.setBlockMetadataWithNotify(posX + i, posY - 1, posZ + j, 1, 7);
-
- List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(entityplayer.posX - amplifier, entityplayer.posY - amplifier, entityplayer.posZ - amplifier, entityplayer.posX + amplifier, entityplayer.posY + 2*amplifier, entityplayer.posZ + amplifier));
- if(JewelryNBT.isModeX(stack, "Activated"))
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star))) amplifier = 5D;
+
+ if (JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15)) && world.getBlock(posX, posY - 1, posZ) == Blocks.farmland) for (int i = (int) -amplifier; i <= amplifier; i++)
+ for (int j = (int) -amplifier; j <= amplifier; j++)
+ world.setBlockMetadataWithNotify(posX + i, posY - 1, posZ + j, 1, 7);
+
+ List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(entityplayer.posX - amplifier, entityplayer.posY - amplifier, entityplayer.posZ - amplifier, entityplayer.posX + amplifier, entityplayer.posY + 2 * amplifier, entityplayer.posZ + amplifier));
+ if (JewelryNBT.isModeX(stack, "Activated"))
{
- for(int i = 0; i < entities.size(); i++)
+ for (int i = 0; i < entities.size(); i++)
{
if (JewelryNBT.isModifierX(stack, new ItemStack(Items.blaze_powder))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.fireResistance.id, 4, 0, true));
else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.sugar))) ((EntityLivingBase) entities.get(i)).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 4, 0, true));
@@ -256,17 +266,16 @@ public class ItemNecklace extends Item
}
}
}
- }
-
+ }
+
public ItemStack getModifiedItemStack(ItemStack ingot, ItemStack modifier, ItemStack jewel)
{
ItemStack itemstack = new ItemStack(this);
JewelryNBT.addMetal(itemstack, ingot);
JewelryNBT.addModifier(itemstack, modifier);
JewelryNBT.addJewel(itemstack, jewel);
- if(JewelryNBT.isModifierEffectType(itemstack) && !(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.iron_pickaxe)))) JewelryNBT.addMode(itemstack, "Activated");
- if(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.book)))
- JewelryNBT.addMode(itemstack, "Disenchant");
+ if (JewelryNBT.isModifierEffectType(itemstack) && !(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.iron_pickaxe)))) JewelryNBT.addMode(itemstack, "Activated");
+ if (JewelryNBT.isJewelX(itemstack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.book))) JewelryNBT.addMode(itemstack, "Disenchant");
return itemstack;
- }
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemRing.java b/java/darkknight/jewelrycraft/item/ItemRing.java
index 265730a..55d4fc9 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemRing.java
+++ b/java/darkknight/jewelrycraft/item/ItemRing.java
@@ -14,6 +14,7 @@ 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.renderer.texture.TextureManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -52,25 +53,25 @@ public class ItemRing extends Item
public IIcon jewel;
private int amplifier, cooldown = 0;
int index = 0;
-
+
public ItemRing()
{
super();
this.setMaxStackSize(1);
}
-
+
public void registerIcons(IIconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("jewelrycraft:ring");
jewel = iconRegister.registerIcon("jewelrycraft:jewelRing");
}
-
+
@Override
public boolean requiresMultipleRenderPasses()
{
return true;
}
-
+
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass)
{
@@ -84,130 +85,141 @@ public class ItemRing extends Item
}
return 16777215;
}
-
+
public IIcon getIcon(ItemStack stack, int pass)
{
- if(pass == 0) return itemIcon;
- if(pass == 1 && JewelryNBT.jewel(stack) != null) return jewel;
+ if (pass == 0) return itemIcon;
+ if (pass == 1 && JewelryNBT.jewel(stack) != null) return jewel;
return itemIcon;
}
-
+
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 (pass == 0 && JewelryNBT.ingot(stack) != null && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215)
+ int x = 0, y = 0, ok = 0, red, green, blue;
+ if (pass == 0 && stack != null && JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0 && JewelryNBT.ingot(stack).getIconIndex() != null && JewelryNBT.ingotColor(stack) == 16777215)
{
- String ingotIconName = JewelryNBT.ingot(stack).getIconIndex().getIconName();
-
+ IIcon itemIcon = JewelryNBT.ingot(stack).getItem().getIcon(JewelryNBT.ingot(stack), 0);
+ String ingotIconName = itemIcon.getIconName();
+
if (ingotIconName.substring(0, ingotIconName.indexOf(":") + 1) != "") domain = ingotIconName.substring(0, ingotIconName.indexOf(":") + 1).replace(":", " ").trim();
else domain = "minecraft";
-
+
texture = ingotIconName.substring(ingotIconName.lastIndexOf(":") + 1) + ".png";
ResourceLocation ingot = null;
-
- if (JewelryNBT.ingot(stack).getUnlocalizedName().contains("item")) ingot = new ResourceLocation(domain, "textures/items/" + texture);
- else ingot = new ResourceLocation(domain, "textures/blocks/" + texture);
-
+ TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
+
+ if (texturemanager.getResourceLocation(JewelryNBT.ingot(stack).getItemSpriteNumber()).toString().contains("items")) ingot = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
+ else ingot = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
+
icon = ImageIO.read(rm.getResource(ingot).getInputStream());
- while(ok == 0)
+ while (ok == 0)
{
red = (icon.getRGB(x, y) >> 16) & 0xFF;
green = (icon.getRGB(x, y) >> 8) & 0xFF;
blue = icon.getRGB(x, y) & 0xFF;
- if(!isColorPretty(red, green, blue))
+ if (!isColorPretty(red, green, blue))
{
- if(x<icon.getTileWidth()-1) x++;
- if(x>=icon.getTileWidth()-1 && y<icon.getTileWidth()-1)
- {
- x=0;
+ 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;
+ if (x == icon.getTileWidth() - 1 && y == icon.getTileWidth() - 1) ok = 1;
}
- else ok=1;
+ else ok = 1;
}
JewelryNBT.addIngotColor(stack, icon.getRGB(x, y));
}
- else if (pass == 1 && JewelryNBT.jewel(stack) != null && JewelryNBT.jewel(stack).getIconIndex() != null && JewelryNBT.jewelColor(stack) == 16777215)
+ else if (pass == 1 && stack != null && JewelryNBT.jewel(stack) != null && JewelryNBT.jewel(stack).getIconIndex() != null && JewelryNBT.jewelColor(stack) == 16777215)
{
- x = 0; y = 0; ok=0;
- String jewelIconName = JewelryNBT.jewel(stack).getIconIndex().getIconName();
-
+ IIcon itemIcon = JewelryNBT.jewel(stack).getItem().getIconFromDamage(JewelryNBT.jewel(stack).getItemDamage());
+ String jewelIconName = itemIcon.getIconName();
+ x = 0;
+ y = 0;
+ ok = 0;
+
if (jewelIconName.substring(0, jewelIconName.indexOf(":") + 1) != "") domain = jewelIconName.substring(0, jewelIconName.indexOf(":") + 1).replace(":", " ").trim();
else domain = "minecraft";
-
+
texture = jewelIconName.substring(jewelIconName.lastIndexOf(":") + 1) + ".png";
ResourceLocation jewelLoc = null;
-
+
if (JewelryNBT.jewel(stack).getUnlocalizedName().contains("item")) jewelLoc = new ResourceLocation(domain, "textures/items/" + texture);
else jewelLoc = new ResourceLocation(domain, "textures/blocks/" + texture);
-
+
icon = ImageIO.read(rm.getResource(jewelLoc).getInputStream());
- while(ok == 0)
+ while (ok == 0)
{
red = (icon.getRGB(x, y) >> 16) & 0xFF;
green = (icon.getRGB(x, y) >> 8) & 0xFF;
blue = icon.getRGB(x, y) & 0xFF;
- if(!isColorPretty(red, green, blue))
+ if (!isColorPretty(red, green, blue))
{
- if(x<icon.getTileWidth()-1) x++;
- if(x>=icon.getTileWidth()-1 && y<icon.getTileWidth()-1)
- {
- x=0;
+ 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;
+ if (x == icon.getTileWidth() - 1 && y == icon.getTileWidth() - 1) ok = 1;
}
- else ok=1;
+ else ok = 1;
}
- if(JewelryNBT.jewel(stack).getItem().getColorFromItemStack(JewelryNBT.jewel(stack), 1) == 16777215) JewelryNBT.addJewelColor(stack, icon.getRGB(x, y));
+ if (JewelryNBT.jewel(stack).getItem().getColorFromItemStack(JewelryNBT.jewel(stack), 1) == 16777215) JewelryNBT.addJewelColor(stack, icon.getRGB(x, y));
else JewelryNBT.addJewelColor(stack, JewelryNBT.jewel(stack).getItem().getColorFromItemStack(JewelryNBT.jewel(stack), 1));
}
- if(pass == 0 && JewelryNBT.ingot(stack) != null) return JewelryNBT.ingotColor(stack);
- if(pass == 1 && JewelryNBT.jewel(stack) != null) return JewelryNBT.jewelColor(stack);
- else if(JewelryNBT.ingot(stack) != null) return JewelryNBT.ingotColor(stack);
+ if (pass == 0 && JewelryNBT.ingot(stack) != null) return JewelryNBT.ingotColor(stack);
+ if (pass == 1 && JewelryNBT.jewel(stack) != null) return JewelryNBT.jewelColor(stack);
+ else if (JewelryNBT.ingot(stack) != null) return JewelryNBT.ingotColor(stack);
return 16777215;
}
public static boolean isColorPretty(int r, int g, int b)
{
- if((r > 80 || g > 80 || b > 80) || (r > 80 && g > 80 && b > 80 && r < 230 && b < 230 && g < 230)) return true;
+ if ((r >= 100 && g >= 100 && b >= 100 && r < 230 && b < 230 && g < 230) || ((r >= 100 && (g < 100 || b < 100)) || (g >= 100 && (r < 100 || b < 100)) || (b >= 100 && (g < 100 || r < 100)))) return true;
else return false;
}
-
+
public String getItemStackDisplayName(ItemStack stack)
{
if (JewelryNBT.ingot(stack) != null && JewelryNBT.jewel(stack) != null && JewelryNBT.modifier(stack) == null && JewelryNBT.isJewelX(stack, new ItemStack(Items.diamond)) && JewelryNBT.isIngotX(stack, new ItemStack(Items.gold_ingot))) return "Wedding Ring";
- else if(JewelryNBT.ingot(stack) != null) return JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() + " " + ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
+ else if (JewelryNBT.ingot(stack) != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) return JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() + " " + ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
}
-
+
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
- if (!world.isRemote){
+ if (!world.isRemote)
+ {
if (JewelryNBT.playerPosX(stack) != -1 && JewelryNBT.playerPosY(stack) != -1 && JewelryNBT.playerPosZ(stack) != -1)
{
double posX = JewelryNBT.playerPosX(stack), posY = JewelryNBT.playerPosY(stack), posZ = JewelryNBT.playerPosZ(stack);
if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Items.bed)) && JewelryNBT.dimension(stack) != -2 && JewelryNBT.dimName(stack) != null)
{
int dimension = JewelryNBT.dimension(stack);
- for (int i = 1; i <= 20; i++) world.spawnParticle("largesmoke", player.posX - 0.5D + Math.random(), player.posY - 1.5D + Math.random(), player.posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ for (int i = 1; i <= 20; i++)
+ world.spawnParticle("largesmoke", player.posX - 0.5D + Math.random(), player.posY - 1.5D + Math.random(), player.posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
if (!JewelryNBT.isDimensionX(stack, player.dimension)) player.travelToDimension(dimension);
player.setPositionAndUpdate(posX, posY, posZ);
- for (int i = 1; i <= 300; i++) world.spawnParticle("portal", posX - 0.5D + Math.random(), posY + Math.random(), posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ for (int i = 1; i <= 300; i++)
+ world.spawnParticle("portal", posX - 0.5D + Math.random(), posY + Math.random(), posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
}
- else if(JewelryNBT.isDimensionX(stack, player.dimension))
+ else if (JewelryNBT.isDimensionX(stack, player.dimension))
{
- for (int i = 1; i <= 20; i++) world.spawnParticle("largesmoke", player.posX - 0.5D + Math.random(), player.posY - 1.5D + Math.random(), player.posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ for (int i = 1; i <= 20; i++)
+ world.spawnParticle("largesmoke", player.posX - 0.5D + Math.random(), player.posY - 1.5D + Math.random(), player.posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
player.setPositionAndUpdate(posX, posY, posZ);
- for (int i = 1; i <= 300; i++) world.spawnParticle("portal", posX - 0.5D + Math.random(), posY + Math.random(), posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
+ for (int i = 1; i <= 300; i++)
+ world.spawnParticle("portal", posX - 0.5D + Math.random(), posY + Math.random(), posZ - 0.5D + Math.random(), 0.0D, 0.0D, 0.0D);
}
else player.addChatMessage(new ChatComponentText("You can't teleport to these coordonates! You need to be in the same dimension they were set!"));
}
- else if(JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Items.bed)) && JewelryNBT.dimension(stack) == -2 && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1){
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Items.bed)) && JewelryNBT.dimension(stack) == -2 && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1)
+ {
JewelryNBT.addCoordonatesAndDimension(stack, player.posX, player.posY, player.posZ, world.provider.dimensionId, world.provider.getDimensionName());
JewelryNBT.addFakeEnchantment(stack);
}
@@ -216,37 +228,41 @@ public class ItemRing extends Item
InventoryEnderChest inventoryenderchest = player.getInventoryEnderChest();
player.displayGUIChest(inventoryenderchest);
}
- else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Blocks.chest))){
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Blocks.chest)))
+ {
int i = JewelryNBT.blockCoordX(stack), j = JewelryNBT.blockCoordY(stack), k = JewelryNBT.blockCoordZ(stack);
- if (player.getDistance(i + 0.5F, j + 0.5F, k + 0.5F) <= 128 && i != -1 && j != -1 && k != -1){
+ if (player.getDistance(i + 0.5F, j + 0.5F, k + 0.5F) <= 128 && i != -1 && j != -1 && k != -1)
+ {
Block block = world.getBlock(i, j, k);
- if (!block.isAir(world, i, j, k) && block instanceof BlockChest){
+ if (!block.isAir(world, i, j, k) && block instanceof BlockChest)
+ {
TileEntity tile = world.getTileEntity(i, j, k);
if (tile != null && tile instanceof TileEntityChest) FMLNetworkHandler.openGui(player, JewelrycraftMod.instance, 0, world, i, j, k);
}
}
- else if(i != -1 && j != -1 && k != -1) player.addChatMessage(new ChatComponentText("Chest out of range! You need to be " + ((int)player.getDistance(i + 0.5F, j + 0.5F, k + 0.5F) - 127) + " blocks closer."));
+ else if (i != -1 && j != -1 && k != -1) player.addChatMessage(new ChatComponentText("Chest out of range! You need to be " + ((int) player.getDistance(i + 0.5F, j + 0.5F, k + 0.5F) - 127) + " blocks closer."));
else player.addChatMessage(new ChatComponentText("You need to link the ring with a chest first, before using it!"));
}
- else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && !JewelryNBT.hasTag(stack, "modifier") && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1){
+ else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && !JewelryNBT.hasTag(stack, "modifier") && JewelryNBT.playerPosX(stack) == -1 && JewelryNBT.playerPosY(stack) == -1 && JewelryNBT.playerPosZ(stack) == -1)
+ {
JewelryNBT.addCoordonatesAndDimension(stack, player.posX, player.posY, player.posZ, world.provider.dimensionId, world.provider.getDimensionName());
JewelryNBT.addFakeEnchantment(stack);
}
-
- if(JewelryNBT.hasTag(stack, "mode"))
+
+ if (JewelryNBT.hasTag(stack, "mode"))
{
String mode = "";
- if(JewelryNBT.isModeX(stack, "Disenchant")) mode = "Transfer";
- else if(JewelryNBT.isModeX(stack, "Transfer")) mode = "Enchant";
- else if(JewelryNBT.isModeX(stack, "Enchant")) mode = "Disenchant";
- if(mode != "")
+ if (JewelryNBT.isModeX(stack, "Disenchant")) mode = "Transfer";
+ else if (JewelryNBT.isModeX(stack, "Transfer")) mode = "Enchant";
+ else if (JewelryNBT.isModeX(stack, "Enchant")) mode = "Disenchant";
+ if (mode != "")
{
player.addChatMessage(new ChatComponentText("Switched to " + mode + " mode"));
JewelryNBT.addMode(stack, mode);
}
- if(JewelryNBT.isModeX(stack, "Activated")) mode = "Deactivated";
- else if(JewelryNBT.isModeX(stack, "Deactivated")) mode = "Activated";
- if(mode != "" && mode != "Transfer" && mode != "Enchant" && mode != "Disenchant")
+ if (JewelryNBT.isModeX(stack, "Activated")) mode = "Deactivated";
+ else if (JewelryNBT.isModeX(stack, "Deactivated")) mode = "Activated";
+ if (mode != "" && mode != "Transfer" && mode != "Enchant" && mode != "Disenchant")
{
player.addChatMessage(new ChatComponentText("The Ring has been " + mode));
JewelryNBT.addMode(stack, mode);
@@ -255,11 +271,12 @@ public class ItemRing extends Item
}
return stack;
}
-
+
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity)
{
- if (!player.worldObj.isRemote && entity instanceof EntityLivingBase && JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(stack, new ItemStack(Blocks.chest)) && JewelryNBT.entity(stack, player) == null){
+ if (!player.worldObj.isRemote && entity instanceof EntityLivingBase && JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(stack, new ItemStack(Blocks.chest)) && JewelryNBT.entity(stack, player) == null)
+ {
JewelryNBT.addEntity(stack, entity);
JewelryNBT.addEntityID(stack, entity);
entity.setDead();
@@ -267,7 +284,7 @@ public class ItemRing extends Item
}
return true;
}
-
+
/**
* allows items to add custom lines of information to the mouseover
* description
@@ -277,160 +294,162 @@ public class ItemRing extends Item
if (stack.hasTagCompound() && stack.getDisplayName() != "Wedding Ring")
{
ItemStack ingot = JewelryNBT.ingot(stack);
- if (ingot != null) list.add("Ingot: " + EnumChatFormatting.YELLOW + ingot.getDisplayName());
-
+ if (ingot != null && Item.getIdFromItem(JewelryNBT.ingot(stack).getItem()) > 0) list.add("Ingot: " + EnumChatFormatting.YELLOW + ingot.getDisplayName());
+
ItemStack jewel = JewelryNBT.jewel(stack);
if (jewel != null) list.add("Jewel: " + EnumChatFormatting.BLUE + jewel.getDisplayName());
-
+
ItemStack modifier = JewelryNBT.modifier(stack);
- if(modifier != null) list.add("Modifier: " + EnumChatFormatting.DARK_PURPLE + modifier.getDisplayName());
-
+ if (modifier != null) list.add("Modifier: " + EnumChatFormatting.DARK_PURPLE + modifier.getDisplayName());
+
double playerPosX = JewelryNBT.playerPosX(stack), playerPosY = JewelryNBT.playerPosY(stack), playerPosZ = JewelryNBT.playerPosZ(stack);
- if(playerPosX != -1 && playerPosY != -1 && playerPosZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) playerPosX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) playerPosY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) playerPosZ);
-
- int posX = JewelryNBT.blockCoordX(stack), posY = JewelryNBT.blockCoordY(stack), posZ = JewelryNBT.blockCoordZ(stack);
- if(posX != -1 && posY != -1 && posZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) posX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) posY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) posZ);
-
+ if (playerPosX != -1 && playerPosY != -1 && playerPosZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) playerPosX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) playerPosY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) playerPosZ);
+
+ int posX = JewelryNBT.blockCoordX(stack), posY = JewelryNBT.blockCoordY(stack), posZ = JewelryNBT.blockCoordZ(stack);
+ if (posX != -1 && posY != -1 && posZ != -1) list.add(EnumChatFormatting.YELLOW + "X: " + EnumChatFormatting.GRAY + (int) posX + EnumChatFormatting.YELLOW + " Y: " + EnumChatFormatting.GRAY + (int) posY + EnumChatFormatting.YELLOW + " Z: " + EnumChatFormatting.GRAY + (int) posZ);
+
String name = JewelryNBT.dimName(stack);
- if(name != null) list.add("Dimension: " + EnumChatFormatting.DARK_GREEN + name);
-
+ if (name != null) list.add("Dimension: " + EnumChatFormatting.DARK_GREEN + name);
+
EntityLivingBase entity = JewelryNBT.entity(stack, player);
if (entity != null) list.add("Entity: " + EnumChatFormatting.GOLD + entity.getCommandSenderName());
-
+
String modeN = JewelryNBT.modeName(stack);
- if(modeN != null) list.add("Mode: " + modeN);
-
+ if (modeN != null) list.add("Mode: " + modeN);
+
int block = JewelryNBT.blockID(stack);
- if(block != -1) list.add("Block: " + StatCollector.translateToLocalFormatted(Block.getBlockById(block).getUnlocalizedName()));
-
+ if (block != -1) list.add("Block: " + StatCollector.translateToLocalFormatted(Block.getBlockById(block).getUnlocalizedName()));
+
int blockmeta = JewelryNBT.blockMetadata(stack);
- if(blockmeta != -1) list.add("Block Metadata: " + blockmeta);
-
+ if (blockmeta != -1) list.add("Block Metadata: " + blockmeta);
+
TileEntity tile = JewelryNBT.tileEntity(stack);
- if(tile != null) list.add(EnumChatFormatting.RED + "Contains a tile entity");
-
+ if (tile != null) list.add(EnumChatFormatting.RED + "Contains a tile entity");
+
int blockX = JewelryNBT.blockCoordX(stack);
- if(blockX != -1) list.add("Block Coords X: " + blockX);
-
+ if (blockX != -1) list.add("Block Coords X: " + blockX);
+
int blockY = JewelryNBT.blockCoordY(stack);
- if(blockY != -1) list.add("Block Coords Y: " + blockY);
-
+ if (blockY != -1) list.add("Block Coords Y: " + blockY);
+
int blockZ = JewelryNBT.blockCoordZ(stack);
- if(blockZ != -1) list.add("Block Coords Z: " + blockZ);
-
- // int colorI = JewelryNBT.ingotColor(stack);
- // if(colorI != -1) list.add("Ingot Color: " + colorI);
- //
- // int colorJ = JewelryNBT.jewelColor(stack);
- // if(colorJ != -1) list.add("Jewel Color: " + colorJ);
+ if (blockZ != -1) list.add("Block Coords Z: " + blockZ);
+
+ // int colorI = JewelryNBT.ingotColor(stack);
+ // if(colorI != -1) list.add("Ingot Color: " + colorI);
+ //
+ // int colorJ = JewelryNBT.jewelColor(stack);
+ // if(colorJ != -1) list.add("Jewel Color: " + colorJ);
}
}
-
+
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int i, int j, int k, int side, float par8, float par9, float par10)
{
amplifier = 0;
if (JewelryNBT.isJewelX(stack, new ItemStack(Items.diamond))) amplifier = 1;
else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.emerald))) amplifier = 2;
else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star))) amplifier = 7;
-
+
if (!world.isRemote)
{
EntityLivingBase entity = JewelryNBT.entity(stack, player);
boolean used = false;
- if(entity != null && entity instanceof EntityLivingBase){
+ if (entity != null && entity instanceof EntityLivingBase)
+ {
entity.setLocationAndAngles(i + 0.5D, j + 1D, k + 0.5D, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
world.spawnEntityInWorld(entity);
JewelryNBT.removeEntity(stack);
}
if (JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(stack, new ItemStack(Blocks.chest)) && world.getBlock(i, j, k) == Blocks.chest) JewelryNBT.addBlockCoordonates(stack, i, j, k);
onItemRightClick(stack, world, player);
- if(JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15))) world.scheduleBlockUpdate(i, j, k, world.getBlock(i, j, k), 7 - amplifier);
- if(JewelryNBT.isModifierX(stack, new ItemStack(Items.diamond_pickaxe)) && JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)))
+ if (JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15))) world.scheduleBlockUpdate(i, j, k, world.getBlock(i, j, k), 7 - amplifier);
+ if (JewelryNBT.isModifierX(stack, new ItemStack(Items.diamond_pickaxe)) && JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)))
{
- if(JewelryNBT.hasTag(stack, "blockID") && !used)
+ if (JewelryNBT.hasTag(stack, "blockID") && !used)
{
int shiftX = 0, shiftY = 0, shiftZ = 0;
- if(side == 0) shiftY = -1;
- else if(side == 1) shiftY = 1;
- else if(side == 2) shiftZ = -1;
- else if(side == 3) shiftZ = 1;
- else if(side == 4) shiftX = -1;
- else if(side == 5) shiftX = 1;
+ if (side == 0) shiftY = -1;
+ else if (side == 1) shiftY = 1;
+ else if (side == 2) shiftZ = -1;
+ else if (side == 3) shiftZ = 1;
+ else if (side == 4) shiftX = -1;
+ else if (side == 5) shiftX = 1;
world.setBlock(i + shiftX, j + shiftY, k + shiftZ, Block.getBlockById(JewelryNBT.blockID(stack)));
world.setBlockMetadataWithNotify(i + shiftX, j + shiftY, k + shiftZ, JewelryNBT.blockMetadata(stack), 2);
- if(JewelryNBT.hasTag(stack, "tile")) world.setTileEntity(i + shiftX, j + shiftY, k + shiftZ, JewelryNBT.tileEntity(stack));
- if(JewelryNBT.tileEntity(stack) instanceof TileEntitySkull) ((BlockSkull)Blocks.skull).func_149965_a(world, i + shiftX, j + shiftY, k + shiftZ, (TileEntitySkull)JewelryNBT.tileEntity(stack));
- if(Block.getBlockById(JewelryNBT.blockID(stack)) == Blocks.pumpkin || Block.getBlockById(JewelryNBT.blockID(stack)) == Blocks.lit_pumpkin) createGolems(world, i + shiftX, j + shiftY, k + shiftZ);
+ if (JewelryNBT.hasTag(stack, "tile")) world.setTileEntity(i + shiftX, j + shiftY, k + shiftZ, JewelryNBT.tileEntity(stack));
+ if (JewelryNBT.tileEntity(stack) instanceof TileEntitySkull) ((BlockSkull) Blocks.skull).func_149965_a(world, i + shiftX, j + shiftY, k + shiftZ, (TileEntitySkull) JewelryNBT.tileEntity(stack));
+ if (Block.getBlockById(JewelryNBT.blockID(stack)) == Blocks.pumpkin || Block.getBlockById(JewelryNBT.blockID(stack)) == Blocks.lit_pumpkin) createGolems(world, i + shiftX, j + shiftY, k + shiftZ);
JewelryNBT.removeBlock(stack);
used = true;
}
-
- if(!JewelryNBT.hasTag(stack, "tile") && world.getTileEntity(i, j, k) != null && !used && world.getBlock(i, j, k).getBlockHardness(world, i, j, k) > 0F){
+
+ if (!JewelryNBT.hasTag(stack, "tile") && world.getTileEntity(i, j, k) != null && !used && world.getBlock(i, j, k).getBlockHardness(world, i, j, k) > 0F)
+ {
JewelryNBT.addTileEntityBlock(stack, world, i, j, k);
world.removeTileEntity(i, j, k);
world.setBlock(i, j, k, Block.getBlockById(0));
}
- else if(!JewelryNBT.hasTag(stack, "blockID") && !used && world.getBlock(i, j, k).getBlockHardness(world, i, j, k) > 0F){
+ else if (!JewelryNBT.hasTag(stack, "blockID") && !used && world.getBlock(i, j, k).getBlockHardness(world, i, j, k) > 0F)
+ {
JewelryNBT.addBlock(stack, Block.getIdFromBlock(world.getBlock(i, j, k)), world.getBlockMetadata(i, j, k));
JewelryNBT.addBlockCoordonates(stack, i, j, k);
world.setBlock(i, j, k, Block.getBlockById(0));
}
}
- if(JewelryNBT.isModifierX(stack, new ItemStack(Items.diamond_pickaxe)) && JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star)) && JewelryNBT.isIngotX(stack, new ItemStack(ItemList.shadowIngot)) && j > 0 && world.getBlock(i, j, k).getBlockHardness(world, i, j, k) > 0F)
- world.func_147480_a(i, j, k, true);
+ if (JewelryNBT.isModifierX(stack, new ItemStack(Items.diamond_pickaxe)) && JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star)) && JewelryNBT.isIngotX(stack, new ItemStack(ItemList.shadowIngot)) && j > 0 && world.getBlock(i, j, k).getBlockHardness(world, i, j, k) > 0F) world.func_147480_a(i, j, k, true);
}
return true;
}
-
+
public boolean canDisenchant(EntityPlayer player)
{
- if(player.capabilities.isCreativeMode) return true;
- else if(player.experienceLevel >= 2) return true;
+ if (player.capabilities.isCreativeMode) return true;
+ else if (player.experienceLevel >= 2) return true;
return false;
}
-
+
public void dynamicLight(World world, EntityPlayer player)
{
- world.setBlock((int)player.prevPosX, (int)player.prevPosY, (int)player.prevPosZ, Block.getBlockById(0));
- world.setBlock((int)player.posX, (int)player.posY, (int)player.posZ, BlockList.glow);
+ world.setBlock((int) player.prevPosX, (int) player.prevPosY, (int) player.prevPosZ, Block.getBlockById(0));
+ world.setBlock((int) player.posX, (int) player.posY, (int) player.posZ, BlockList.glow);
}
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
+
+ @SuppressWarnings(
+ { "unchecked", "rawtypes" })
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5)
{
amplifier = 0;
- if(cooldown > 0) cooldown--;
- if (!world.isRemote){
+ if (cooldown > 0) cooldown--;
+ if (!world.isRemote)
+ {
EntityPlayer entityplayer = (EntityPlayer) entity;
- int posX = (int)Math.floor(entityplayer.posX), posY = (int)Math.floor(entityplayer.posY), posZ = (int)Math.floor(entityplayer.posZ);
-
+ int posX = (int) Math.floor(entityplayer.posX), posY = (int) Math.floor(entityplayer.posY), posZ = (int) Math.floor(entityplayer.posZ);
+
if (JewelryNBT.isJewelX(stack, new ItemStack(Items.diamond))) amplifier = 1;
else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.emerald))) amplifier = 2;
else if (JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star))) amplifier = 7;
-
- if(JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15)) && world.getBlock(posX, posY - 1, posZ) == Blocks.farmland)
- world.setBlockMetadataWithNotify(posX, posY - 1, posZ, 1, 7);
-
- if(JewelryNBT.isModeX(stack, "Activated"))
+
+ if (JewelryNBT.isModifierX(stack, new ItemStack(Items.dye, 1, 15)) && world.getBlock(posX, posY - 1, posZ) == Blocks.farmland) world.setBlockMetadataWithNotify(posX, posY - 1, posZ, 1, 7);
+
+ if (JewelryNBT.isModeX(stack, "Activated"))
{
- if (JewelryNBT.isModifierX(stack, new ItemStack(Items.blaze_powder)) && entityplayer != null)
- entityplayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 4, amplifier, true));
+ if (JewelryNBT.isModifierX(stack, new ItemStack(Items.blaze_powder)) && entityplayer != null) entityplayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 4, amplifier, true));
else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.sugar)) && entityplayer != null)
{
entityplayer.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 4, amplifier, true));
- entityplayer.addExhaustion(0.05f*amplifier);
+ entityplayer.addExhaustion(0.05f * amplifier);
}
- else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.iron_pickaxe)) && entityplayer != null && !JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl)))
- entityplayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 4, amplifier, true));
+ else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.iron_pickaxe)) && entityplayer != null && !JewelryNBT.isJewelX(stack, new ItemStack(Items.ender_pearl))) entityplayer.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 4, amplifier, true));
else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.feather)) && entityplayer != null)
{
entityplayer.addPotionEffect(new PotionEffect(Potion.jump.id, 4, amplifier, true));
- if(entityplayer.inventory.armorInventory[0] != null)
+ if (entityplayer.inventory.armorInventory[0] != null)
{
int damage = entityplayer.inventory.armorInventory[0].getMaxDamage() - entityplayer.inventory.armorInventory[0].getItemDamage();
- if(damage - entityplayer.fallDistance > 0){
- entityplayer.inventory.armorInventory[0].damageItem((int)entityplayer.fallDistance, entityplayer);
+ if (damage - entityplayer.fallDistance > 0)
+ {
+ entityplayer.inventory.armorInventory[0].damageItem((int) entityplayer.fallDistance, entityplayer);
entityplayer.fallDistance = 0;
}
else
@@ -442,60 +461,60 @@ public class ItemRing extends Item
}
else if (JewelryNBT.isModifierX(stack, new ItemStack(Items.potionitem, 1, 8270)) && entityplayer != null) entityplayer.addPotionEffect(new PotionEffect(Potion.invisibility.id, 4, amplifier, true));
}
- if(entityplayer.inventory.getCurrentItem() != null && JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(stack, new ItemStack(Items.book)) && entityplayer.inventory.getCurrentItem().getItem() == stack.getItem())
+ if (entityplayer.inventory.getCurrentItem() != null && JewelryNBT.isJewelX(stack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(stack, new ItemStack(Items.book)) && entityplayer.inventory.getCurrentItem().getItem() == stack.getItem())
{
ItemStack item = null;
- if(entityplayer.inventory.currentItem + 1 <= 8 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1).isItemEnchanted()) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1);
- if(entityplayer.inventory.currentItem - 1 >= 0 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1) != null && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1).isItemEnchanted()) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1);
- if(item != null && JewelryNBT.isModeX(stack, "Disenchant"))
+ if (entityplayer.inventory.currentItem + 1 <= 8 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1).isItemEnchanted()) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1);
+ if (entityplayer.inventory.currentItem - 1 >= 0 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1) != null && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1).isItemEnchanted()) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1);
+ if (item != null && JewelryNBT.isModeX(stack, "Disenchant"))
{
ItemStack enchBook = new ItemStack(Items.enchanted_book);
Map enchItem = EnchantmentHelper.getEnchantments(item);
Map book = EnchantmentHelper.getEnchantments(enchBook);
Iterator iterator = enchItem.keySet().iterator();
int e;
-
+
if (iterator.hasNext() && canDisenchant(entityplayer))
- {
- e = ((Integer)iterator.next()).intValue();
- book.put(Integer.valueOf(e), Integer.valueOf(((Integer)enchItem.get(Integer.valueOf(e))).intValue()));
+ {
+ e = ((Integer) iterator.next()).intValue();
+ book.put(Integer.valueOf(e), Integer.valueOf(((Integer) enchItem.get(Integer.valueOf(e))).intValue()));
EnchantmentHelper.setEnchantments(book, enchBook);
- if(entityplayer.inventory.addItemStackToInventory(enchBook))
+ if (entityplayer.inventory.addItemStackToInventory(enchBook))
{
- if(!entityplayer.capabilities.isCreativeMode)
+ if (!entityplayer.capabilities.isCreativeMode)
{
entityplayer.addExperienceLevel(-2);
entityplayer.heal(-1f);
}
enchItem.remove(Integer.valueOf(e));
- if(item.isItemStackDamageable() && (item.getMaxDamage() - item.getItemDamage())/3 > 0) item.damageItem((item.getMaxDamage() - item.getItemDamage())/3, entityplayer);
+ if (item.isItemStackDamageable() && (item.getMaxDamage() - item.getItemDamage()) / 3 > 0) item.damageItem((item.getMaxDamage() - item.getItemDamage()) / 3, entityplayer);
EnchantmentHelper.setEnchantments(enchItem, item);
}
}
}
- if(entityplayer.inventory.currentItem + 1 <= 8 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null && entityplayer.inventory.currentItem - 1 >= 0 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1) != null && JewelryNBT.isModeX(stack, "Transfer"))
+ if (entityplayer.inventory.currentItem + 1 <= 8 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null && entityplayer.inventory.currentItem - 1 >= 0 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1) != null && JewelryNBT.isModeX(stack, "Transfer"))
{
- if(cooldown > 0) entityplayer.addChatMessage(new ChatComponentText("Ring is currently cooling down!"));
+ if (cooldown > 0) entityplayer.addChatMessage(new ChatComponentText("Ring is currently cooling down!"));
ItemStack enchantedItem = null, enchantableItem = null;
- if(entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1).isItemEnchanted() && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null)
+ if (entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1).isItemEnchanted() && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null)
{
enchantedItem = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1);
enchantableItem = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1);
-
+
}
- if(enchantedItem != null && enchantableItem != null)
+ if (enchantedItem != null && enchantableItem != null)
{
Map enchItem = EnchantmentHelper.getEnchantments(enchantedItem);
Map resultItem = EnchantmentHelper.getEnchantments(enchantableItem);
Iterator iterator = enchItem.keySet().iterator();
int e;
-
+
if (iterator.hasNext() && cooldown == 0)
- {
- e = ((Integer)iterator.next()).intValue();
- if(!EnchantmentHelper.getEnchantments(enchantableItem).containsKey(Integer.valueOf(e)))
+ {
+ e = ((Integer) iterator.next()).intValue();
+ if (!EnchantmentHelper.getEnchantments(enchantableItem).containsKey(Integer.valueOf(e)))
{
- resultItem.put(Integer.valueOf(e), Integer.valueOf(((Integer)enchItem.get(Integer.valueOf(e))).intValue()));
+ resultItem.put(Integer.valueOf(e), Integer.valueOf(((Integer) enchItem.get(Integer.valueOf(e))).intValue()));
EnchantmentHelper.setEnchantments(resultItem, enchantableItem);
enchItem.remove(Integer.valueOf(e));
EnchantmentHelper.setEnchantments(enchItem, enchantedItem);
@@ -504,33 +523,32 @@ public class ItemRing extends Item
}
}
}
- if(entityplayer.inventory.currentItem + 1 <= 8 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1);
- else if(entityplayer.inventory.currentItem - 1 >= 0 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1) != null) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1);
- if(item != null && !item.isItemEnchanted() && item.isItemEnchantable() && entityplayer.experienceLevel > 0 && JewelryNBT.isModeX(stack, "Enchant"))
+ if (entityplayer.inventory.currentItem + 1 <= 8 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1) != null) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem + 1);
+ else if (entityplayer.inventory.currentItem - 1 >= 0 && entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1) != null) item = entityplayer.inventory.getStackInSlot(entityplayer.inventory.currentItem - 1);
+ if (item != null && !item.isItemEnchanted() && item.isItemEnchantable() && entityplayer.experienceLevel > 0 && JewelryNBT.isModeX(stack, "Enchant"))
{
Map enchItem = EnchantmentHelper.getEnchantments(item);
int level = entityplayer.experienceLevel;
- if(entityplayer.experienceLevel > 6) level = 6;
- if(!entityplayer.capabilities.isCreativeMode) entityplayer.addExperienceLevel(-level);
+ if (entityplayer.experienceLevel > 6) level = 6;
+ if (!entityplayer.capabilities.isCreativeMode) entityplayer.addExperienceLevel(-level);
enchItem.put(Enchantment.enchantmentsBookList[new Random().nextInt(Enchantment.enchantmentsBookList.length)].effectId, level);
EnchantmentHelper.setEnchantments(enchItem, item);
}
}
}
}
-
+
public ItemStack getModifiedItemStack(ItemStack ingot, ItemStack modifier, ItemStack jewel)
{
ItemStack itemstack = new ItemStack(this);
JewelryNBT.addMetal(itemstack, ingot);
JewelryNBT.addModifier(itemstack, modifier);
JewelryNBT.addJewel(itemstack, jewel);
- if(JewelryNBT.isModifierEffectType(itemstack) && !(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.iron_pickaxe)))) JewelryNBT.addMode(itemstack, "Activated");
- if(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.book)))
- JewelryNBT.addMode(itemstack, "Disenchant");
+ if (JewelryNBT.isModifierEffectType(itemstack) && !(JewelryNBT.isJewelX(itemstack, new ItemStack(Items.ender_pearl)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.iron_pickaxe)))) JewelryNBT.addMode(itemstack, "Activated");
+ if (JewelryNBT.isJewelX(itemstack, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(itemstack, new ItemStack(Items.book))) JewelryNBT.addMode(itemstack, "Disenchant");
return itemstack;
}
-
+
public void createGolems(World world, int i, int j, int k)
{
if (world.getBlock(i, j - 1, k) == Blocks.snow && world.getBlock(i, j - 2, k) == Blocks.snow)
@@ -541,29 +559,29 @@ public class ItemRing extends Item
world.setBlock(i, j - 1, k, Block.getBlockById(0), 0, 2);
world.setBlock(i, j - 2, k, Block.getBlockById(0), 0, 2);
EntitySnowman entitysnowman = new EntitySnowman(world);
- entitysnowman.setLocationAndAngles((double)i + 0.5D, (double)j - 1.95D, (double)k + 0.5D, 0.0F, 0.0F);
+ entitysnowman.setLocationAndAngles((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F);
world.spawnEntityInWorld(entitysnowman);
world.notifyBlockChange(i, j, k, Block.getBlockById(0));
world.notifyBlockChange(i, j - 1, k, Block.getBlockById(0));
world.notifyBlockChange(i, j - 2, k, Block.getBlockById(0));
}
-
+
for (int l = 0; l < 120; ++l)
{
- world.spawnParticle("snowshovel", (double)i + world.rand.nextDouble(), (double)(j - 2) + world.rand.nextDouble() * 2.5D, (double)k + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("snowshovel", (double) i + world.rand.nextDouble(), (double) (j - 2) + world.rand.nextDouble() * 2.5D, (double) k + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
}
}
else if (world.getBlock(i, j - 1, k) == Blocks.iron_block && world.getBlock(i, j - 2, k) == Blocks.iron_block)
{
boolean flag = world.getBlock(i - 1, j - 1, k) == Blocks.iron_block && world.getBlock(i + 1, j - 1, k) == Blocks.iron_block;
boolean flag1 = world.getBlock(i, j - 1, k - 1) == Blocks.iron_block && world.getBlock(i, j - 1, k + 1) == Blocks.iron_block;
-
+
if (flag || flag1)
{
world.setBlock(i, j, k, Block.getBlockById(0), 0, 2);
world.setBlock(i, j - 1, k, Block.getBlockById(0), 0, 2);
world.setBlock(i, j - 2, k, Block.getBlockById(0), 0, 2);
-
+
if (flag)
{
world.setBlock(i - 1, j - 1, k, Block.getBlockById(0), 0, 2);
@@ -574,21 +592,21 @@ public class ItemRing extends Item
world.setBlock(i, j - 1, k - 1, Block.getBlockById(0), 0, 2);
world.setBlock(i, j - 1, k + 1, Block.getBlockById(0), 0, 2);
}
-
+
EntityIronGolem entityirongolem = new EntityIronGolem(world);
entityirongolem.setPlayerCreated(true);
- entityirongolem.setLocationAndAngles((double)i + 0.5D, (double)j - 1.95D, (double)k + 0.5D, 0.0F, 0.0F);
+ entityirongolem.setLocationAndAngles((double) i + 0.5D, (double) j - 1.95D, (double) k + 0.5D, 0.0F, 0.0F);
world.spawnEntityInWorld(entityirongolem);
-
+
for (int i1 = 0; i1 < 120; ++i1)
{
- world.spawnParticle("snowballpoof", (double)i + world.rand.nextDouble(), (double)(j - 2) + world.rand.nextDouble() * 3.9D, (double)k + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
+ world.spawnParticle("snowballpoof", (double) i + world.rand.nextDouble(), (double) (j - 2) + world.rand.nextDouble() * 3.9D, (double) k + world.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
}
-
+
world.notifyBlockChange(i, j, k, Block.getBlockById(0));
world.notifyBlockChange(i, j - 1, k, Block.getBlockById(0));
world.notifyBlockChange(i, j - 2, k, Block.getBlockById(0));
-
+
if (flag)
{
world.notifyBlockChange(i - 1, j - 1, k, Block.getBlockById(0));
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java b/java/darkknight/jewelrycraft/item/ItemThiefGloves.java
index f61085a..344f9a6 100644
--- a/src/main/java/darkknight/jewelrycraft/item/ItemThiefGloves.java
+++ b/java/darkknight/jewelrycraft/item/ItemThiefGloves.java
@@ -50,16 +50,13 @@ public class ItemThiefGloves extends Item
MerchantRecipe recipe = (MerchantRecipe) iterator.next();
int toolUses = (Integer) ReflectionHelper.getPrivateValue(MerchantRecipe.class, recipe, "toolUses", "field_77400_d");
int quantity;
- if (recipe.getItemToSell().isStackable())
- quantity = recipe.getItemToSell().stackSize * (7 - toolUses);
- else
- quantity = 1;
+ if (recipe.getItemToSell().isStackable()) quantity = recipe.getItemToSell().stackSize * (7 - toolUses);
+ else quantity = 1;
ItemStack s = new ItemStack(recipe.getItemToSell().getItem(), quantity, recipe.getItemToSell().getItemDamage());
s.setTagCompound(recipe.getItemToSell().getTagCompound());
if (par2EntityPlayer.inventory.addItemStackToInventory(s))
- ;
- else
- villager.entityDropItem(s, 0);
+ ;
+ else villager.entityDropItem(s, 0);
par2EntityPlayer.addChatMessage(new ChatComponentText("Villager #" + villager.getProfession() + ": Hmmm... I seem to have lost my " + s.getDisplayName() + "!"));
stack.damageItem(1, par2EntityPlayer);
}
@@ -82,8 +79,7 @@ public class ItemThiefGloves extends Item
@SuppressWarnings("unchecked")
public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings("rawtypes") List list, boolean par4)
{
- if (!shouldAddAdditionalInfo())
- list.add(EnumChatFormatting.GRAY + additionalInfoInstructions());
+ if (!shouldAddAdditionalInfo()) list.add(EnumChatFormatting.GRAY + additionalInfoInstructions());
else
{
list.add(EnumChatFormatting.GRAY + "Right click with the gloves,");
@@ -96,10 +92,7 @@ public class ItemThiefGloves extends Item
{
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
{
- if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
- {
- return true;
- }
+ if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { return true; }
}
return false;
}
diff --git a/java/darkknight/jewelrycraft/lib/Reference.java b/java/darkknight/jewelrycraft/lib/Reference.java
new file mode 100644
index 0000000..9460584
--- /dev/null
+++ b/java/darkknight/jewelrycraft/lib/Reference.java
@@ -0,0 +1,9 @@
+package darkknight.jewelrycraft.lib;
+
+public class Reference
+{
+ public static final String MODID = "Jewelrycraft";
+ public static final String MODNAME = "Jewelrycraft";
+ public static final String VERSION = "1.4.2";
+ public static final String PACKET_CHANNEL = "Jewelrycraft";
+}
diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java b/java/darkknight/jewelrycraft/model/ModelDisplayer.java
index 9764ca0..3a45957 100644
--- a/src/main/java/darkknight/jewelrycraft/model/ModelDisplayer.java
+++ b/java/darkknight/jewelrycraft/model/ModelDisplayer.java
@@ -8,7 +8,7 @@ import net.minecraft.entity.Entity;
public class ModelDisplayer extends ModelBase
{
- //fields
+ // fields
ModelRenderer Base;
ModelRenderer Ring11;
ModelRenderer Ring12;
@@ -34,12 +34,12 @@ public class ModelDisplayer extends ModelBase
ModelRenderer Ring310;
ModelRenderer Ring311;
ModelRenderer Ring312;
-
+
public ModelDisplayer()
{
textureWidth = 64;
textureHeight = 32;
-
+
Base = new ModelRenderer(this, 0, 0);
Base.addBox(0F, 0F, 0F, 16, 3, 16);
Base.setRotationPoint(-8F, 21F, -8F);
@@ -191,7 +191,7 @@ public class ModelDisplayer extends ModelBase
Ring312.mirror = true;
setRotation(Ring312, 0F, 0F, 0F);
}
-
+
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
GL11.glPushMatrix();
@@ -225,17 +225,17 @@ public class ModelDisplayer extends ModelBase
Ring312.render(f5);
GL11.glPopMatrix();
}
-
+
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
-
+
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
}
-
+
}
diff --git a/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java b/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java
new file mode 100644
index 0000000..8724040
--- /dev/null
+++ b/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java
@@ -0,0 +1,140 @@
+package darkknight.jewelrycraft.model;
+
+import net.minecraft.client.model.ModelBase;
+import net.minecraft.client.model.ModelRenderer;
+import net.minecraft.entity.Entity;
+
+public class ModelJewlersCraftingBench extends ModelBase
+{
+ // fields
+ ModelRenderer Leg1;
+ ModelRenderer Leg2;
+ ModelRenderer Leg3;
+ ModelRenderer Leg4;
+ ModelRenderer Top;
+ ModelRenderer Support1;
+ ModelRenderer Support2;
+ ModelRenderer Support3;
+ ModelRenderer Support4;
+ ModelRenderer Support5;
+ ModelRenderer Support6;
+ ModelRenderer Support7;
+ ModelRenderer Support8;
+
+ public ModelJewlersCraftingBench()
+ {
+ textureWidth = 64;
+ textureHeight = 32;
+
+ Leg1 = new ModelRenderer(this, 0, 0);
+ Leg1.addBox(0F, 0F, 0F, 2, 10, 2);
+ Leg1.setRotationPoint(-6F, 14F, 4F);
+ Leg1.setTextureSize(64, 32);
+ Leg1.mirror = true;
+ setRotation(Leg1, 0F, 0F, 0F);
+ Leg2 = new ModelRenderer(this, 0, 0);
+ Leg2.addBox(0F, 0F, 0F, 2, 10, 2);
+ Leg2.setRotationPoint(-6F, 14F, -6F);
+ Leg2.setTextureSize(64, 32);
+ Leg2.mirror = true;
+ setRotation(Leg2, 0F, 0F, 0F);
+ Leg3 = new ModelRenderer(this, 0, 0);
+ Leg3.addBox(0F, 0F, 0F, 2, 10, 2);
+ Leg3.setRotationPoint(4F, 14F, -6F);
+ Leg3.setTextureSize(64, 32);
+ Leg3.mirror = true;
+ setRotation(Leg3, 0F, 0F, 0F);
+ Leg4 = new ModelRenderer(this, 0, 0);
+ Leg4.addBox(0F, 0F, 0F, 2, 10, 2);
+ Leg4.setRotationPoint(4F, 14F, 4F);
+ Leg4.setTextureSize(64, 32);
+ Leg4.mirror = true;
+ setRotation(Leg4, 0F, 0F, 0F);
+ Top = new ModelRenderer(this, 0, 13);
+ Top.addBox(0F, 0F, 0F, 16, 1, 16);
+ Top.setRotationPoint(-8F, 13F, -8F);
+ Top.setTextureSize(64, 32);
+ Top.mirror = true;
+ setRotation(Top, 0F, 0F, 0F);
+ Support1 = new ModelRenderer(this, 0, 0);
+ Support1.addBox(0F, 0F, 0F, 3, 1, 1);
+ Support1.setRotationPoint(3F, 12F, 5F);
+ Support1.setTextureSize(64, 32);
+ Support1.mirror = true;
+ setRotation(Support1, 0F, 0F, 0F);
+ Support2 = new ModelRenderer(this, 0, 0);
+ Support2.addBox(0F, 0F, 0F, 1, 1, 3);
+ Support2.setRotationPoint(2F, 12F, 2F);
+ Support2.setTextureSize(64, 32);
+ Support2.mirror = true;
+ setRotation(Support2, 0F, 0F, 0F);
+ Support3 = new ModelRenderer(this, 0, 0);
+ Support3.addBox(0F, 0F, 0F, 1, 1, 3);
+ Support3.setRotationPoint(6F, 12F, 2F);
+ Support3.setTextureSize(64, 32);
+ Support3.mirror = true;
+ setRotation(Support3, 0F, 0F, 0F);
+ Support4 = new ModelRenderer(this, 0, 0);
+ Support4.addBox(0F, 0F, 0F, 3, 1, 1);
+ Support4.setRotationPoint(3F, 12F, 1F);
+ Support4.setTextureSize(64, 32);
+ Support4.mirror = true;
+ setRotation(Support4, 0F, 0F, 0F);
+ Support5 = new ModelRenderer(this, 0, 0);
+ Support5.addBox(0F, 0F, 0F, 1, 1, 3);
+ Support5.setRotationPoint(-3F, 12F, 2F);
+ Support5.setTextureSize(64, 32);
+ Support5.mirror = true;
+ setRotation(Support5, 0F, 0F, 0F);
+ Support6 = new ModelRenderer(this, 0, 0);
+ Support6.addBox(0F, 0F, 0F, 3, 1, 1);
+ Support6.setRotationPoint(-6F, 12F, 5F);
+ Support6.setTextureSize(64, 32);
+ Support6.mirror = true;
+ setRotation(Support6, 0F, 0F, 0F);
+ Support7 = new ModelRenderer(this, 0, 0);
+ Support7.addBox(0F, 0F, 0F, 1, 1, 3);
+ Support7.setRotationPoint(-7F, 12F, 2F);
+ Support7.setTextureSize(64, 32);
+ Support7.mirror = true;
+ setRotation(Support7, 0F, 0F, 0F);
+ Support8 = new ModelRenderer(this, 0, 0);
+ Support8.addBox(0F, 0F, 0F, 3, 1, 1);
+ Support8.setRotationPoint(-6F, 12F, 1F);
+ Support8.setTextureSize(64, 32);
+ Support8.mirror = true;
+ setRotation(Support8, 0F, 0F, 0F);
+ }
+
+ public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
+ {
+ super.render(entity, f, f1, f2, f3, f4, f5);
+ setRotationAngles(f, f1, f2, f3, f4, f5);
+ Leg1.render(f5);
+ Leg2.render(f5);
+ Leg3.render(f5);
+ Leg4.render(f5);
+ Top.render(f5);
+ Support1.render(f5);
+ Support2.render(f5);
+ Support3.render(f5);
+ Support4.render(f5);
+ Support5.render(f5);
+ Support6.render(f5);
+ Support7.render(f5);
+ Support8.render(f5);
+ }
+
+ private void setRotation(ModelRenderer model, float x, float y, float z)
+ {
+ model.rotateAngleX = x;
+ model.rotateAngleY = y;
+ model.rotateAngleZ = z;
+ }
+
+ public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
+ {
+ super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
+ }
+
+}
diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java b/java/darkknight/jewelrycraft/model/ModelMolder.java
index 374b218..9e719ea 100644
--- a/src/main/java/darkknight/jewelrycraft/model/ModelMolder.java
+++ b/java/darkknight/jewelrycraft/model/ModelMolder.java
@@ -6,7 +6,7 @@ import net.minecraft.entity.Entity;
public class ModelMolder extends ModelBase
{
- //fields
+ // fields
ModelRenderer Base;
ModelRenderer Side;
ModelRenderer Side1;
diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java b/java/darkknight/jewelrycraft/model/ModelSmelter.java
index afb3b09..8abcd3d 100644
--- a/src/main/java/darkknight/jewelrycraft/model/ModelSmelter.java
+++ b/java/darkknight/jewelrycraft/model/ModelSmelter.java
@@ -6,7 +6,7 @@ import net.minecraft.entity.Entity;
public class ModelSmelter extends ModelBase
{
- //fields
+ // fields
ModelRenderer Support1;
ModelRenderer Support2;
ModelRenderer Hold1;
diff --git a/java/darkknight/jewelrycraft/network/PacketClearColorCache.java b/java/darkknight/jewelrycraft/network/PacketClearColorCache.java
new file mode 100644
index 0000000..edfcadd
--- /dev/null
+++ b/java/darkknight/jewelrycraft/network/PacketClearColorCache.java
@@ -0,0 +1,32 @@
+package darkknight.jewelrycraft.network;
+
+import net.minecraft.nbt.NBTTagCompound;
+import io.netty.buffer.ByteBuf;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import darkknight.jewelrycraft.JewelrycraftMod;
+
+public class PacketClearColorCache implements IMessage, IMessageHandler<PacketClearColorCache, IMessage>
+{
+ public PacketClearColorCache()
+ {
+ }
+
+ @Override
+ public IMessage onMessage(PacketClearColorCache message, MessageContext ctx)
+ {
+ JewelrycraftMod.clientData = new NBTTagCompound();
+ return null;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf)
+ {
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf)
+ {
+ }
+}
diff --git a/java/darkknight/jewelrycraft/network/PacketHandler.java b/java/darkknight/jewelrycraft/network/PacketHandler.java
new file mode 100644
index 0000000..0ed0843
--- /dev/null
+++ b/java/darkknight/jewelrycraft/network/PacketHandler.java
@@ -0,0 +1,6 @@
+package darkknight.jewelrycraft.network;
+
+public class PacketHandler
+{
+
+}
diff --git a/java/darkknight/jewelrycraft/network/PacketRequestLiquidData.java b/java/darkknight/jewelrycraft/network/PacketRequestLiquidData.java
new file mode 100644
index 0000000..5e394ed
--- /dev/null
+++ b/java/darkknight/jewelrycraft/network/PacketRequestLiquidData.java
@@ -0,0 +1,73 @@
+package darkknight.jewelrycraft.network;
+
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import io.netty.buffer.ByteBuf;
+import cpw.mods.fml.common.network.handshake.NetworkDispatcher;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.util.JewelryNBT;
+
+public class PacketRequestLiquidData implements IMessage, IMessageHandler<PacketRequestLiquidData, IMessage>
+{
+ int dimID, x, y, z;
+
+ public PacketRequestLiquidData()
+ {
+ }
+
+ public PacketRequestLiquidData(int dimID, int x, int y, int z)
+ {
+ this.dimID = dimID;
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ @Override
+ public IMessage onMessage(PacketRequestLiquidData message, MessageContext ctx)
+ {
+ String data = JewelrycraftMod.saveData.getString(message.x + " " + message.y + " " + message.z + " " + message.dimID);
+ String[] splitData = data.split(":");
+
+ IMessage replyPacket = null;
+
+ if (splitData.length == 2)
+ {
+ int itemID, itemDamage;
+ try
+ {
+ itemID = Integer.parseInt(splitData[0]);
+ itemDamage = Integer.parseInt(splitData[1]);
+
+ replyPacket = (IMessage) new PacketSendLiquidData(message, itemID, itemDamage);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return replyPacket;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf)
+ {
+ dimID = buf.readInt();
+ x = buf.readInt();
+ y = buf.readInt();
+ z = buf.readInt();
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf)
+ {
+ buf.writeInt(dimID);
+ buf.writeInt(x);
+ buf.writeInt(y);
+ buf.writeInt(z);
+ }
+}
diff --git a/java/darkknight/jewelrycraft/network/PacketSendLiquidData.java b/java/darkknight/jewelrycraft/network/PacketSendLiquidData.java
new file mode 100644
index 0000000..258b6cb
--- /dev/null
+++ b/java/darkknight/jewelrycraft/network/PacketSendLiquidData.java
@@ -0,0 +1,72 @@
+package darkknight.jewelrycraft.network;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.block.BlockMoltenMetal;
+import io.netty.buffer.ByteBuf;
+
+public class PacketSendLiquidData implements IMessage, IMessageHandler<PacketSendLiquidData, IMessage>
+{
+ int dimID, x, y, z, itemID, itemMeta;
+
+ public PacketSendLiquidData()
+ {
+ }
+
+ public PacketSendLiquidData(PacketRequestLiquidData packet, int itemID, int itemMeta)
+ {
+ dimID = packet.dimID;
+ x = packet.x;
+ y = packet.y;
+ z = packet.z;
+ this.itemID = itemID;
+ this.itemMeta = itemMeta;
+ }
+
+ public PacketSendLiquidData(int dimID, int x, int y, int z, int itemID, int itemMeta)
+ {
+ this.dimID = dimID;
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.itemID = itemID;
+ this.itemMeta = itemMeta;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf)
+ {
+ dimID = buf.readInt();
+ x = buf.readInt();
+ y = buf.readInt();
+ z = buf.readInt();
+ itemID = buf.readInt();
+ itemMeta = buf.readInt();
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf)
+ {
+ buf.writeInt(dimID);
+ buf.writeInt(x);
+ buf.writeInt(y);
+ buf.writeInt(z);
+ buf.writeInt(itemID);
+ buf.writeInt(itemMeta);
+ }
+
+ @Override
+ public IMessage onMessage(PacketSendLiquidData message, MessageContext ctx)
+ {
+ JewelrycraftMod.clientData.setString(message.x + " " + message.y + " " + message.z + " " + message.dimID, message.itemID + ":" + message.itemMeta);
+
+ Block block = Minecraft.getMinecraft().theWorld.getBlock(message.x, message.y, message.z);
+ Minecraft.getMinecraft().theWorld.markBlockForUpdate(message.x, message.y, message.z);
+
+ return null;
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java b/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java
index 366d8a8..6e01d4b 100644
--- a/src/main/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java
+++ b/java/darkknight/jewelrycraft/recipes/CraftingRecipes.java
@@ -18,23 +18,29 @@ public class CraftingRecipes
{
if (!isInitialized)
{
- //Items
+ // Items
GameRegistry.addRecipe(new ItemStack(ItemList.thiefGloves), "x x", "yxy", "yxy", 'x', ItemList.shadowIngot, 'y', new ItemStack(Blocks.wool, 1, 15));
GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 0), "xx", 'x', Items.clay_ball);
GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 1), " x ", "x x", " x ", 'x', Items.clay_ball);
GameRegistry.addRecipe(new ItemStack(ItemList.clayMolds, 1, 2), "x x", "x x", " x ", 'x', Items.clay_ball);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ItemList.crystal, 1, 15), " x ", "x x", " x ", 'x', Blocks.glass));
- for(int i=0; i < 15; i++)
+ for (int i = 0; i < 15; i++)
{
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.crystal, 1, i), new Object[]{new ItemStack(ItemList.crystal, 1, 15), new ItemStack(Items.dye, 1, i)});
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.crystal, 1, 15), new Object[]{new ItemStack(ItemList.crystal, 1, i), new ItemStack(Items.dye, 1, 15)});
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.crystal, 1, i), new Object[]
+ { new ItemStack(ItemList.crystal, 1, 15), new ItemStack(Items.dye, 1, i) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.crystal, 1, 15), new Object[]
+ { new ItemStack(ItemList.crystal, 1, i), new ItemStack(Items.dye, 1, 15) });
}
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.shadowIngot, 9), new Object[]{new ItemStack(BlockList.shadowBlock)});
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 0)});
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 1)});
- GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]{new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 2)});
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.shadowIngot, 9), new Object[]
+ { new ItemStack(BlockList.shadowBlock) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]
+ { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 0) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]
+ { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 1) });
+ GameRegistry.addShapelessRecipe(new ItemStack(ItemList.guide), new Object[]
+ { new ItemStack(Items.book), new ItemStack(ItemList.molds, 1, 2) });
- //Blocks
+ // Blocks
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.molder), "x x", "xxx", 'x', Blocks.cobblestone));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.smelter), "xyx", "x x", "xzx", 'x', Blocks.cobblestone, 'y', Items.bucket, 'z', Items.lava_bucket));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.jewelCraftingTable), "xxx", "y y", "y y", 'x', Blocks.planks, 'y', Blocks.cobblestone));
@@ -42,8 +48,8 @@ public class CraftingRecipes
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BlockList.shadowBlock, 1), "xxx", "xxx", "xxx", 'x', ItemList.shadowIngot));
GameRegistry.addRecipe(new ItemStack(BlockList.jewelAltar, 1), "sws", "bwb", "bbb", 's', Blocks.end_stone, 'w', new ItemStack(Blocks.wool, 1, 5), 'b', Blocks.nether_brick);
- //Smelting
- GameRegistry.addSmelting(BlockList.shadowOre, new ItemStack(ItemList.shadowIngot), 1.5f);
+ // Smelting
+ GameRegistry.addSmelting(BlockList.shadowOre, new ItemStack(ItemList.shadowIngot), 1.5f);
GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(ItemList.molds, 1, 0), 0.2F);
GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 1), new ItemStack(ItemList.molds, 1, 1), 0.2F);
GameRegistry.addSmelting(new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(ItemList.molds, 1, 2), 0.2F);
diff --git a/src/main/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java b/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
index 8956eb4..f1b25b5 100644
--- a/src/main/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
+++ b/java/darkknight/jewelrycraft/renders/TileEntityDisplayerRender.java
@@ -29,41 +29,41 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
{
ModelDisplayer displayer = new ModelDisplayer();
String texture = "textures/tileentities/Displayer.png";
-
+
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
- TileEntityDisplayer disp = (TileEntityDisplayer)te;
+ TileEntityDisplayer disp = (TileEntityDisplayer) te;
int block = disp.getBlockMetadata();
-
+
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
-
+
GL11.glPushMatrix();
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
displayer.render((Entity) null, disp.ringTranslation1, disp.ringTranslation2, disp.ringTranslation3, 0.0F, 0.0F, 0.0625F);
- if(disp != null && disp.hasObject && disp.object != null && disp.object != new ItemStack(Item.getItemById(0), 0, 0))
+ if (disp != null && disp.hasObject && disp.object != null && disp.object != new ItemStack(Item.getItemById(0), 0, 0))
{
int ind = -3;
GL11.glPushMatrix();
- renderLabel(disp.object.getDisplayName(), 0F, (-0.171F)*ind, 0F, block, disp, Color.YELLOW.getRGB());
+ renderLabel(disp.object.getDisplayName(), 0F, (-0.171F) * ind, 0F, block, disp, Color.YELLOW.getRGB());
GL11.glPopMatrix();
ind++;
GL11.glPushMatrix();
- renderLabel(Integer.toString(disp.quantity), 0F, (-0.171F)*ind, 0F, block, disp, Color.GRAY.getRGB());
+ renderLabel(Integer.toString(disp.quantity), 0F, (-0.171F) * ind, 0F, block, disp, Color.GRAY.getRGB());
GL11.glPopMatrix();
ind++;
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)
+ if (disp.object.getItem() != Items.map && player != null && disp.object.getTooltip(player, true) != null)
{
- for(int i = 1; i < disp.object.getTooltip(player, true).size(); i++)
+ for (int i = 1; i < disp.object.getTooltip(player, true).size(); i++)
{
- if(disp.object.getTooltip(player, true).get(i).toString() != "")
+ if (disp.object.getTooltip(player, true).get(i).toString() != "")
{
GL11.glPushMatrix();
- renderLabel(disp.object.getTooltip(player, 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++;
}
@@ -75,10 +75,9 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
entityitem.hoverStart = 0.0F;
disp.object.stackSize = 1;
GL11.glRotatef(180F, 1F, 0F, 0F);
- GL11.glTranslatef(0.0F, -0.6F + disp.ringTranslation1/5, 0F);
+ GL11.glTranslatef(0.0F, -0.6F + disp.ringTranslation1 / 5, 0F);
GL11.glRotatef(disp.rotAngle, 0F, 1F, 0F);
- if(RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else
{
GL11.glRotatef(180F, 0F, 1F, 0F);
@@ -92,7 +91,7 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
GL11.glPopMatrix();
GL11.glPopMatrix();
}
-
+
public void adjustLightFixture(World world, int i, int j, int k, Block block)
{
Tessellator tess = Tessellator.instance;
@@ -103,18 +102,18 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
tess.setColorOpaque_F(brightness, brightness, brightness);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
}
-
+
protected void renderLabel(String par2Str, double x, double y, double z, int metadata, TileEntity te, int color)
{
FontRenderer fontrenderer = RenderManager.instance.getFontRenderer();
float var14 = 0.01266667F * 1.5F;
float var17 = 0.015F;
GL11.glRotatef(180F, 0F, 0F, 1F);
- if(metadata == 0) GL11.glRotatef(0F, 0F, 1F, 0F);
- else if(metadata == 1) GL11.glRotatef(270F, 0F, 1F, 0F);
- else if(metadata == 2) GL11.glRotatef(180F, 0F, 1F, 0F);
- else if(metadata == 3) GL11.glRotatef(90F, 0F, 1F, 0F);
- GL11.glTranslatef((float)x, (float)y, (float)z + 0.45F);
+ if (metadata == 0) GL11.glRotatef(0F, 0F, 1F, 0F);
+ else if (metadata == 1) GL11.glRotatef(270F, 0F, 1F, 0F);
+ else if (metadata == 2) GL11.glRotatef(180F, 0F, 1F, 0F);
+ else if (metadata == 3) GL11.glRotatef(90F, 0F, 1F, 0F);
+ GL11.glTranslatef((float) x, (float) y, (float) z + 0.45F);
GL11.glScalef(-0.015F, -var14, 0.015F);
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
@@ -125,24 +124,24 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
int j = fontrenderer.getStringWidth(par2Str) / 2;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(0.0F, 0.2F, 0.2F, 0.9F);
- tessellator.addVertex((double)(-33.333 - 0), -1D, 0.1D);
- tessellator.addVertex((double)(-33.333 - 0), 8D, 0.1D);
- tessellator.addVertex((double)(33.333 + 0), 8D, 0.1D);
- tessellator.addVertex((double)(33.333 + 0), -1D, 0.1D);
+ tessellator.addVertex((double) (-33.333 - 0), -1D, 0.1D);
+ tessellator.addVertex((double) (-33.333 - 0), 8D, 0.1D);
+ tessellator.addVertex((double) (33.333 + 0), 8D, 0.1D);
+ tessellator.addVertex((double) (33.333 + 0), -1D, 0.1D);
tessellator.draw();
- if ((fontrenderer.getStringWidth(par2Str)/2) > 20) var17 = 0.9F / fontrenderer.getStringWidth(par2Str);
+ if ((fontrenderer.getStringWidth(par2Str) / 2) > 20) var17 = 0.9F / fontrenderer.getStringWidth(par2Str);
else var17 = var14;
int red = (color >> 16) & 0xFF;
int green = (color >> 8) & 0xFF;
int blue = color & 0xFF;
- GL11.glTranslatef((float)x + 1f, (float)y + 1f, (float)z);
+ GL11.glTranslatef((float) x + 1f, (float) y + 1f, (float) z);
GL11.glPushMatrix();
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glScalef(var17*70F, 1F, 0F);
- fontrenderer.drawString(par2Str.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 65536 * (red/2) + 256 * (green/2) + blue/2);
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glScalef(var17 * 70F, 1F, 0F);
+ fontrenderer.drawString(par2Str.replaceFirst("§0", "§r").replaceFirst("§1", "§r").replaceFirst("§2", "§r").replaceFirst("§3", "§r").replaceFirst("§4", "§r").replaceFirst("§5", "§r").replaceFirst("§6", "§r").replaceFirst("§7", "§r").replaceFirst("§8", "§r").replaceFirst("§9", "§r").replaceFirst("§a", "§r").replaceFirst("§b", "§r").replaceFirst("§c", "§r").replaceFirst("§d", "§r").replaceFirst("§e", "§r").replaceFirst("§f", "§r"), -j, 0, 65536 * (red / 2) + 256 * (green / 2) + blue / 2);
GL11.glPopMatrix();
- GL11.glTranslatef((float)x - 1f, (float)y - 1f, (float)z - 1F);
- GL11.glScalef(var17*70F, 1F, 0F);
+ GL11.glTranslatef((float) x - 1f, (float) y - 1f, (float) z - 1F);
+ GL11.glScalef(var17 * 70F, 1F, 0F);
fontrenderer.drawString(par2Str, -j, 0, color);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
@@ -151,82 +150,82 @@ public class TileEntityDisplayerRender extends TileEntitySpecialRenderer
public void replaceEnumEnchValues(String str, int color)
{
- if(str.contains("§0"))
+ if (str.contains("§0"))
{
color = Color.BLACK.getRGB();
str.replace("§0", "");
}
- if(str.contains("§1"))
+ if (str.contains("§1"))
{
color = 85;
str.replace("§1", "");
}
- if(str.contains("§2"))
+ if (str.contains("§2"))
{
color = 17920;
str.replace("§2", "");
}
- if(str.contains("§3"))
+ if (str.contains("§3"))
{
color = 1336183;
str.replace("§3", "");
}
- if(str.contains("§4"))
+ if (str.contains("§4"))
{
color = 4587520;
str.replace("§4", "");
}
- if(str.contains("§5"))
+ if (str.contains("§5"))
{
color = 5701759;
str.replace("§5", "");
}
- if(str.contains("§6"))
+ if (str.contains("§6"))
{
color = 16762880;
str.replace("§6", "");
}
- if(str.contains("§7"))
+ if (str.contains("§7"))
{
color = Color.GRAY.getRGB();
str.replace("§7", "");
}
- if(str.contains("§8"))
+ if (str.contains("§8"))
{
color = Color.DARK_GRAY.getRGB();
str.replace("§8", "");
}
- if(str.contains("§9"))
+ if (str.contains("§9"))
{
color = Color.BLUE.getRGB();
str.replace("§9", "");
}
- if(str.contains("§a"))
+ if (str.contains("§a"))
{
color = Color.GREEN.getRGB();
str.replace("§a", "");
}
- if(str.contains("§b"))
+ if (str.contains("§b"))
{
color = Color.CYAN.getRGB();
str.replace("§b", "");
}
- if(str.contains("§c"))
+ if (str.contains("§c"))
{
color = Color.RED.getRGB();
str.replace("§c", "");
}
- if(str.contains("§d"))
+ if (str.contains("§d"))
{
color = 11665663;
str.replace("§d", "");
}
- if(str.contains("§e"))
+ if (str.contains("§e"))
{
color = Color.YELLOW.getRGB();
str.replace("§e", "");
}
- if(str.contains("§f"))
+ if (str.contains("§f"))
{
color = Color.WHITE.getRGB();
str.replace("§f", "");
diff --git a/src/main/java/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java b/java/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java
index bfc2aac..df63e9d 100644
--- a/src/main/java/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java
+++ b/java/darkknight/jewelrycraft/renders/TileEntityJewelrsCraftingTableRender.java
@@ -19,31 +19,29 @@ import net.minecraft.world.World;
public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRenderer
{
ModelJewlersCraftingBench modelTable = new ModelJewlersCraftingBench();
- String texture = "textures/tileentities/JewelrsCraftingBench.png";
-
+ String texture = "textures/tileentities/JewelrsCraftingBench.png";
+
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
-
+
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- int block = te.getBlockMetadata();
- TileEntityJewelrsCraftingTable jt = (TileEntityJewelrsCraftingTable)te;
-
+ int block = te.getBlockMetadata();
+ TileEntityJewelrsCraftingTable jt = (TileEntityJewelrsCraftingTable) te;
+
GL11.glPushMatrix();
- if (block == 0)
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- else if (block == 1){
+ if (block == 0) GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ else if (block == 1)
+ {
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
}
- else if (block == 2)
- GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- else if (block == 3)
- GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
-
+ else if (block == 2) GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
+ else if (block == 3) GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
+
modelTable.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
if (jt != null)
{
@@ -54,13 +52,12 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.jewelry);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
-
+
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(0.0F, -1.6F, 0.6F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
- if(RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else
{
GL11.glRotatef(180F, 0F, 1F, 0F);
@@ -68,7 +65,7 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
-
+
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@@ -79,13 +76,12 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.endItem);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
-
+
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(0.0F, -1.6F, 0.6F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
- if(RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else
{
GL11.glRotatef(180F, 0F, 1F, 0F);
@@ -93,7 +89,7 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderManager.instance.options.fancyGraphics = false;
}
-
+
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@@ -104,13 +100,12 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, jt.modifier);
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
-
+
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(0.55F, -1.5F, -0.45F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
- if(RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else
{
GL11.glRotatef(180F, 0F, 1F, 0F);
@@ -133,8 +128,7 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(-0.55F, -1.5F, -0.45F);
GL11.glRotatef(jt.angle, 0F, 1F, 0F);
- if(RenderManager.instance.options.fancyGraphics)
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else
{
GL11.glRotatef(180F, 0F, 1F, 0F);
@@ -146,11 +140,11 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
GL11.glPopMatrix();
}
}
-
+
GL11.glPopMatrix();
GL11.glPopMatrix();
}
-
+
public void adjustLightFixture(World world, int i, int j, int k, Block block)
{
Tessellator tess = Tessellator.instance;
@@ -161,5 +155,5 @@ public class TileEntityJewelrsCraftingTableRender extends TileEntitySpecialRende
tess.setColorOpaque_F(brightness, brightness, brightness);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
}
-
+
}
diff --git a/src/main/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java b/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
index 1d31358..eabd25c 100644
--- a/src/main/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
+++ b/java/darkknight/jewelrycraft/renders/TileEntityMolderRender.java
@@ -25,30 +25,28 @@ import net.minecraft.world.World;
public class TileEntityMolderRender extends TileEntitySpecialRenderer
{
ModelMolder modelMolder = new ModelMolder();
- String texture = "textures/tileentities/Molder.png";
-
+ String texture = "textures/tileentities/Molder.png";
+
@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
TileEntityMolder me = (TileEntityMolder) te;
-
+
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
int block = me.getBlockMetadata();
-
+
GL11.glPushMatrix();
- if (block == 0)
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- else if (block == 1){
+ if (block == 0) GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ else if (block == 1)
+ {
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
}
- else if (block == 2)
- GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- else if (block == 3)
- GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
+ else if (block == 2) GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
+ else if (block == 3) GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
modelMolder.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
if (me != null)
{
@@ -63,7 +61,7 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
GL11.glScalef(1.25F, 1.0F, 1.25F);
GL11.glRotatef(90F, 1F, 0F, 0f);
RenderItem.renderInFrame = true;
- if(entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
@@ -79,24 +77,24 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
GL11.glScalef(1.25F, 1.0F, 1.25F);
GL11.glRotatef(90F, 1F, 0F, 0f);
RenderItem.renderInFrame = true;
- if(entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (entityitem != null) RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glColor4f(1, 1F, 1F, 1.0F);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
- if(me.hasMoltenMetal && me.moltenMetal != null && me.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0))
+ if (me.hasMoltenMetal && me.moltenMetal != null && me.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0))
{
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
ItemStack metal = new ItemStack(ItemList.metal);
- JewelryNBT.addMetal(metal, new ItemStack(me.moltenMetal.getItem()));
+ JewelryNBT.addMetal(metal, me.moltenMetal);
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.glTranslatef(-0F, 1.33f - 0.005f * me.quantity, -0.29F);
+ GL11.glScalef(1.1F, 1.0F, 1.4F);
GL11.glRotatef(90F, 1F, 0F, 0f);
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
@@ -108,7 +106,7 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
GL11.glPopMatrix();
GL11.glPopMatrix();
}
-
+
public void adjustLightFixture(World world, int i, int j, int k, Block block)
{
Tessellator tess = Tessellator.instance;
@@ -119,5 +117,5 @@ public class TileEntityMolderRender extends TileEntitySpecialRenderer
tess.setColorOpaque_F(brightness, brightness, brightness);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
}
-
+
}
diff --git a/src/main/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java b/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
index d79c4b4..c8f94f7 100644
--- a/src/main/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
+++ b/java/darkknight/jewelrycraft/renders/TileEntitySmelterRender.java
@@ -32,41 +32,39 @@ import darkknight.jewelrycraft.util.JewelryNBT;
public class TileEntitySmelterRender extends TileEntitySpecialRenderer
{
ModelSmelter modelSmelter = new ModelSmelter();
- String texture = "textures/tileentities/Smelter.png";
+ 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)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
-
+
ResourceLocation blockTexture = new ResourceLocation("jewelrycraft", texture);
Minecraft.getMinecraft().renderEngine.bindTexture(blockTexture);
- TileEntitySmelter st = (TileEntitySmelter)te;
+ TileEntitySmelter st = (TileEntitySmelter) te;
int block = te.getBlockMetadata();
-
+
GL11.glPushMatrix();
- if (block == 0)
- GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
- else if (block == 1){
+ if (block == 0) GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
+ else if (block == 1)
+ {
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
}
- else if (block == 2)
- GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- else if (block == 3)
- GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
-
+ else if (block == 2) GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
+ else if (block == 3) GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
+
modelSmelter.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
-
+
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
EntityItem entityitem = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, new ItemStack(Blocks.lava));
entityitem.getEntityItem().stackSize = 1;
entityitem.hoverStart = 0.0F;
-
+
GL11.glPushMatrix();
GL11.glPopMatrix();
@@ -81,11 +79,10 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
minU = lava.getMinU();
minV = lava.getMinV();
maxU = lava.getMaxU();
- maxV = lava.getMaxV();
- /*maxU = lava.getInterpolatedU(10);
- maxV = lava.getInterpolatedV(14);*/
-
-
+ maxV = lava.getMaxV();
+ /*
+ * maxU = lava.getInterpolatedU(10); maxV = lava.getInterpolatedV(14);
+ */
t.startDrawingQuads();
@@ -96,24 +93,12 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
t.draw();
-
- GL11.glTranslatef(-0F, 1.25F, -0.3F);
- GL11.glScalef(1.25F, 1.0F, 1.47F);
+ GL11.glTranslatef(-0F, 1.25F, -0.345F);
+ GL11.glScalef(1.2F, 1.0F, 1.7F);
GL11.glRotatef(90F, 1F, 0F, 0f);
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
-
- GL11.glTranslatef(0F, 0.46F, 0.0F);
- GL11.glScalef(0.8F, 0.1F, 0F);
- RenderItem.renderInFrame = true;
- RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
- RenderItem.renderInFrame = false;
-
- 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;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
@@ -126,13 +111,13 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
EntityItem metal = new EntityItem(te.getWorldObj(), 0.0D, 0.0D, 0.0D, st.metal);
metal.getEntityItem().stackSize = 1;
metal.hoverStart = 0.0F;
-
+
GL11.glRotatef(-50F, 1F, 0F, 0F);
GL11.glRotatef(-50F, 0F, 0F, 1F);
GL11.glRotatef(180F, 1F, 0F, 0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(-0.9F, -0.9F, -1.6F);
- if(RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
+ if (RenderManager.instance.options.fancyGraphics) RenderManager.instance.renderEntityWithPosYaw(metal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
else
{
RenderManager.instance.options.fancyGraphics = true;
@@ -142,18 +127,18 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
- if(st.hasMoltenMetal && st.moltenMetal != null && st.moltenMetal != new ItemStack(Item.getItemById(0), 0, 0))
+ if (st.hasMoltenMetal && st.moltenMetal != null && Item.getIdFromItem(st.moltenMetal.getItem()) > 0 && !st.moltenMetal.equals(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()));
+ JewelryNBT.addMetal(metal, new ItemStack(st.moltenMetal.getItem(), 1, st.moltenMetal.getItemDamage()));
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.glTranslatef(-0F, 1.05f - .4F * st.quantity, -0.14F);
+ GL11.glScalef(0.72F, 1F, 0.85F);
GL11.glRotatef(90F, 1F, 0F, 0f);
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(moltenMetal, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
@@ -162,11 +147,11 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
GL11.glPopMatrix();
}
}
-
+
GL11.glPopMatrix();
GL11.glPopMatrix();
}
-
+
public void adjustLightFixture(World world, int i, int j, int k, Block block)
{
Tessellator tess = Tessellator.instance;
@@ -177,5 +162,5 @@ public class TileEntitySmelterRender extends TileEntitySpecialRenderer
tess.setColorOpaque_F(brightness, brightness, brightness);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier);
}
-
+
}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java b/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
index 62ef646..4226471 100644
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityAltar.java
@@ -21,7 +21,7 @@ public class TileEntityAltar extends TileEntity
public ItemStack object;
public boolean isDirty, hasObject;
public String playerName;
-
+
public TileEntityAltar()
{
this.hasObject = false;
@@ -29,7 +29,7 @@ public class TileEntityAltar extends TileEntity
this.isDirty = false;
this.playerName = "";
}
-
+
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -40,7 +40,7 @@ public class TileEntityAltar extends TileEntity
nbt.setBoolean("hasObject", hasObject);
nbt.setString("playerName", playerName);
}
-
+
@Override
public void readFromNBT(NBTTagCompound nbt)
{
@@ -50,81 +50,106 @@ public class TileEntityAltar extends TileEntity
this.hasObject = nbt.getBoolean("hasObject");
this.playerName = nbt.getString("playerName");
}
-
+
@SuppressWarnings("rawtypes")
@Override
public void updateEntity()
{
super.updateEntity();
- if(isDirty)
+ if (isDirty)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
- if(hasObject && playerName != "")
+ if (hasObject && playerName != "")
{
- //int playerPosX = (int)player.posX, playerPosY = (int)player.posY, playerPosZ = (int)player.posZ;
+ // int playerPosX = (int)player.posX, playerPosY = (int)player.posY,
+ // playerPosZ = (int)player.posZ;
List entitiesR = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord + 1D, zCoord, xCoord + 0.5D, yCoord + 2D, zCoord + 0.5D));
List entitiesN = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(xCoord - 0.5D, yCoord + 1D, zCoord - 0.5D, xCoord + 1.5D, yCoord + 2D, zCoord + 1.5D));
- if(object.getUnlocalizedName().contains("ring"))
+ if (object.getUnlocalizedName().contains("ring"))
{
if (JewelryNBT.isJewelX(object, new ItemStack(Items.ender_pearl)) && JewelryNBT.dimension(object) != -2 && JewelryNBT.playerPosX(object) != -1 && JewelryNBT.playerPosY(object) != -1 && JewelryNBT.playerPosZ(object) != -1)
{
double posX = JewelryNBT.playerPosX(object), posY = JewelryNBT.playerPosY(object), posZ = JewelryNBT.playerPosZ(object);
int dimension = JewelryNBT.dimension(object);
- for(int i = 0; i < entitiesR.size(); i++)
+ for (int i = 0; i < entitiesR.size(); i++)
{
EntityLivingBase entity = (EntityLivingBase) entitiesR.get(i);
- if (!JewelryNBT.isDimensionX(object, entity.dimension) && JewelryNBT.isModifierX(object, new ItemStack(Items.bed))){
+ if (!JewelryNBT.isDimensionX(object, entity.dimension) && JewelryNBT.isModifierX(object, new ItemStack(Items.bed)))
+ {
entity.travelToDimension(dimension);
entity.setPositionAndUpdate(posX, posY, posZ);
}
- else if(JewelryNBT.isDimensionX(object, entity.dimension)) entity.setPositionAndUpdate(posX, posY, posZ);
+ else if (JewelryNBT.isDimensionX(object, entity.dimension)) entity.setPositionAndUpdate(posX, posY, posZ);
}
}
if (JewelryNBT.isModifierX(object, new ItemStack(Items.dye, 1, 15)))
{
- for(int i=-1; i<=1; i++)
- for(int j=-1; j<=1; j++)
- for(int k=-1; k<=1; k++)
+ for (int i = -1; i <= 1; i++)
+ for (int j = -1; j <= 1; j++)
+ for (int k = -1; k <= 1; k++)
{
- //if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.dirt.blockID && (worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == 0 || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.crops.blockID) || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.potato.blockID) worldObj.setBlock(xCoord + i, yCoord + j, zCoord + k, Block.tilledField.blockID);
- if(worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) == Blocks.farmland) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
- if(worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) != Blocks.farmland) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k), 5);
- //JewelrycraftUtil.applyBonemeal(object, worldObj, xCoord + i, yCoord + j, zCoord + k, player);
+ // if(worldObj.getBlockId(xCoord + i, yCoord +
+ // j, zCoord + k) == Block.dirt.blockID &&
+ // (worldObj.getBlockId(xCoord + i, yCoord + j +
+ // 1, zCoord + k) == 0 ||
+ // worldObj.getBlockId(xCoord + i, yCoord + j +
+ // 1, zCoord + k) == Block.crops.blockID) ||
+ // worldObj.getBlockId(xCoord + i, yCoord + j +
+ // 1, zCoord + k) == Block.potato.blockID)
+ // worldObj.setBlock(xCoord + i, yCoord + j,
+ // zCoord + k, Block.tilledField.blockID);
+ if (worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) == Blocks.farmland) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
+ if (worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) != Blocks.farmland) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k), 5);
+ // JewelrycraftUtil.applyBonemeal(object,
+ // worldObj, xCoord + i, yCoord + j, zCoord + k,
+ // player);
}
}
}
- else if(object.getUnlocalizedName().contains("necklace"))
+ else if (object.getUnlocalizedName().contains("necklace"))
{
if (JewelryNBT.isJewelX(object, new ItemStack(Items.ender_pearl)) && JewelryNBT.dimension(object) != -2 && JewelryNBT.playerPosX(object) != -1 && JewelryNBT.playerPosY(object) != -1 && JewelryNBT.playerPosZ(object) != -1)
{
double posX = JewelryNBT.playerPosX(object), posY = JewelryNBT.playerPosY(object), posZ = JewelryNBT.playerPosZ(object);
int dimension = JewelryNBT.dimension(object);
- for(int i = 0; i < entitiesN.size(); i++)
+ for (int i = 0; i < entitiesN.size(); i++)
{
EntityLivingBase entity = (EntityLivingBase) entitiesN.get(i);
- if (!JewelryNBT.isDimensionX(object, entity.dimension) && JewelryNBT.isModifierX(object, new ItemStack(Items.bed))){
+ if (!JewelryNBT.isDimensionX(object, entity.dimension) && JewelryNBT.isModifierX(object, new ItemStack(Items.bed)))
+ {
entity.travelToDimension(dimension);
entity.setPositionAndUpdate(posX, posY, posZ);
}
- else if(JewelryNBT.isDimensionX(object, entity.dimension)) entity.setPositionAndUpdate(posX, posY, posZ);
+ else if (JewelryNBT.isDimensionX(object, entity.dimension)) entity.setPositionAndUpdate(posX, posY, posZ);
}
}
if (JewelryNBT.isModifierX(object, new ItemStack(Items.dye, 1, 15)))
{
- for(int i=-3; i<=3; i++)
- for(int j=-1; j<=1; j++)
- for(int k=-3; k<=3; k++)
+ for (int i = -3; i <= 3; i++)
+ for (int j = -1; j <= 1; j++)
+ for (int k = -3; k <= 3; k++)
{
- //if(worldObj.getBlockId(xCoord + i, yCoord + j, zCoord + k) == Block.dirt.blockID && (worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == 0 || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.crops.blockID) || worldObj.getBlockId(xCoord + i, yCoord + j + 1, zCoord + k) == Block.potato.blockID) worldObj.setBlock(xCoord + i, yCoord + j, zCoord + k, Block.tilledField.blockID);
- if(worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) == Blocks.farmland) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
- if(worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) != Blocks.farmland) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k), 5);
- //JewelrycraftUtil.applyBonemeal(object, worldObj, xCoord + i, yCoord + j, zCoord + k, player);
+ // if(worldObj.getBlockId(xCoord + i, yCoord +
+ // j, zCoord + k) == Block.dirt.blockID &&
+ // (worldObj.getBlockId(xCoord + i, yCoord + j +
+ // 1, zCoord + k) == 0 ||
+ // worldObj.getBlockId(xCoord + i, yCoord + j +
+ // 1, zCoord + k) == Block.crops.blockID) ||
+ // worldObj.getBlockId(xCoord + i, yCoord + j +
+ // 1, zCoord + k) == Block.potato.blockID)
+ // worldObj.setBlock(xCoord + i, yCoord + j,
+ // zCoord + k, Block.tilledField.blockID);
+ if (worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) == Blocks.farmland) worldObj.setBlockMetadataWithNotify(xCoord + i, yCoord + j, zCoord + k, 1, 7);
+ if (worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k) != Blocks.farmland) worldObj.scheduleBlockUpdate(xCoord + i, yCoord + j, zCoord + k, worldObj.getBlock(xCoord + i, yCoord + j, zCoord + k), 5);
+ // JewelrycraftUtil.applyBonemeal(object,
+ // worldObj, xCoord + i, yCoord + j, zCoord + k,
+ // player);
}
}
- }
+ }
}
}
@@ -136,7 +161,7 @@ public class TileEntityAltar extends TileEntity
}
@Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
+ 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/tileentity/TileEntityBlockShadow.java b/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
index 186f78a..88ae7e3 100644
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityBlockShadow.java
@@ -11,26 +11,26 @@ import net.minecraft.world.EnumSkyBlock;
public class TileEntityBlockShadow extends TileEntity
{
public int metadata;
-
+
public TileEntityBlockShadow()
{
this.metadata = -1;
}
-
+
@Override
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
nbt.setInteger("metadata", metadata);
}
-
+
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
this.metadata = nbt.getInteger("metadata");
}
-
+
@Override
public void updateEntity()
{
@@ -38,22 +38,22 @@ public class TileEntityBlockShadow extends TileEntity
int blockLight, realLight;
int lightValue = worldObj.getSavedLightValue(EnumSkyBlock.Sky, xCoord, yCoord, zCoord) - worldObj.skylightSubtracted;
float sunPosAngle = worldObj.getCelestialAngleRadians(1.0F);
-
- if (sunPosAngle < (float)Math.PI) sunPosAngle += (0.0F - sunPosAngle) * 0.2F;
- else sunPosAngle += (((float)Math.PI * 2F) - sunPosAngle) * 0.2F;
-
- lightValue = Math.round((float)lightValue * MathHelper.cos(sunPosAngle));
-
+
+ if (sunPosAngle < (float) Math.PI) sunPosAngle += (0.0F - sunPosAngle) * 0.2F;
+ else sunPosAngle += (((float) Math.PI * 2F) - sunPosAngle) * 0.2F;
+
+ lightValue = Math.round((float) lightValue * MathHelper.cos(sunPosAngle));
+
if (lightValue < 0) lightValue = 0;
if (lightValue > 15) lightValue = 15;
-
+
blockLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getSavedLightValue(EnumSkyBlock.Block, xCoord & 15, yCoord, zCoord & 15);
realLight = worldObj.getChunkFromBlockCoords(xCoord, zCoord).getBlockLightValue(xCoord & 15, yCoord, zCoord & 15, 0);
-
- if((blockLight == 0 && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) || (lightValue >= blockLight)) metadata = 15 - lightValue;
- else if(!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) metadata = 15 - realLight;
- else if(lightValue < blockLight) metadata = 15 - blockLight;
-
+
+ if ((blockLight == 0 && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) || (lightValue >= blockLight)) metadata = 15 - lightValue;
+ else if (!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord)) metadata = 15 - realLight;
+ else if (lightValue < blockLight) metadata = 15 - blockLight;
+
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metadata, 2);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
}
@@ -66,7 +66,7 @@ public class TileEntityBlockShadow extends TileEntity
}
@Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
+ 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/tileentity/TileEntityDisplayer.java b/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
index 35def5c..d027e6a 100644
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityDisplayer.java
@@ -14,7 +14,7 @@ public class TileEntityDisplayer extends TileEntity
public boolean isDescending1, isDescending2, isDescending3, isDirty, hasObject;
public ItemStack object;
public int quantity;
-
+
public TileEntityDisplayer()
{
this.ringTranslation1 = 0;
@@ -29,7 +29,7 @@ public class TileEntityDisplayer extends TileEntity
this.hasObject = false;
this.object = new ItemStack(Item.getItemById(0), 0, 0);
}
-
+
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -47,7 +47,7 @@ public class TileEntityDisplayer extends TileEntity
this.object.writeToNBT(tag);
nbt.setTag("object", tag);
}
-
+
@Override
public void readFromNBT(NBTTagCompound nbt)
{
@@ -64,32 +64,32 @@ public class TileEntityDisplayer extends TileEntity
this.object = new ItemStack(Item.getItemById(0), 0, 0);
this.object.readFromNBT(nbt.getCompoundTag("object"));
}
-
+
@Override
public void updateEntity()
{
super.updateEntity();
- if(isDirty)
+ if (isDirty)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
- if(ringTranslation1 >= 0.6) isDescending1 = true;
- if(ringTranslation1 <= 0) isDescending1 = false;
- if(!isDescending1) ringTranslation1 += 0.05;
- if(isDescending1) ringTranslation1 -= 0.05;
-
- if(ringTranslation2 >= 0.6) isDescending2 = true;
- if(ringTranslation2 <= 0) isDescending2 = false;
- if(!isDescending2) ringTranslation2 += 0.04;
- if(isDescending2) ringTranslation2 -= 0.04;
-
- if(ringTranslation3 >= 0.6) isDescending3 = true;
- if(ringTranslation3 <= 0) isDescending3 = false;
- if(!isDescending3) ringTranslation3 += 0.03;
- if(isDescending3) ringTranslation3 -= 0.03;
- if(rotAngle < 360F) rotAngle += 6F;
- if(rotAngle>=360F) rotAngle = 0F;
+ if (ringTranslation1 >= 0.6) isDescending1 = true;
+ if (ringTranslation1 <= 0) isDescending1 = false;
+ if (!isDescending1) ringTranslation1 += 0.05;
+ if (isDescending1) ringTranslation1 -= 0.05;
+
+ if (ringTranslation2 >= 0.6) isDescending2 = true;
+ if (ringTranslation2 <= 0) isDescending2 = false;
+ if (!isDescending2) ringTranslation2 += 0.04;
+ if (isDescending2) ringTranslation2 -= 0.04;
+
+ if (ringTranslation3 >= 0.6) isDescending3 = true;
+ if (ringTranslation3 <= 0) isDescending3 = false;
+ if (!isDescending3) ringTranslation3 += 0.03;
+ if (isDescending3) ringTranslation3 -= 0.03;
+ if (rotAngle < 360F) rotAngle += 6F;
+ if (rotAngle >= 360F) rotAngle = 0F;
}
public Packet getDescriptionPacket()
@@ -100,7 +100,7 @@ public class TileEntityDisplayer extends TileEntity
}
@Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
+ 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/tileentity/TileEntityJewelrsCraftingTable.java b/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
index 13b689d..fd2290a 100644
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityJewelrsCraftingTable.java
@@ -15,9 +15,9 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
{
public boolean hasJewelry, hasModifier, hasEndItem, isDirty, hasJewel;
public ItemStack jewelry, modifier, endItem, jewel;
- public int timer, effect;
+ public int timer, effect;
public float angle;
-
+
public TileEntityJewelrsCraftingTable()
{
this.jewelry = new ItemStack(Item.getItemById(0), 0, 0);
@@ -33,7 +33,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
this.angle = 0;
this.isDirty = false;
}
-
+
@Override
public void writeToNBT(NBTTagCompound nbt)
{
@@ -45,12 +45,12 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
nbt.setInteger("timer", timer);
nbt.setInteger("effect", effect);
nbt.setFloat("angle", angle);
-
+
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound tag1 = new NBTTagCompound();
NBTTagCompound tag2 = new NBTTagCompound();
NBTTagCompound tag3 = new NBTTagCompound();
-
+
this.jewelry.writeToNBT(tag);
nbt.setTag("jewelry", tag);
this.modifier.writeToNBT(tag1);
@@ -60,7 +60,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
this.jewel.writeToNBT(tag3);
nbt.setTag("jewel", tag3);
}
-
+
@Override
public void readFromNBT(NBTTagCompound nbt)
{
@@ -69,7 +69,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
this.hasModifier = nbt.getBoolean("hasModifier");
this.hasEndItem = nbt.getBoolean("hasEndItem");
this.hasJewel = nbt.getBoolean("hasJewel");
-
+
this.timer = nbt.getInteger("timer");
this.effect = nbt.getInteger("effect");
this.angle = nbt.getFloat("angle");
@@ -82,28 +82,29 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
this.jewel = new ItemStack(Item.getItemById(0), 0, 0);
this.jewel.readFromNBT(nbt.getCompoundTag("jewel"));
}
-
+
@Override
public void updateEntity()
{
super.updateEntity();
- if(isDirty){
+ if (isDirty)
+ {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
- if(angle<360F)angle+=3F;
- else angle=0F;
+ if (angle < 360F) angle += 3F;
+ else angle = 0F;
if (this.hasJewelry && (this.hasModifier || this.hasJewel) && !this.hasEndItem)
{
if (timer > 0)
{
timer--;
- for (int l = 0; l < ConfigHandler.jewelryCraftingTime/(timer + 2); ++l)
+ for (int l = 0; l < ConfigHandler.jewelryCraftingTime / (timer + 2); ++l)
{
- if(this.getBlockMetadata() == 0) this.worldObj.spawnParticle("witchMagic", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
- if(this.getBlockMetadata() == 1) this.worldObj.spawnParticle("witchMagic", xCoord + 0.8F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
- if(this.getBlockMetadata() == 2) this.worldObj.spawnParticle("witchMagic", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.8F, 0.0D, 0.0D, 0.0D);
- if(this.getBlockMetadata() == 3) this.worldObj.spawnParticle("witchMagic", xCoord + 0.2F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
+ if (this.getBlockMetadata() == 0) this.worldObj.spawnParticle("witchMagic", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.2F, 0.0D, 0.0D, 0.0D);
+ if (this.getBlockMetadata() == 1) this.worldObj.spawnParticle("witchMagic", xCoord + 0.8F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
+ if (this.getBlockMetadata() == 2) this.worldObj.spawnParticle("witchMagic", xCoord + 0.5F, (double) yCoord + 0.8F, zCoord + 0.8F, 0.0D, 0.0D, 0.0D);
+ if (this.getBlockMetadata() == 3) this.worldObj.spawnParticle("witchMagic", xCoord + 0.2F, (double) yCoord + 0.8F, zCoord + 0.5F, 0.0D, 0.0D, 0.0D);
}
}
if (timer == 0)
@@ -133,7 +134,7 @@ public class TileEntityJewelrsCraftingTable extends TileEntity
}
@Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
+ 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/tileentity/TileEntityMolder.java b/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
index a1b0561..6006dea 100644
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntityMolder.java
@@ -23,7 +23,7 @@ public class TileEntityMolder extends TileEntity
this.jewelBase = new ItemStack(Item.getItemById(0), 0, 0);
this.mold = new ItemStack(Item.getItemById(0), 0, 0);
this.ringMetal = new ItemStack(Item.getItemById(0), 0, 0);
- this.cooling = 0;
+ this.cooling = -1;
this.quantity = 0f;
this.hasJewelBase = false;
this.hasMoltenMetal = false;
@@ -77,31 +77,30 @@ public class TileEntityMolder extends TileEntity
public void updateEntity()
{
super.updateEntity();
- if(isDirty){
+ if (isDirty)
+ {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
isDirty = false;
}
- if (moltenMetal.getItem() != Item.getItemById(0))
+ if (this.hasMoltenMetal && moltenMetal.getItem() != Item.getItemById(0) && quantity > 0f)
{
-// if(worldObj.rand.nextInt(20) == 0) this.worldObj.playSoundEffect(xCoord, yCoord + 0.5F, zCoord, "random.fizz", 0.5F, 1F);
+ 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)
+ if (this.hasMoltenMetal && !this.hasJewelBase && quantity >= 0.1f)
{
ringMetal = moltenMetal;
- if (cooling > 0 && quantity > 0.9f) this.cooling--;
- if (cooling == 0)
+ if (cooling > 0) this.cooling--;
+ if (cooling <= 0f)
{
+ if (mold.getItemDamage() == 0) this.jewelBase = moltenMetal;
+ else if (mold.getItemDamage() == 1) this.jewelBase = new ItemStack(ItemList.ring);
+ else this.jewelBase = new ItemStack(ItemList.necklace);
+ ringMetal.stackSize = 1;
+ jewelBase.stackSize = 1;
+ if (mold.getItemDamage() != 0 && jewelBase != new ItemStack(Item.getItemById(0), 0, 0)) JewelryNBT.addMetal(jewelBase, ringMetal);
this.hasMoltenMetal = false;
- if (mold.getItemDamage() == 0)
- this.jewelBase = moltenMetal;
- else if (mold.getItemDamage() == 1)
- this.jewelBase = new ItemStack(ItemList.ring);
- else
- this.jewelBase = new ItemStack(ItemList.necklace);
- if(mold.getItemDamage() != 0 && jewelBase != new ItemStack(Item.getItemById(0), 0, 0))
- JewelryNBT.addMetal(jewelBase, ringMetal);
this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
this.hasJewelBase = true;
cooling = -1;
@@ -119,7 +118,7 @@ public class TileEntityMolder extends TileEntity
}
@Override
- public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
readFromNBT(packet.func_148857_g());
worldObj.func_147479_m(xCoord, yCoord, zCoord);
diff --git a/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
new file mode 100644
index 0000000..3330bd2
--- /dev/null
+++ b/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
@@ -0,0 +1,185 @@
+package darkknight.jewelrycraft.tileentity;
+
+import java.util.Random;
+
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+
+public class TileEntitySmelter extends TileEntity
+{
+ public int melting, flow, n = 0, p = 0;
+ public boolean hasMetal, hasMoltenMetal, isDirty, pouring;
+ public ItemStack metal, moltenMetal;
+ public float quantity, pouredQuantity = 0.1f;
+
+ public TileEntitySmelter()
+ {
+ this.melting = 0;
+ this.pouring = false;
+ this.flow = 0;
+ this.quantity = 0f;
+ this.hasMetal = false;
+ this.hasMoltenMetal = false;
+ this.metal = new ItemStack(Item.getItemById(0), 0, 0);
+ this.moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ this.isDirty = false;
+ }
+
+ @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 && !this.hasMoltenMetal)
+ {
+ boolean isOre = JewelrycraftUtil.isOre(metal);
+ if (melting > 0) this.melting--;
+ if (melting == 0)
+ {
+ this.hasMetal = false;
+ if(!isOre) this.moltenMetal = metal;
+ else{
+ this.moltenMetal = JewelrycraftUtil.getIngotFromOre(metal.getItem());
+ moltenMetal.stackSize*=2;
+ }
+// System.out.println(JewelrycraftUtil.getIngotFromOre(metal) + " | " + JewelrycraftUtil.ores + " | " + JewelrycraftUtil.oreToIngot);
+ this.hasMoltenMetal = true;
+ if(!isOre) this.quantity = 0.1f * metal.stackSize;
+ else this.quantity = 0.2f * metal.stackSize;
+ this.metal = new ItemStack(Item.getItemById(0), 0, 0);
+ melting = -1;
+ this.isDirty = true;
+ }
+ }
+ else if (this.hasMoltenMetal)
+ {
+ boolean isOre = JewelrycraftUtil.isOre(metal);
+ if (melting > 0) this.melting--;
+ if (melting == 0)
+ {
+ this.hasMetal = false;
+ if(!isOre) this.moltenMetal.stackSize += this.metal.stackSize;
+ else this.moltenMetal.stackSize += this.metal.stackSize*2;
+ if(!isOre) this.quantity += 0.1f * metal.stackSize;
+ else this.quantity += 0.2f * metal.stackSize;
+ this.metal = new ItemStack(Item.getItemById(0), 0, 0);
+ 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 && pouredQuantity > 0f)
+ {
+ quantity -= 0.01f;
+ pouredQuantity -= 0.01f;
+ me.quantity += 0.01f;
+ if (!me.hasMoltenMetal)
+ {
+ me.moltenMetal = moltenMetal;
+ me.hasMoltenMetal = true;
+ }
+ if (pouredQuantity <= 0f)
+ {
+ pouring = false;
+ pouredQuantity = 0.1f;
+ me.cooling = ConfigHandler.ingotCoolingTime;
+ }
+ if (quantity <= 0f)
+ {
+ quantity = 0f;
+ hasMoltenMetal = false;
+ moltenMetal = new ItemStack(Item.getItemById(0), 0, 0);
+ // pouring = false;
+ me.cooling = ConfigHandler.ingotCoolingTime;
+ }
+ me.isDirty = true;
+ }
+ }
+
+ 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/BlockUtils.java b/java/darkknight/jewelrycraft/util/BlockUtils.java
index a5f7684..385c175 100644
--- a/src/main/java/darkknight/jewelrycraft/util/BlockUtils.java
+++ b/java/darkknight/jewelrycraft/util/BlockUtils.java
@@ -1,6 +1,5 @@
package darkknight.jewelrycraft.util;
-
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
@@ -14,13 +13,14 @@ import net.minecraftforge.common.util.ForgeDirection;
public class BlockUtils
{
-
+
public static final ForgeDirection DEFAULT_BLOCK_DIRECTION = ForgeDirection.WEST;
-
- public static ForgeDirection get2dOrientation(EntityLivingBase entity)
+
+ public static ForgeDirection get2dOrientation(EntityLivingBase entity)
{
int l = MathHelper.floor_double(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
- switch (l) {
+ switch (l)
+ {
case 0:
return ForgeDirection.SOUTH;
case 1:
@@ -31,11 +31,13 @@ public class BlockUtils
return ForgeDirection.EAST;
}
return ForgeDirection.SOUTH;
-
+
}
-
- public static float getRotationFromDirection(ForgeDirection direction) {
- switch (direction) {
+
+ public static float getRotationFromDirection(ForgeDirection direction)
+ {
+ switch (direction)
+ {
case NORTH:
return 0F;
case SOUTH:
@@ -52,71 +54,87 @@ public class BlockUtils
return 0f;
}
}
-
- public static ForgeDirection get3dOrientation(EntityLivingBase entity) {
- if (entity.rotationPitch > 45.5F) {
+
+ public static ForgeDirection get3dOrientation(EntityLivingBase entity)
+ {
+ if (entity.rotationPitch > 45.5F)
+ {
return ForgeDirection.DOWN;
- } else if (entity.rotationPitch < -45.5F) { return ForgeDirection.UP; }
+ }
+ else if (entity.rotationPitch < -45.5F) { return ForgeDirection.UP; }
return get2dOrientation(entity);
}
-
- public static EntityItem dropItemStackInWorld(World worldObj, double x, double y, double z, ItemStack stack) {
+
+ public static EntityItem dropItemStackInWorld(World worldObj, double x, double y, double z, ItemStack stack)
+ {
float f = 0.7F;
float d0 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float d1 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
float d2 = worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5F;
EntityItem entityitem = new EntityItem(worldObj, x + d0, y + d1, z + d2, stack);
entityitem.delayBeforeCanPickup = 10;
- if (stack.hasTagCompound()) {
- entityitem.getEntityItem().setTagCompound((NBTTagCompound)stack.getTagCompound().copy());
+ if (stack.hasTagCompound())
+ {
+ entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
}
worldObj.spawnEntityInWorld(entityitem);
return entityitem;
}
-
- public static EntityItem ejectItemInDirection(World world, double x, double y, double z, ForgeDirection direction, ItemStack stack) {
+
+ public static EntityItem ejectItemInDirection(World world, double x, double y, double z, ForgeDirection direction, ItemStack stack)
+ {
EntityItem item = BlockUtils.dropItemStackInWorld(world, x, y, z, stack);
item.motionX = direction.offsetX / 5F;
item.motionY = direction.offsetY / 5F;
item.motionZ = direction.offsetZ / 5F;
return item;
}
-
- public static void dropInventory(IInventory inventory, World world, double x, double y, double z) {
+
+ public static void dropInventory(IInventory inventory, World world, double x, double y, double z)
+ {
if (inventory == null) { return; }
- for (int i = 0; i < inventory.getSizeInventory(); ++i) {
+ for (int i = 0; i < inventory.getSizeInventory(); ++i)
+ {
ItemStack itemStack = inventory.getStackInSlot(i);
- if (itemStack != null) {
+ if (itemStack != null)
+ {
dropItemStackInWorld(world, x, y, z, itemStack);
}
}
}
-
- public static void dropInventory(IInventory inventory, World world, int x, int y, int z) {
+
+ public static void dropInventory(IInventory inventory, World world, int x, int y, int z)
+ {
dropInventory(inventory, world, x + 0.5, y + 0.5, z + 0.5);
}
-
- public static TileEntity getTileInDirection(TileEntity tile, ForgeDirection direction) {
+
+ public static TileEntity getTileInDirection(TileEntity tile, ForgeDirection direction)
+ {
int targetX = tile.xCoord + direction.offsetX;
int targetY = tile.yCoord + direction.offsetY;
int targetZ = tile.zCoord + direction.offsetZ;
return tile.getWorldObj().getTileEntity(targetX, targetY, targetZ);
}
-
- public static int getFirstNonAirBlockFromTop(World world, int x, int z) {
+
+ public static int getFirstNonAirBlockFromTop(World world, int x, int z)
+ {
int y;
- for (y = world.getActualHeight(); world.isAirBlock(x, y - 1, z) && y > 0; y--) {}
+ for (y = world.getActualHeight(); world.isAirBlock(x, y - 1, z) && y > 0; y--)
+ {
+ }
return y;
}
-
- public static boolean isBlockHit(MovingObjectPosition mop, TileEntity tile) {
+
+ public static boolean isBlockHit(MovingObjectPosition mop, TileEntity tile)
+ {
if (tile == null) return false;
return isBlockHit(mop, tile.xCoord, tile.yCoord, tile.zCoord);
}
-
- public static boolean isBlockHit(MovingObjectPosition mop, int x, int y, int z) {
+
+ public static boolean isBlockHit(MovingObjectPosition mop, int x, int y, int z)
+ {
if (mop == null) return false;
return mop.blockX == x && mop.blockY == y && mop.blockZ == z;
}
-
+
} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java b/java/darkknight/jewelrycraft/util/JewelryNBT.java
index d76c84e..11ffc83 100644
--- a/src/main/java/darkknight/jewelrycraft/util/JewelryNBT.java
+++ b/java/darkknight/jewelrycraft/util/JewelryNBT.java
@@ -17,17 +17,18 @@ import net.minecraft.world.World;
public class JewelryNBT
{
- //TODO NBT Tag Adding
- /**
+ // TODO NBT Tag Adding
+ /**
*
- * @param item The item you want to add the NBT data on
- * @param metal The metal you want to add on the item
+ * @param item
+ * The item you want to add the NBT data on
+ * @param metal
+ * The metal you want to add on the item
*/
public static void addMetal(ItemStack item, ItemStack metal)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -37,19 +38,20 @@ public class JewelryNBT
metal.writeToNBT(ingotNBT);
itemStackData.setTag("ingot", ingotNBT);
}
-
+
/**
*
- * @param item The item you want to add the NBT data on
- * @param jewel The jewel you want to add on the item
+ * @param item
+ * The item you want to add the NBT data on
+ * @param jewel
+ * The jewel you want to add on the item
*/
public static void addJewel(ItemStack item, ItemStack jewel)
{
- if(jewel != null)
+ if (jewel != null)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -60,19 +62,20 @@ public class JewelryNBT
itemStackData.setTag("jewel", jewelNBT);
}
}
-
+
/**
*
- * @param item The item you want to add the NBT data on
- * @param modifier The modifier you want to add on the item
+ * @param item
+ * The item you want to add the NBT data on
+ * @param modifier
+ * The modifier you want to add on the item
*/
public static void addModifier(ItemStack item, ItemStack modifier)
{
- if(modifier != null)
+ if (modifier != null)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -83,12 +86,11 @@ public class JewelryNBT
itemStackData.setTag("modifier", modifierNBT);
}
}
-
+
public static void addEntity(ItemStack item, EntityLivingBase entity)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -98,28 +100,26 @@ public class JewelryNBT
entity.writeToNBT(entityNBT);
itemStackData.setTag("entity", entityNBT);
}
-
+
public static void addEntityID(ItemStack item, EntityLivingBase entity)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
NBTTagCompound entityNBT = new NBTTagCompound();
- int id = EntityList.getEntityID(entity);
+ int id = EntityList.getEntityID(entity);
entityNBT.setInteger("entityID", id);
itemStackData.setTag("entityID", entityNBT);
}
-
+
public static void addCoordonates(ItemStack item, double x, double y, double z)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -133,12 +133,11 @@ public class JewelryNBT
itemStackData.setTag("y", coords);
itemStackData.setTag("z", coords);
}
-
+
public static void addTileEntityBlock(ItemStack item, World world, int x, int y, int z)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -159,12 +158,11 @@ public class JewelryNBT
itemStackData.setTag("blockY", block);
itemStackData.setTag("blockZ", block);
}
-
+
public static void addBlock(ItemStack item, int block, int metadata)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -176,12 +174,11 @@ public class JewelryNBT
blockNBT.setInteger("metadata", metadata);
itemStackData.setTag("metadata", blockNBT);
}
-
+
public static void addBlockCoordonates(ItemStack item, int x, int y, int z)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -195,12 +192,11 @@ public class JewelryNBT
itemStackData.setTag("blockY", coords);
itemStackData.setTag("blockZ", coords);
}
-
+
public static void addCoordonatesAndDimension(ItemStack item, double x, double y, double z, int dim, String name)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -218,12 +214,11 @@ public class JewelryNBT
itemStackData.setTag("dimension", coords);
itemStackData.setTag("dimName", coords);
}
-
+
public static void addMode(ItemStack item, String modeN)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -233,12 +228,11 @@ public class JewelryNBT
mode.setString("mode", modeN);
itemStackData.setTag("mode", mode);
}
-
+
public static void addFakeEnchantment(ItemStack item)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -246,12 +240,11 @@ public class JewelryNBT
}
itemStackData.setTag("ench", new NBTTagList());
}
-
+
public static void addIngotColor(ItemStack item, int color)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -261,12 +254,11 @@ public class JewelryNBT
colors.setInteger("ingotColor", color);
itemStackData.setTag("ingotColor", colors);
}
-
+
public static void addJewelColor(ItemStack item, int color)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -276,29 +268,28 @@ public class JewelryNBT
colors.setInteger("jewelColor", color);
itemStackData.setTag("jewelColor", colors);
}
-
+
@SuppressWarnings("rawtypes")
public static void addEntities(ItemStack item, List list)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
NBTTagCompound entityNBT = new NBTTagCompound();
- for(int i=0; i < list.size(); i++) ((EntityLivingBase) list.get(i)).writeToNBT(entityNBT);
+ for (int i = 0; i < list.size(); i++)
+ ((EntityLivingBase) list.get(i)).writeToNBT(entityNBT);
itemStackData.setTag("entities", entityNBT);
}
-
- //TODO NBT Tag Removing
+
+ // TODO NBT Tag Removing
public static void removeNBT(ItemStack item, String tag)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
@@ -306,14 +297,14 @@ public class JewelryNBT
}
itemStackData.removeTag(tag);
}
-
+
public static void removeEntity(ItemStack item)
{
JewelryNBT.removeNBT(item, "entityID");
JewelryNBT.removeNBT(item, "entity");
JewelryNBT.removeNBT(item, "ench");
}
-
+
public static void removeBlock(ItemStack item)
{
JewelryNBT.removeNBT(item, "blockID");
@@ -323,77 +314,74 @@ public class JewelryNBT
JewelryNBT.removeNBT(item, "blockY");
JewelryNBT.removeNBT(item, "blockZ");
}
-
- //TODO NTB Tag Checking
+
+ // TODO NTB Tag Checking
public static boolean hasTag(ItemStack item, String tag)
{
NBTTagCompound itemStackData;
- if (item.hasTagCompound())
- itemStackData = item.getTagCompound();
+ if (item.hasTagCompound()) itemStackData = item.getTagCompound();
else
{
itemStackData = new NBTTagCompound();
item.setTagCompound(itemStackData);
}
- if(itemStackData.hasKey(tag)) return true;
+ if (itemStackData.hasKey(tag)) return true;
return false;
}
-
+
public static boolean isJewelX(ItemStack stack, ItemStack jewel)
{
- if(jewel(stack) != null && jewel(stack).getItem() == jewel.getItem() && jewel(stack).getItemDamage() == jewel.getItemDamage()) return true;
+ if (jewel(stack) != null && jewel(stack).getItem() == jewel.getItem() && jewel(stack).getItemDamage() == jewel.getItemDamage()) return true;
return false;
}
-
+
public static boolean isModifierX(ItemStack stack, ItemStack modifier)
{
- if(modifier(stack) != null && modifier(stack).getItem() == modifier.getItem() && modifier(stack).getItemDamage() == modifier.getItemDamage()) return true;
+ if (modifier(stack) != null && modifier(stack).getItem() == modifier.getItem() && modifier(stack).getItemDamage() == modifier.getItemDamage()) return true;
return false;
}
-
+
public static boolean isModifierEffectType(ItemStack stack)
{
- if(modifier(stack) != null && (isModifierX(stack, new ItemStack(Items.blaze_powder)) || isModifierX(stack, new ItemStack(Items.sugar))
- || isModifierX(stack, new ItemStack(Items.iron_pickaxe)) || isModifierX(stack, new ItemStack(Items.feather))
- || isModifierX(stack, new ItemStack(Items.potionitem, 1, 8270)))) return true;
+ if (modifier(stack) != null && (isModifierX(stack, new ItemStack(Items.blaze_powder)) || isModifierX(stack, new ItemStack(Items.sugar)) || isModifierX(stack, new ItemStack(Items.iron_pickaxe)) || isModifierX(stack, new ItemStack(Items.feather)) || isModifierX(stack, new ItemStack(Items.potionitem, 1, 8270)))) return true;
return false;
}
-
+
public static boolean isIngotX(ItemStack stack, ItemStack ingot)
{
- if(ingot(stack) != null && ingot(stack).getItem() == ingot.getItem() && ingot(stack).getItemDamage() == ingot.getItemDamage()) return true;
+ if (ingot(stack) != null && ingot(stack).getItem() == ingot.getItem() && ingot(stack).getItemDamage() == ingot.getItemDamage()) return true;
return false;
}
-
+
public static boolean isModeX(ItemStack stack, String modeN)
{
- if(modeName(stack) != null && modeName(stack).equals(modeN)) return true;
+ if (modeName(stack) != null && modeName(stack).equals(modeN)) return true;
return false;
}
-
+
public static boolean isEntityX(ItemStack stack, EntityPlayer player, EntityLivingBase entity)
{
- if(entity != null && entity instanceof EntityLivingBase && entity(stack, player) != null && entity(stack, player).equals(entity)) return true;
+ if (entity != null && entity instanceof EntityLivingBase && entity(stack, player) != null && entity(stack, player).equals(entity)) return true;
return false;
}
-
+
public static boolean isDimNameX(ItemStack stack, String dimName)
{
- if(ingot(stack) != null && dimName(stack).equals(dimName)) return true;
+ if (ingot(stack) != null && dimName(stack).equals(dimName)) return true;
return false;
}
-
+
public static boolean isDimensionX(ItemStack stack, int dimension)
{
- if(dimension(stack) != -2 && dimension(stack) == dimension) return true;
+ if (dimension(stack) != -2 && dimension(stack) == dimension) return true;
return false;
}
-
- //TODO Return components based on NBT
-
+
+ // TODO Return components based on NBT
+
public static ItemStack jewel(ItemStack stack)
{
- if(stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("jewel"))
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("jewel"))
{
NBTTagCompound jewelNBT = (NBTTagCompound) stack.getTagCompound().getTag("jewel");
ItemStack jewel = new ItemStack(Item.getItemById(0), 0, 0);
@@ -402,10 +390,10 @@ public class JewelryNBT
}
return null;
}
-
+
public static ItemStack modifier(ItemStack stack)
{
- if(stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("modifier"))
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("modifier"))
{
NBTTagCompound modifierNBT = (NBTTagCompound) stack.getTagCompound().getTag("modifier");
ItemStack modifier = new ItemStack(Item.getItemById(0), 0, 0);
@@ -414,10 +402,10 @@ public class JewelryNBT
}
return null;
}
-
+
public static ItemStack ingot(ItemStack stack)
{
- if(stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingot"))
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingot"))
{
NBTTagCompound ingotNBT = (NBTTagCompound) stack.getTagCompound().getTag("ingot");
ItemStack ingot = new ItemStack(Item.getItemById(0), 0, 0);
@@ -426,7 +414,7 @@ public class JewelryNBT
}
return null;
}
-
+
public static EntityLivingBase entity(ItemStack stack, EntityPlayer player)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("entityID") && stack.getTagCompound().hasKey("entity"))
@@ -436,7 +424,7 @@ public class JewelryNBT
int entityID = 0;
entityID = enID.getInteger("entityID");
EntityLivingBase entity = (EntityLivingBase) EntityList.createEntityByID(entityID, player.worldObj);
- if(entity != null && entity instanceof EntityLivingBase)
+ if (entity != null && entity instanceof EntityLivingBase)
{
entity.readFromNBT(en);
return entity;
@@ -445,14 +433,14 @@ public class JewelryNBT
}
return null;
}
-
+
public static TileEntity tileEntity(ItemStack stack)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("tile"))
{
NBTTagCompound tileNBT = (NBTTagCompound) stack.getTagCompound().getTag("tile");
TileEntity tile = (TileEntity) TileEntity.createAndLoadEntity(tileNBT);
- if(tile != null && tile instanceof TileEntity)
+ if (tile != null && tile instanceof TileEntity)
{
tile.readFromNBT(tileNBT);
return tile;
@@ -461,10 +449,10 @@ public class JewelryNBT
}
return null;
}
-
+
public static String dimName(ItemStack stack)
{
- if(stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("dimName"))
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("dimName"))
{
NBTTagCompound dim = (NBTTagCompound) stack.getTagCompound().getTag("dimName");
String name = dim.getString("dimName");
@@ -472,10 +460,10 @@ public class JewelryNBT
}
return null;
}
-
+
public static String modeName(ItemStack stack)
{
- if(stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("mode"))
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("mode"))
{
NBTTagCompound dim = (NBTTagCompound) stack.getTagCompound().getTag("mode");
String name = dim.getString("mode");
@@ -483,10 +471,10 @@ public class JewelryNBT
}
return null;
}
-
+
public static int dimension(ItemStack stack)
{
- if(stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("dimension"))
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("dimension"))
{
NBTTagCompound dim = (NBTTagCompound) stack.getTagCompound().getTag("dimension");
int dimension = dim.getInteger("dimension");
@@ -494,7 +482,7 @@ public class JewelryNBT
}
return -2;
}
-
+
public static int blockCoordX(ItemStack stack)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockX"))
@@ -505,7 +493,7 @@ public class JewelryNBT
}
return -1;
}
-
+
public static int blockCoordY(ItemStack stack)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockY"))
@@ -516,7 +504,7 @@ public class JewelryNBT
}
return -1;
}
-
+
public static int blockCoordZ(ItemStack stack)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockZ"))
@@ -527,7 +515,7 @@ public class JewelryNBT
}
return -1;
}
-
+
public static int blockID(ItemStack stack)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("blockID"))
@@ -538,7 +526,7 @@ public class JewelryNBT
}
return -1;
}
-
+
public static int blockMetadata(ItemStack stack)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("metadata"))
@@ -549,7 +537,7 @@ public class JewelryNBT
}
return -1;
}
-
+
public static double playerPosX(ItemStack stack)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("x"))
@@ -560,7 +548,7 @@ public class JewelryNBT
}
return -1;
}
-
+
public static double playerPosY(ItemStack stack)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("y"))
@@ -571,7 +559,7 @@ public class JewelryNBT
}
return -1;
}
-
+
public static double playerPosZ(ItemStack stack)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("z"))
@@ -582,10 +570,10 @@ public class JewelryNBT
}
return -1;
}
-
+
public static int ingotColor(ItemStack stack)
{
- if(stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingotColor"))
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("ingotColor"))
{
NBTTagCompound colors = (NBTTagCompound) stack.getTagCompound().getTag("ingotColor");
int color = colors.getInteger("ingotColor");
@@ -593,10 +581,10 @@ public class JewelryNBT
}
return 16777215;
}
-
+
public static int jewelColor(ItemStack stack)
{
- if(stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("jewelColor"))
+ if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.hasTagCompound() && stack.getTagCompound().hasKey("jewelColor"))
{
NBTTagCompound colors = (NBTTagCompound) stack.getTagCompound().getTag("jewelColor");
int color = colors.getInteger("jewelColor");
@@ -604,8 +592,9 @@ public class JewelryNBT
}
return 16777215;
}
-
- @SuppressWarnings({ "rawtypes", "unchecked", "null" })
+
+ @SuppressWarnings(
+ { "rawtypes", "unchecked", "null" })
public static List entities(ItemStack stack, EntityPlayer player)
{
if (stack != null && stack != new ItemStack(Item.getItemById(0), 0, 0) && stack.getTagCompound().hasKey("entities"))
@@ -615,7 +604,8 @@ public class JewelryNBT
int[] entityID;
EntityLivingBase entity;
entityID = enID.getIntArray("entitiesID");
- for(int i = 0; i < entityID.length; i++){
+ for (int i = 0; i < entityID.length; i++)
+ {
entity = (EntityLivingBase) EntityList.createEntityByID(entityID[i], player.worldObj);
list.add(entity);
}
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
index 7575c06..7c938e4 100644
--- a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
+++ b/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
@@ -18,12 +18,14 @@ public class JewelrycraftUtil
public static ArrayList<ItemStack> jewel = new ArrayList<ItemStack>();
public static ArrayList<ItemStack> jewelry = new ArrayList<ItemStack>();
public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
+ public static ArrayList<ItemStack> ores = new ArrayList<ItemStack>();
+ public static HashMap<Item, ItemStack> oreToIngot = new HashMap<Item, ItemStack>();
public static ArrayList<String> jamcraftPlayers = new ArrayList<String>();
public static Random rand = new Random();
-
+
public static void addStuff()
{
- //Modifiers
+ // Modifiers
modifiers.add(new ItemStack(Blocks.chest));
modifiers.add(new ItemStack(Blocks.torch));
modifiers.add(new ItemStack(Items.book));
@@ -38,10 +40,10 @@ public class JewelrycraftUtil
modifiers.add(new ItemStack(Items.blaze_powder));
modifiers.add(new ItemStack(Items.ender_eye));
modifiers.add(new ItemStack(Items.potionitem, 1, 8270));
-
- //Jewels
- for(int i=0; i < 16; i++)
- jewel.add(new ItemStack(ItemList.crystal, 1, i));
+
+ // Jewels
+ for (int i = 0; i < 16; i++)
+ jewel.add(new ItemStack(ItemList.crystal, 1, i));
jewel.add(new ItemStack(Blocks.redstone_block));
jewel.add(new ItemStack(Blocks.lapis_block));
jewel.add(new ItemStack(Blocks.obsidian));
@@ -49,8 +51,8 @@ public class JewelrycraftUtil
jewel.add(new ItemStack(Items.emerald));
jewel.add(new ItemStack(Items.ender_pearl));
jewel.add(new ItemStack(Items.nether_star));
-
- //Jewelry
+
+ // Jewelry
jewelry.add(new ItemStack(ItemList.ring));
jewelry.add(new ItemStack(ItemList.necklace));
}
@@ -79,59 +81,94 @@ public class JewelrycraftUtil
public static void addMetals()
{
- int index = 0, index2 = 0;
- while(index < OreDictionary.getOreNames().length)
+ int index = 0;
+ while (index < OreDictionary.getOreNames().length)
{
Iterator<ItemStack> i = OreDictionary.getOres(OreDictionary.getOreNames()[index]).iterator();
-
+
while (i.hasNext())
{
ItemStack nextStack = i.next();
-
- if ((nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || nextStack.getItem().getUnlocalizedName().toLowerCase().contains("alloy")) && !metal.contains(nextStack)) metal.add(nextStack);
+
+ if ((nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || nextStack.getItem().getUnlocalizedName().toLowerCase().contains("alloy")) && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("powder") && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("dust") && !nextStack.getItem().getUnlocalizedName().toLowerCase().contains("block") && !metal.contains(nextStack)){
+ metal.add(nextStack);
+ if(OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore")) != null){
+ ores.addAll(OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore")));
+ Iterator<ItemStack> ores = OreDictionary.getOres(OreDictionary.getOreNames()[index].replace("ingot", "ore")).iterator();
+ while(ores.hasNext())
+ {
+ ItemStack ore = ores.next();
+ oreToIngot.put(ore.getItem(), nextStack);
+ }
+ }
+ }
}
index++;
- }
- if(!metal.contains(new ItemStack(Items.gold_ingot)))metal.add(new ItemStack(Items.gold_ingot));
- if(!metal.contains(new ItemStack(Items.iron_ingot)))metal.add(new ItemStack(Items.iron_ingot));
+ }
}
-
+
public static boolean isModifier(ItemStack item)
{
Iterator<ItemStack> i = modifiers.iterator();
-
+
while (i.hasNext())
{
ItemStack temp = i.next();
- if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage())
- return true;
+ if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
}
return false;
}
-
+
public static boolean isJewel(ItemStack item)
{
Iterator<ItemStack> i = jewel.iterator();
-
+
while (i.hasNext())
{
ItemStack temp = i.next();
- if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage())
- return true;
+ if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
}
return false;
}
-
+
+ public static boolean isMetal(ItemStack item)
+ {
+ Iterator<ItemStack> i = metal.iterator();
+
+ while (i.hasNext())
+ {
+ ItemStack temp = i.next();
+ if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
+ }
+ return false;
+ }
+
public static boolean isJewelry(ItemStack item)
{
Iterator<ItemStack> i = jewelry.iterator();
-
+
while (i.hasNext())
{
ItemStack temp = i.next();
- if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage())
- return true;
+ if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
}
return false;
}
+
+ public static boolean isOre(ItemStack item)
+ {
+ Iterator<ItemStack> i = ores.iterator();
+
+ while (i.hasNext())
+ {
+ ItemStack temp = i.next();
+ if (temp.getItem() == item.getItem() && temp.getItemDamage() == item.getItemDamage()) return true;
+ }
+ return false;
+ }
+
+ public static ItemStack getIngotFromOre(Item ore)
+ {
+ return oreToIngot.get(ore);
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java b/java/darkknight/jewelrycraft/util/PlayerUtils.java
index aa6a12b..1135860 100644
--- a/src/main/java/darkknight/jewelrycraft/util/PlayerUtils.java
+++ b/java/darkknight/jewelrycraft/util/PlayerUtils.java
@@ -9,49 +9,35 @@ import cpw.mods.fml.common.FMLCommonHandler;
/**
* Code taken from OpenBlocks
*/
-public class PlayerUtils
-{
- public static boolean isPlayerOp(String username)
+public class PlayerUtils
+{
+ public static NBTTagCompound getModPlayerPersistTag(EntityPlayer player, String modName)
{
- username = username.toLowerCase();
-
- MinecraftServer server = FMLCommonHandler.instance().getSidedDelegate().getServer();
-
- // SP and LAN
- if (server.isSinglePlayer()) {
- if (server instanceof IntegratedServer) return server.getServerOwner().equals(username);
- return server.getConfigurationManager().getOps().contains(username);
- }
-
- // SMP
- return server.getConfigurationManager().getOps().contains(username);
- }
-
- public static NBTTagCompound getModPlayerPersistTag(EntityPlayer player, String modName)
- {
-
+
NBTTagCompound tag = player.getEntityData();
-
+
NBTTagCompound persistTag = null;
- if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG))
+ if (tag.hasKey(EntityPlayer.PERSISTED_NBT_TAG))
{
persistTag = tag.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
- } else
+ }
+ else
{
persistTag = new NBTTagCompound();
tag.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistTag);
}
-
+
NBTTagCompound modTag = null;
- if (persistTag.hasKey(modName))
+ if (persistTag.hasKey(modName))
{
modTag = persistTag.getCompoundTag(modName);
- } else
+ }
+ else
{
modTag = new NBTTagCompound();
persistTag.setTag(modName, modTag);
}
-
+
return modTag;
}
} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java b/java/darkknight/jewelrycraft/worldGen/Generation.java
index 90d2bb1..bb6d3f2 100644
--- a/src/main/java/darkknight/jewelrycraft/worldGen/Generation.java
+++ b/java/darkknight/jewelrycraft/worldGen/Generation.java
@@ -28,7 +28,8 @@ public class Generation implements IWorldGenerator
}
private void generateEnd(World world, Random random, int i, int j)
- {}
+ {
+ }
private void generateSurface(World world, Random random, int i, int j)
{
@@ -37,12 +38,13 @@ public class Generation implements IWorldGenerator
int x = i + random.nextInt(16);
int y = 5 + random.nextInt(4);
int z = j + random.nextInt(16);
- if(world.getBlock(x, y, z) == Blocks.stone) world.setBlock(x, y, z, BlockList.shadowOre);
+ if (world.getBlock(x, y, z) == Blocks.stone) world.setBlock(x, y, z, 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);
+ 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);
}
}
private void generateNether(World world, Random random, int i, int j)
- {}
+ {
+ }
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java b/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
index 32c9ec2..706282a 100644
--- a/src/main/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
+++ b/java/darkknight/jewelrycraft/worldGen/village/ComponentJewelry.java
@@ -28,120 +28,121 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class ComponentJewelry extends StructureVillagePieces.House1
{
private int averageGroundLevel = -1;
-
+
public ComponentJewelry()
{
}
-
+
public ComponentJewelry(Start par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5)
{
super();
this.coordBaseMode = par5;
this.boundingBox = par4StructureBoundingBox;
}
-
+
@SuppressWarnings("rawtypes")
- public static ComponentJewelry buildComponent (Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
+ public static ComponentJewelry buildComponent(Start villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 11, 5, 12, p4);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(pieces, structureboundingbox) == null ? new ComponentJewelry(villagePiece, p5, random,
- structureboundingbox, p4) : null;
+ return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(pieces, structureboundingbox) == null ? new ComponentJewelry(villagePiece, p5, random, structureboundingbox, p4) : null;
}
-
+
/**
- * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at
- * the end, it adds Fences...
+ * second Part of Structure generating, this for example places Spiderwebs,
+ * Mob Spawners, it closes Mineshafts at the end, it adds Fences...
*/
- public boolean addComponentParts (World world, Random random, StructureBoundingBox sbb)
+ public boolean addComponentParts(World world, Random random, StructureBoundingBox sbb)
{
if (this.averageGroundLevel < 0)
{
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
-
- if (this.averageGroundLevel < 0)
- {
- return true;
- }
-
+
+ if (this.averageGroundLevel < 0) { return true; }
+
this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 3, 0);
}
-
+
/**
- * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int
- * maxZ, int placeBlockId, int replaceBlockId, boolean alwaysreplace)
+ * arguments: (World worldObj, StructureBoundingBox structBB, int minX,
+ * int minY, int minZ, int maxX, int maxY, int maxZ, int placeBlockId,
+ * int replaceBlockId, boolean alwaysreplace)
*/
this.fillWithBlocks(world, sbb, 0, 0, 6, 10, 5, 11, Block.getBlockById(0), Block.getBlockById(0), false);
this.fillWithBlocks(world, sbb, 2, 0, 0, 8, 5, 5, Block.getBlockById(0), Block.getBlockById(0), false);
- //Pillars
+ // Pillars
this.fillWithBlocks(world, sbb, 2, 0, 0, 2, 3, 0, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 2, 0, 3, 2, 3, 3, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 8, 0, 0, 8, 3, 0, Blocks.log, Blocks.log, false);
this.fillWithBlocks(world, sbb, 8, 0, 3, 8, 3, 3, Blocks.log, Blocks.log, false);
-
- //Walls
+
+ // Walls
this.fillWithBlocks(world, sbb, 2, 0, 1, 2, 3, 2, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 2, 0, 4, 2, 3, 5, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 8, 0, 1, 8, 3, 2, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 8, 0, 4, 8, 3, 5, Blocks.planks, Blocks.planks, false);
this.fillWithBlocks(world, sbb, 3, 0, 0, 7, 3, 0, Blocks.planks, Blocks.planks, false);
-
+
this.fillWithBlocks(world, sbb, 0, 0, 6, 10, 3, 6, Blocks.cobblestone, Blocks.cobblestone, false);
this.fillWithBlocks(world, sbb, 0, 0, 11, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
this.fillWithBlocks(world, sbb, 0, 0, 6, 0, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
this.fillWithBlocks(world, sbb, 10, 0, 6, 10, 3, 11, Blocks.cobblestone, Blocks.cobblestone, false);
-
- //Roof
- for(int i = 3; i <= 7; i++)
- for(int j = 1; j <= 5; j++)
+
+ // Roof
+ for (int i = 3; i <= 7; i++)
+ for (int j = 1; j <= 5; j++)
this.placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 2, i, 4, j, sbb);
-
- for(int i = 3; i <= 7; i++)
- for(int j = 6; j <= 6; j++)
+
+ for (int i = 3; i <= 7; i++)
+ for (int j = 6; j <= 6; j++)
this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, 0, i, 4, j, sbb);
-
- for(int i = 1; i <= 9; i++)
- for(int j = 7; j <= 10; j++)
+
+ for (int i = 1; i <= 9; i++)
+ for (int j = 7; j <= 10; j++)
this.placeBlockAtCurrentPosition(world, Blocks.stone_slab, 3, i, 4, j, sbb);
-
- for(int i = 2; i <= 8; i++)
+
+ for (int i = 2; i <= 8; i++)
this.placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, i, 4, 0, sbb);
-
- for(int i = 1; i <= 5; i++){
+
+ for (int i = 1; i <= 5; i++)
+ {
this.placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 2, 4, i, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.double_wooden_slab, 2, 8, 4, i, sbb);
}
-
- for(int i = 0; i <= 2; i++){
+
+ for (int i = 0; i <= 2; i++)
+ {
this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i + 8, 4, 6, sbb);
}
-
- for(int i = 7; i <= 11; i++){
+
+ for (int i = 7; i <= 11; i++)
+ {
this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 0, 4, i, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 10, 4, i, sbb);
}
-
- for(int i = 0; i <= 10; i++)
+
+ for (int i = 0; i <= 10; i++)
this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, i, 4, 11, sbb);
-
- //Base
- for(int i = 2; i <= 8; i++)
- for(int j = 0; j <= 5; j++)
+
+ // Base
+ for (int i = 2; i <= 8; i++)
+ for (int j = 0; j <= 5; j++)
this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, i, 0, j, sbb);
this.fillWithBlocks(world, sbb, 0, 0, 6, 10, 0, 11, Blocks.stonebrick, Blocks.stonebrick, false);
-
- for(int i = 6; i <= 10; i++)
+
+ for (int i = 6; i <= 10; i++)
this.placeBlockAtCurrentPosition(world, Blocks.double_stone_slab, 0, 5, 0, i, sbb);
-
- for(int i = 7; i <= 10; i++){
+
+ for (int i = 7; i <= 10; i++)
+ {
this.placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 1, 0, i, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.stonebrick, 3, 9, 0, i, sbb);
}
-
- //Decorations
+
+ // Decorations
this.placeDoorAtCurrentPosition(world, sbb, random, 6, 1, 0, this.getMetadataWithOffset(Blocks.wooden_door, 1));
this.placeDoorAtCurrentPosition(world, sbb, random, 5, 1, 6, this.getMetadataWithOffset(Blocks.wooden_door, 1));
-
+
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 3, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 4, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 2, 2, 1, sbb);
@@ -152,50 +153,53 @@ public class ComponentJewelry extends StructureVillagePieces.House1
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 4, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 8, 2, 5, sbb);
-
+
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 3, 1, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 3, 3, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 7, 3, 3, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 5, sbb);
-
+
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 7, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 3, 10, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 8, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 1, 3, 9, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 8, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 9, 3, 9, sbb);
-
+
int bgCarpetColor = random.nextInt(16);
-
- for(int i = 4; i <= 7; i++)
- for(int j = 1; j <= 5; j++)
+
+ for (int i = 4; i <= 7; i++)
+ for (int j = 1; j <= 5; j++)
this.placeBlockAtCurrentPosition(world, Blocks.carpet, bgCarpetColor, i, 1, j, sbb);
-
+
generateChest(world, 3, 1, 1, 0, random, sbb, ConfigHandler.jewelsChestMin, ConfigHandler.jewelsChestMax);
- generateDisplayer(world, 3, 1, 2, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb);
- placeBlockAtCurrentPosition(world, BlockList.jewelCraftingTable, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, 3, 1, 3, sbb);
- generateDisplayer(world, 3, 1, 4, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb);
+ generateDisplayer(world, 3, 1, 2, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb);
+ placeBlockAtCurrentPosition(world, BlockList.jewelCraftingTable, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, 3, 1, 3, sbb);
+ generateDisplayer(world, 3, 1, 4, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb);
generateChest(world, 3, 1, 5, 0, random, sbb, ConfigHandler.jewelsChestMin, ConfigHandler.jewelsChestMax);
-
+
generateFurnace(world, 1, 1, 7, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 2, 7, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 3, 7, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 1, 10, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 2, 10, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
generateFurnace(world, 1, 3, 10, 0, random, sbb, ConfigHandler.furnacesIngotStackMin, ConfigHandler.furnacesIngotStackMax, ConfigHandler.canFurnacesGenerateIngots);
-
- generateSmelter(world, 1, 1, 8, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb, random.nextBoolean());
- generateSmelter(world, 1, 1, 9, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb, random.nextBoolean());
-
- generateMolder(world, 2, 1, 8, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb, random.nextBoolean(), random.nextBoolean());
- generateMolder(world, 2, 1, 9, (coordBaseMode == 0 || coordBaseMode == 2)?1:2, random, sbb, random.nextBoolean(), random.nextBoolean());
-
- generateIngotChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
- generateIngotChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
- generateIngotChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
- generateIngotChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
-
+ generateSmelter(world, 1, 1, 8, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb, random.nextBoolean());
+ generateSmelter(world, 1, 1, 9, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb, random.nextBoolean());
+
+ generateMolder(world, 2, 1, 8, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb, random.nextBoolean(), random.nextBoolean());
+ generateMolder(world, 2, 1, 9, (coordBaseMode == 0 || coordBaseMode == 2) ? 1 : 2, random, sbb, random.nextBoolean(), random.nextBoolean());
+
+ if(random.nextBoolean()) generateIngotChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
+ else generateOresChest(world, 9, 1, 7, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
+ if(random.nextBoolean()) generateIngotChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
+ else generateOresChest(world, 9, 1, 8, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.chest, ConfigHandler.ingotChestMaxStack);
+ if(random.nextBoolean()) generateIngotChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
+ else generateOresChest(world, 9, 1, 9, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
+ if(random.nextBoolean()) generateIngotChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
+ else generateOresChest(world, 9, 1, 10, 0, random, sbb, ConfigHandler.ingotChestMin, ConfigHandler.ingotChestMax, Blocks.trapped_chest, ConfigHandler.ingotChestMaxStack);
+
for (int l = 0; l < 6; ++l)
{
for (int i1 = 2; i1 < 9; ++i1)
@@ -204,7 +208,7 @@ public class ComponentJewelry extends StructureVillagePieces.House1
this.func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
}
}
-
+
for (int l = 6; l < 12; ++l)
{
for (int i1 = 0; i1 < 11; ++i1)
@@ -213,12 +217,12 @@ public class ComponentJewelry extends StructureVillagePieces.House1
this.func_151554_b(world, Blocks.cobblestone, 0, i1, -1, l, sbb);
}
}
-
+
this.spawnVillagers(world, sbb, 3, 1, 3, 1);
-
+
return true;
}
-
+
public void generateChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max)
{
int i1 = this.getXWithOffset(i, k);
@@ -226,18 +230,18 @@ public class ComponentJewelry extends StructureVillagePieces.House1
int k1 = this.getZWithOffset(i, k);
int t = random.nextInt(max - min + 1) + min;
this.placeBlockAtCurrentPosition(world, Blocks.chest, metadata, i, j, k, sbb);
- TileEntityChest chest = (TileEntityChest)world.getTileEntity(i1, j1, k1);
- while(chest != null && t > 0)
+ TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0)
{
ItemStack jewels = JewelrycraftUtil.jewel.get(random.nextInt(JewelrycraftUtil.jewel.size()));
chest.func_145976_a("Jeweler's Chest");
- if(random.nextBoolean()) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), JewelrycraftUtil.modifiers.get(random.nextInt(JewelrycraftUtil.modifiers.size())));
- else if(jewels.getItem() == Items.nether_star && ConfigHandler.generateVillageNetherstar) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
- else if(random.nextBoolean() && jewels.getItem() != Items.nether_star) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
+ if (random.nextBoolean()) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), JewelrycraftUtil.modifiers.get(random.nextInt(JewelrycraftUtil.modifiers.size())));
+ else if (jewels.getItem() == Items.nether_star && ConfigHandler.generateVillageNetherstar) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
+ else if (random.nextBoolean() && jewels.getItem() != Items.nether_star) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), jewels);
t--;
}
}
-
+
public void generateIngotChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, Block chestB, int randomAmount)
{
int i1 = this.getXWithOffset(i, k);
@@ -245,117 +249,141 @@ public class ComponentJewelry extends StructureVillagePieces.House1
int k1 = this.getZWithOffset(i, k);
int t = random.nextInt(max - min + 1) + min;
this.placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
- TileEntityChest chest = (TileEntityChest)world.getTileEntity(i1, j1, k1);
- while(chest != null && t > 0)
+ TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0)
{
chest.func_145976_a("Ingot Chest");
- if(random.nextBoolean()) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), new ItemStack(JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).getItem(), 2 + random.nextInt(randomAmount)));
+ int metalID = random.nextInt(JewelrycraftUtil.metal.size());
+ ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
+ metal.stackSize = 2 + random.nextInt(randomAmount);
+ if (random.nextBoolean()) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), metal);
t--;
}
}
-
- public void generateTrappedChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max)
+
+ public void generateOresChest(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, Block chestB, int randomAmount)
{
int i1 = this.getXWithOffset(i, k);
int j1 = this.getYWithOffset(j);
int k1 = this.getZWithOffset(i, k);
int t = random.nextInt(max - min + 1) + min;
- this.placeBlockAtCurrentPosition(world, Blocks.trapped_chest, metadata, i, j, k, sbb);
- TileEntityChest chest = (TileEntityChest)world.getTileEntity(i1, j1, k1);
- while(chest != null && t > 0)
+ this.placeBlockAtCurrentPosition(world, chestB, metadata, i, j, k, sbb);
+ TileEntityChest chest = (TileEntityChest) world.getTileEntity(i1, j1, k1);
+ while (chest != null && t > 0)
{
- chest.func_145976_a("Jeweler's Chest");
- if(random.nextBoolean()) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), JewelrycraftUtil.modifiers.get(random.nextInt(JewelrycraftUtil.modifiers.size())));
- else chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), JewelrycraftUtil.jewel.get(random.nextInt(JewelrycraftUtil.jewel.size())));
+ chest.func_145976_a("Ores Chest");
+ int oreID = random.nextInt(JewelrycraftUtil.ores.size());
+ ItemStack ores = JewelrycraftUtil.ores.get(oreID).copy();
+ ores.stackSize = 2 + random.nextInt(randomAmount);
+ if (random.nextBoolean()) chest.setInventorySlotContents(random.nextInt(chest.getSizeInventory()), ores);
t--;
}
}
-
+
public void generateDisplayer(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb)
{
int i1 = this.getXWithOffset(i, k);
int j1 = this.getYWithOffset(j);
int k1 = this.getZWithOffset(i, k);
placeBlockAtCurrentPosition(world, BlockList.displayer, metadata, i, j, k, sbb);
- TileEntityDisplayer displayer = (TileEntityDisplayer)world.getTileEntity(i1, j1, k1);
- if(displayer != null)
+ TileEntityDisplayer displayer = (TileEntityDisplayer) world.getTileEntity(i1, j1, k1);
+ if (displayer != null)
{
ItemStack ring = new ItemStack(ItemList.ring);
JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
JewelryNBT.addModifier(ring, JewelrycraftUtil.modifiers.get(random.nextInt(JewelrycraftUtil.modifiers.size())));
JewelryNBT.addJewel(ring, JewelrycraftUtil.jewel.get(random.nextInt(JewelrycraftUtil.jewel.size())));
- if(JewelryNBT.isModifierEffectType(ring)) JewelryNBT.addMode(ring, "Activated");
- if(JewelryNBT.isJewelX(ring, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(ring, new ItemStack(Items.book)))
- JewelryNBT.addMode(ring, "Disenchant");
+ if (JewelryNBT.isModifierEffectType(ring)) JewelryNBT.addMode(ring, "Activated");
+ if (JewelryNBT.isJewelX(ring, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(ring, new ItemStack(Items.book))) JewelryNBT.addMode(ring, "Disenchant");
displayer.object = ring;
displayer.quantity = 1;
displayer.hasObject = true;
}
}
-
+
public void generateSmelter(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, boolean isEmpty)
{
int i1 = this.getXWithOffset(i, k);
int j1 = this.getYWithOffset(j);
int k1 = this.getZWithOffset(i, k);
placeBlockAtCurrentPosition(world, BlockList.smelter, metadata, i, j, k, sbb);
- TileEntitySmelter smelter = (TileEntitySmelter)world.getTileEntity(i1, j1, k1);
- if(smelter != null && !isEmpty)
+ TileEntitySmelter smelter = (TileEntitySmelter) world.getTileEntity(i1, j1, k1);
+ if (smelter != null && !isEmpty)
{
- smelter.moltenMetal = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
+ int metal = random.nextInt(JewelrycraftUtil.metal.size());
+ smelter.moltenMetal = JewelrycraftUtil.metal.get(metal).copy();
smelter.hasMoltenMetal = true;
- smelter.quantity = 1f;
+ int quantity = random.nextInt(9);
+ switch(quantity)
+ {
+ case 0: smelter.quantity = 0.1f;
+ case 1: smelter.quantity = 0.2f;
+ case 2: smelter.quantity = 0.3f;
+ case 3: smelter.quantity = 0.4f;
+ case 4: smelter.quantity = 0.5f;
+ case 5: smelter.quantity = 0.6f;
+ case 6: smelter.quantity = 0.7f;
+ case 7: smelter.quantity = 0.8f;
+ case 8: smelter.quantity = 0.9f;
+ default: smelter.quantity = 0.1f;
+ }
}
}
-
+
public void generateMolder(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, boolean hasMold, boolean hasStuff)
{
int i1 = this.getXWithOffset(i, k);
int j1 = this.getYWithOffset(j);
int k1 = this.getZWithOffset(i, k);
placeBlockAtCurrentPosition(world, BlockList.molder, metadata, i, j, k, sbb);
- TileEntityMolder molder = (TileEntityMolder)world.getTileEntity(i1, j1, k1);
- if(molder != null)
+ TileEntityMolder molder = (TileEntityMolder) world.getTileEntity(i1, j1, k1);
+ if (molder != null)
{
- if(hasMold){
+ if (hasMold)
+ {
int meta = random.nextInt(ItemMolds.moldsItemNames.length + 1);
molder.mold = new ItemStack(ItemList.molds, 1, meta);
molder.hasMold = true;
- if(hasStuff){
+ if (hasStuff)
+ {
ItemStack ring = new ItemStack(ItemList.ring);
- JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
+ JewelryNBT.addMetal(ring, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
ItemStack necklace = new ItemStack(ItemList.necklace);
- JewelryNBT.addMetal(necklace, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
- if(meta == 0) molder.jewelBase = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
- else if(meta == 1) molder.jewelBase = ring;
+ JewelryNBT.addMetal(necklace, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())).copy());
+ if (meta == 0) molder.jewelBase = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
+ else if (meta == 1) molder.jewelBase = ring;
else molder.jewelBase = necklace;
molder.hasJewelBase = true;
}
}
}
}
-
+
public void generateFurnace(World world, int i, int j, int k, int metadata, Random random, StructureBoundingBox sbb, int min, int max, boolean hasMetal)
{
int i1 = this.getXWithOffset(i, k);
int j1 = this.getYWithOffset(j);
int k1 = this.getZWithOffset(i, k);
placeBlockAtCurrentPosition(world, Blocks.furnace, metadata, i, j, k, sbb);
- TileEntityFurnace furnace = (TileEntityFurnace)world.getTileEntity(i1, j1, k1);
- if(furnace != null)
+ TileEntityFurnace furnace = (TileEntityFurnace) world.getTileEntity(i1, j1, k1);
+ if (furnace != null)
{
- if(random.nextBoolean()) furnace.setInventorySlotContents(1, new ItemStack(Items.coal, 1 + random.nextInt(16)));
- if(hasMetal){
- ItemStack metal = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
- furnace.setInventorySlotContents(2, new ItemStack(metal.getItem(), random.nextInt(max - min + 1) + min));
+ if (random.nextBoolean()) furnace.setInventorySlotContents(1, new ItemStack(Items.coal, 1 + random.nextInt(16)));
+ if (hasMetal)
+ {
+ int metalID = random.nextInt(JewelrycraftUtil.metal.size());
+ ItemStack metal = JewelrycraftUtil.metal.get(metalID).copy();
+ metal.stackSize = random.nextInt(max - min + 1) + min;
+ furnace.setInventorySlotContents(2, metal);
}
}
}
-
+
/**
- * Returns the villager type to spawn in this component, based on the number of villagers already spawned.
+ * Returns the villager type to spawn in this component, based on the number
+ * of villagers already spawned.
*/
- protected int getVillagerType (int par1)
+ protected int getVillagerType(int par1)
{
return 3000;
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java b/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java
index 8b5c79e..7cec830 100644
--- a/src/main/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java
+++ b/java/darkknight/jewelrycraft/worldGen/village/JCTrades.java
@@ -16,100 +16,100 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil;
public class JCTrades implements IVillageTradeHandler
{
-
+
public JCTrades()
{
super();
}
-
+
@Override
- public void manipulateTradesForVillager (EntityVillager villager, MerchantRecipeList recipeList, Random random)
+ public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random)
{
if (villager.getProfession() == 3000)
{
ItemStack ingredient = null;
ItemStack ingredient2 = null;
ItemStack result;
-
+
int type = random.nextInt(12);
- switch(type)
+ switch (type)
{
case 0:
{
result = JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size()));
result.stackSize = 5 + random.nextInt(8);
ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(2));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(2));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(2));
break;
}
case 1:
{
- result = new ItemStack(ItemList.molds, 5 + random.nextInt(7), random.nextInt(2));
+ result = new ItemStack(ItemList.molds, 5 + random.nextInt(7), random.nextInt(2));
ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(1));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
break;
}
case 2:
{
- result = new ItemStack(ItemList.thiefGloves);
+ result = new ItemStack(ItemList.thiefGloves);
ingredient = new ItemStack(Items.emerald, 16 + random.nextInt(8));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 8 + random.nextInt(4));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 8 + random.nextInt(4));
break;
}
case 3:
{
- result = new ItemStack(BlockList.displayer, 1 + random.nextInt(6));
+ result = new ItemStack(BlockList.displayer, 1 + random.nextInt(6));
ingredient = new ItemStack(Items.emerald, 3 + random.nextInt(8));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 3 + random.nextInt(8));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 3 + random.nextInt(8));
break;
}
case 4:
{
- result = new ItemStack(BlockList.jewelCraftingTable);
+ result = new ItemStack(BlockList.jewelCraftingTable);
ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
break;
}
case 5:
{
- result = new ItemStack(BlockList.shadowOre, 1 + random.nextInt(16));
+ result = new ItemStack(BlockList.shadowOre, 1 + random.nextInt(16));
ingredient = new ItemStack(Items.emerald, 3 + random.nextInt(4));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 3 + random.nextInt(4));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 3 + random.nextInt(4));
break;
}
case 6:
{
- result = new ItemStack(BlockList.molder, 5 + random.nextInt(5));
+ result = new ItemStack(BlockList.molder, 5 + random.nextInt(5));
ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(1));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(1));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(1));
break;
}
case 7:
{
- result = new ItemStack(BlockList.smelter);
+ result = new ItemStack(BlockList.smelter);
ingredient = new ItemStack(Items.emerald, 1 + random.nextInt(2));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 1 + random.nextInt(2));
break;
}
case 8:
{
int end = random.nextInt(JewelrycraftUtil.modifiers.size());
result = JewelrycraftUtil.modifiers.get(end);
- if(JewelrycraftUtil.modifiers.size() - 1 - end >= 3)
+ if (JewelrycraftUtil.modifiers.size() - 1 - end >= 3)
{
result.stackSize = 1 + random.nextInt(JewelrycraftUtil.modifiers.size() - end);
int value = end;
- if(value > 64) value = 64;
+ if (value > 64) value = 64;
ingredient = new ItemStack(Items.emerald, 3 + random.nextInt(value));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 4 + random.nextInt(value));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 4 + random.nextInt(value));
}
else
{
result.stackSize = 1 + random.nextInt(7);
- ingredient = new ItemStack(Items.emerald, result.stackSize/2 + 1 + random.nextInt(7));
- ingredient2 = new ItemStack(Items.emerald, result.stackSize/2 + 1 + random.nextInt(4));
+ ingredient = new ItemStack(Items.emerald, result.stackSize / 2 + 1 + random.nextInt(7));
+ ingredient2 = new ItemStack(Items.emerald, result.stackSize / 2 + 1 + random.nextInt(4));
}
- if(result.getMaxStackSize()<=1) result.stackSize = 1;
+ if (result.getMaxStackSize() <= 1) result.stackSize = 1;
break;
}
case 9:
@@ -117,34 +117,41 @@ public class JCTrades implements IVillageTradeHandler
int end = random.nextInt(JewelrycraftUtil.jewel.size());
result = JewelrycraftUtil.jewel.get(end);
result.stackSize = 1 + random.nextInt(JewelrycraftUtil.jewel.size() - end);
- if(JewelrycraftUtil.jewel.size() - 1 - end >= 1)
+ if (JewelrycraftUtil.jewel.size() - 1 - end >= 1)
{
int value = end;
- if(value > 64) value = 64;
+ if (value > 64) value = 64;
ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(value));
- if(random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(value));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(value));
}
else
{
ingredient = new ItemStack(Blocks.emerald_block, 16 + random.nextInt(32));
- ingredient2 = new ItemStack(Blocks.emerald_block, 8 + random.nextInt(48));
+ ingredient2 = new ItemStack(Blocks.emerald_block, 8 + random.nextInt(48));
}
break;
}
- default:
+ case 10:
+ {
+ result = JewelrycraftUtil.ores.get(random.nextInt(JewelrycraftUtil.ores.size()));
+ result.stackSize = 3 + random.nextInt(8);
+ ingredient = new ItemStack(Items.emerald, 2 + random.nextInt(2));
+ if (random.nextBoolean()) ingredient2 = new ItemStack(Items.emerald, 2 + random.nextInt(2));
+ break;
+ }
+ default:
{
result = new ItemStack(ItemList.ring, 1, 0);
JewelryNBT.addMetal(result, JewelrycraftUtil.metal.get(random.nextInt(JewelrycraftUtil.metal.size())));
JewelryNBT.addModifier(result, JewelrycraftUtil.modifiers.get(random.nextInt(JewelrycraftUtil.modifiers.size())));
JewelryNBT.addJewel(result, JewelrycraftUtil.jewel.get(random.nextInt(JewelrycraftUtil.jewel.size())));
- if(JewelryNBT.isModifierEffectType(result)) JewelryNBT.addMode(result, "Activated");
- if(JewelryNBT.isJewelX(result, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(result, new ItemStack(Items.book)))
- JewelryNBT.addMode(result, "Disenchant");
+ if (JewelryNBT.isModifierEffectType(result)) JewelryNBT.addMode(result, "Activated");
+ if (JewelryNBT.isJewelX(result, new ItemStack(Items.nether_star)) && JewelryNBT.isModifierX(result, new ItemStack(Items.book))) JewelryNBT.addMode(result, "Disenchant");
ingredient = new ItemStack(Items.emerald, 16 + random.nextInt(20));
ingredient2 = new ItemStack(Blocks.emerald_block, 5 + random.nextInt(5));
}
}
-
+
recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result));
}
}
diff --git a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java b/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java
index 3b3aa3f..e12fde1 100644
--- a/src/main/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java
+++ b/java/darkknight/jewelrycraft/worldGen/village/VillageJewelryHandler.java
@@ -14,19 +14,19 @@ import darkknight.jewelrycraft.config.ConfigHandler;
public class VillageJewelryHandler implements IVillageCreationHandler
{
@Override
- public PieceWeight getVillagePieceWeight (Random random, int i)
+ public PieceWeight getVillagePieceWeight(Random random, int i)
{
return new PieceWeight(ComponentJewelry.class, ConfigHandler.jewelerWeight, ConfigHandler.maxVillageJewelers);
}
-
+
@Override
- public Class<?> getComponentClass ()
+ public Class<?> getComponentClass()
{
return ComponentJewelry.class;
}
-
+
@Override
- public Object buildComponent (PieceWeight villagePiece, Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
+ public Object buildComponent(PieceWeight villagePiece, Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
return ComponentJewelry.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
diff --git a/src/main/resources/assets/jewelrycraft/Changelog.txt b/resources/assets/jewelrycraft/Changelog.txt
index b1af1e8..eef8146 100644
--- a/src/main/resources/assets/jewelrycraft/Changelog.txt
+++ b/resources/assets/jewelrycraft/Changelog.txt
@@ -1,22 +1,20 @@
-- Added the Shadow Block
-- Added a enchanting/disenchanting/enchantments transfering ring made out of a Netherstar as jewel and book as modifier
-- Added a creative tab that generates all the possible ingot+jewel+modifier combinations
-- Fixed(?) bug with knightmetal ingots from Twilight Forest not being detected as ingots
-- Fixed weird empty spaces generated by Jewelries in villages
-- Added crystals
-- Reworked the coloring system, thus fixed some rings not having proper colors
-- Fixed(?) the entity holding ring storing entities that don't extend EntityLivingBase
-- Added generation of ingots in the Jewelry village house
-- Added 4 new possible jewels: Redstone, Redstone Block, Lapis and Lapis Block
-- Removed animation from the Shadow Ore
-- Made Shadow Ore more common
-- Balanced Villager trades
-- Fixed Displayer text rendering in front of everything
-- Added the Jewel Altar
-- Added a guide
+Both 1.6.4 and 1.7.10
+- Fixed bug with Natura causing the game to crash
+Only 1.7.10
+- Updated the mod to Minecraft 1.7.10
+- Added more config options regarding Jeweler house generation
+- Reduced the number of possible jewelers to spawn in a village to 1
+- Added Molten Metal and Molten Metal Buckets
+- Buckets of the molten metal can be obtained either by filling a smelter with the metal of your choice and then right clicking the smelter with an empty bucket,
+or by destroying the filled smelter, causing the metal to pour out and then use a bucket to pick it up.
+- Smelters now spawn molten metal, if they have any, when broken
+- Added the possibility to smelt ores
+- Smelted ores give double the amount of ingots
+- Jewelers houses now have a chance to also generate ores
+- Jewelers can sell ores now
+- Fixed a bug where the first time you would pour metal in a molder it would generate 2 items instead of one
TODO
-- Make it so you can smelt ores in the smelter
- Make a way so that the ingot affects the jewels somehow
- Add a ring of Resistance
- Think of a way to balance the rings
@@ -24,7 +22,7 @@ TODO
- Elemental jewellery -> punch a creature with it in your hand to do different things, lightning, fling into the air, set on fire,
encase in ice/fences/iron bars, turn into a sheep (like that spell from Warcraft 2, if anyone remembers that), blindness, extreme
knockback, charm (turns on your enemies), tame - tames any tamable mob
-- Add Necklaces, bracelets and earrings; Necklaces could have an AOE effect;
+!- Add Necklaces, bracelets and earrings; Necklaces could have an AOE effect;
- Shadow armor and tools
- Add an item that can store rings (maybe a keychain?)
- Monks Ring -> ups your unarmed damage / block breaking speed / ability to break harder blocks with bare hands, made with a block of iron and a jewel.
diff --git a/src/main/resources/assets/jewelrycraft/lang/en_US.lang b/resources/assets/jewelrycraft/lang/en_US.lang
index 0b2e294..41ce5a0 100644
--- a/src/main/resources/assets/jewelrycraft/lang/en_US.lang
+++ b/resources/assets/jewelrycraft/lang/en_US.lang
@@ -1,6 +1,7 @@
item.Jewelrycraft.thiefGloves.name=Thiefing Gloves
item.Jewelrycraft.ingotShadow.name=Shadow Ingot
-item.Jewelrycraft.ingot2.name=Ingot 2
+item.Jewelrycraft.ingot2.0.name=Testium Ingot
+item.Jewelrycraft.ingot2.1.name=Metallium Ingot
item.Jewelrycraft.ingot3.name=Ingot 3
item.Jewelrycraft.ingot4.name=Ingot 4
item.Jewelrycraft.ingot5.name=Ingot 5
@@ -16,7 +17,7 @@ item.Jewelrycraft.ring.name=Ring
item.Jewelrycraft.necklace.name=Necklace
item.Jewelrycraft.crystal.name=Crystal
item.Jewelrycraft.guide.name=Jewelrycraft Guide
-item.Jewelrycraft.bucket.name=[WIP]Bucket of Molten
+item.Jewelrycraft.bucket.name=Bucket of Molten
tile.Jewelrycraft.oreShadow.name=Shadow Ore
tile.Jewelrycraft.blockShadow.name=Shadow Block
tile.Jewelrycraft.glow.name=Glow
@@ -25,7 +26,7 @@ tile.Jewelrycraft.molder.name=Molder
tile.Jewelrycraft.displayer.name=Storage Displayer
tile.Jewelrycraft.jewelCraftingTable.name=Jeweler's Crafting Table
tile.Jewelrycraft.altar.name=Jewel Altar
-tile.Jewelrycraft.moltenMetal.name=[WIP] Molten
+tile.Jewelrycraft.moltenMetal.name=Molten
itemGroup.JewelryCraft=Jewelrycraft
itemGroup.Rings=Jewelrycraft Rings
itemGroup.Necklaces=Jewelrycraft Necklaces
diff --git a/src/main/resources/assets/jewelrycraft/pack.mcmeta b/resources/assets/jewelrycraft/pack.mcmeta
index 0b04ef8..0b04ef8 100644
--- a/src/main/resources/assets/jewelrycraft/pack.mcmeta
+++ b/resources/assets/jewelrycraft/pack.mcmeta
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/altar_bottom.png b/resources/assets/jewelrycraft/textures/blocks/altar_bottom.png
index 7ca4c6a..7ca4c6a 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/altar_bottom.png
+++ b/resources/assets/jewelrycraft/textures/blocks/altar_bottom.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/altar_side.png b/resources/assets/jewelrycraft/textures/blocks/altar_side.png
index 3a69977..3a69977 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/altar_side.png
+++ b/resources/assets/jewelrycraft/textures/blocks/altar_side.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/altar_top.png b/resources/assets/jewelrycraft/textures/blocks/altar_top.png
index 39210c3..39210c3 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/altar_top.png
+++ b/resources/assets/jewelrycraft/textures/blocks/altar_top.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow0.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow0.png
index 0b5323d..0b5323d 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow0.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow0.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow1.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow1.png
index 16f9908..16f9908 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow1.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow1.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow10.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow10.png
index be70eb5..be70eb5 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow10.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow10.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow11.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow11.png
index 1684d9a..1684d9a 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow11.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow11.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow12.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow12.png
index ed4ea49..ed4ea49 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow12.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow12.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow13.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow13.png
index 9b2100a..9b2100a 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow13.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow13.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow14.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow14.png
index ea00725..ea00725 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow14.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow14.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow15.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow15.png
index 2140624..2140624 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow15.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow15.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow2.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow2.png
index f95b111..f95b111 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow2.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow2.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow3.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow3.png
index 0dd5633..0dd5633 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow3.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow3.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow4.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow4.png
index a4e926c..a4e926c 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow4.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow4.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow5.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow5.png
index 8461ac4..8461ac4 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow5.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow5.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow6.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow6.png
index 352d3e4..352d3e4 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow6.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow6.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow7.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow7.png
index 9aa0e03..9aa0e03 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow7.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow7.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow8.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow8.png
index ad21447..ad21447 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow8.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow8.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow9.png b/resources/assets/jewelrycraft/textures/blocks/blockShadow9.png
index 01c0fa4..01c0fa4 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/blockShadow9.png
+++ b/resources/assets/jewelrycraft/textures/blocks/blockShadow9.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/displayer.png b/resources/assets/jewelrycraft/textures/blocks/displayer.png
index 155fa53..155fa53 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/displayer.png
+++ b/resources/assets/jewelrycraft/textures/blocks/displayer.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/jewelrsCraftingTable.png b/resources/assets/jewelrycraft/textures/blocks/jewelrsCraftingTable.png
index e826bbe..e826bbe 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/jewelrsCraftingTable.png
+++ b/resources/assets/jewelrycraft/textures/blocks/jewelrsCraftingTable.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/molder.png b/resources/assets/jewelrycraft/textures/blocks/molder.png
index 5a08164..5a08164 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/molder.png
+++ b/resources/assets/jewelrycraft/textures/blocks/molder.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png b/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png
index 8e9a452..8e9a452 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png
+++ b/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png.mcmeta b/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png.mcmeta
index 8e55e43..8e55e43 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png.mcmeta
+++ b/resources/assets/jewelrycraft/textures/blocks/moltenMetalFlow.png.mcmeta
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png b/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png
index 1eff844..1eff844 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png
+++ b/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png.mcmeta b/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png.mcmeta
index 7ceb363..7ceb363 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png.mcmeta
+++ b/resources/assets/jewelrycraft/textures/blocks/moltenMetalStill.png.mcmeta
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/oreShadow.png b/resources/assets/jewelrycraft/textures/blocks/oreShadow.png
index ffc48dc..ffc48dc 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/oreShadow.png
+++ b/resources/assets/jewelrycraft/textures/blocks/oreShadow.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/blocks/smelter.png b/resources/assets/jewelrycraft/textures/blocks/smelter.png
index 4da0c0a..4da0c0a 100644
--- a/src/main/resources/assets/jewelrycraft/textures/blocks/smelter.png
+++ b/resources/assets/jewelrycraft/textures/blocks/smelter.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/entities/jeweler.png b/resources/assets/jewelrycraft/textures/entities/jeweler.png
index fbd01cb..fbd01cb 100644
--- a/src/main/resources/assets/jewelrycraft/textures/entities/jeweler.png
+++ b/resources/assets/jewelrycraft/textures/entities/jeweler.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/gui/chest_ring.png b/resources/assets/jewelrycraft/textures/gui/chest_ring.png
index 66f00cc..66f00cc 100644
--- a/src/main/resources/assets/jewelrycraft/textures/gui/chest_ring.png
+++ b/resources/assets/jewelrycraft/textures/gui/chest_ring.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/gui/guidePage.png b/resources/assets/jewelrycraft/textures/gui/guidePage.png
index c74dab2..c74dab2 100644
--- a/src/main/resources/assets/jewelrycraft/textures/gui/guidePage.png
+++ b/resources/assets/jewelrycraft/textures/gui/guidePage.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/gui/guidePageFlip.png b/resources/assets/jewelrycraft/textures/gui/guidePageFlip.png
index 0746861..0746861 100644
--- a/src/main/resources/assets/jewelrycraft/textures/gui/guidePageFlip.png
+++ b/resources/assets/jewelrycraft/textures/gui/guidePageFlip.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/bucketOverlay.png b/resources/assets/jewelrycraft/textures/items/bucketOverlay.png
index fc2e2a9..fc2e2a9 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/bucketOverlay.png
+++ b/resources/assets/jewelrycraft/textures/items/bucketOverlay.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/clayIngotMold.png b/resources/assets/jewelrycraft/textures/items/clayIngotMold.png
index 0fecb22..0fecb22 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/clayIngotMold.png
+++ b/resources/assets/jewelrycraft/textures/items/clayIngotMold.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/clayNecklaceMold.png b/resources/assets/jewelrycraft/textures/items/clayNecklaceMold.png
index 455f094..455f094 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/clayNecklaceMold.png
+++ b/resources/assets/jewelrycraft/textures/items/clayNecklaceMold.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/clayRingMold.png b/resources/assets/jewelrycraft/textures/items/clayRingMold.png
index 49d2ab1..49d2ab1 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/clayRingMold.png
+++ b/resources/assets/jewelrycraft/textures/items/clayRingMold.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/crystal.png b/resources/assets/jewelrycraft/textures/items/crystal.png
index 563a41f..563a41f 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/crystal.png
+++ b/resources/assets/jewelrycraft/textures/items/crystal.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/crystalOverlay.png b/resources/assets/jewelrycraft/textures/items/crystalOverlay.png
index d17e909..d17e909 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/crystalOverlay.png
+++ b/resources/assets/jewelrycraft/textures/items/crystalOverlay.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/guide.png b/resources/assets/jewelrycraft/textures/items/guide.png
index 39c7f2c..39c7f2c 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/guide.png
+++ b/resources/assets/jewelrycraft/textures/items/guide.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/ingot3.png b/resources/assets/jewelrycraft/textures/items/ingot3.png
index 47c9cb8..47c9cb8 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/ingot3.png
+++ b/resources/assets/jewelrycraft/textures/items/ingot3.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/ingot4.png b/resources/assets/jewelrycraft/textures/items/ingot4.png
index 78894d0..78894d0 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/ingot4.png
+++ b/resources/assets/jewelrycraft/textures/items/ingot4.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/ingot6.png b/resources/assets/jewelrycraft/textures/items/ingot6.png
index e025782..e025782 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/ingot6.png
+++ b/resources/assets/jewelrycraft/textures/items/ingot6.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/ingot7.png b/resources/assets/jewelrycraft/textures/items/ingot7.png
index b378e29..b378e29 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/ingot7.png
+++ b/resources/assets/jewelrycraft/textures/items/ingot7.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/ingotMold.png b/resources/assets/jewelrycraft/textures/items/ingotMold.png
index 0575de5..0575de5 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/ingotMold.png
+++ b/resources/assets/jewelrycraft/textures/items/ingotMold.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/ingotShadow.png b/resources/assets/jewelrycraft/textures/items/ingotShadow.png
index e3b3aed..e3b3aed 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/ingotShadow.png
+++ b/resources/assets/jewelrycraft/textures/items/ingotShadow.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/jewelNecklace.png b/resources/assets/jewelrycraft/textures/items/jewelNecklace.png
index 41244d4..41244d4 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/jewelNecklace.png
+++ b/resources/assets/jewelrycraft/textures/items/jewelNecklace.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/jewelRing.png b/resources/assets/jewelrycraft/textures/items/jewelRing.png
index 4875772..4875772 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/jewelRing.png
+++ b/resources/assets/jewelrycraft/textures/items/jewelRing.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png b/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png
index 1eff844..1eff844 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png
+++ b/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta b/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta
index 7ceb363..7ceb363 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta
+++ b/resources/assets/jewelrycraft/textures/items/moltenMetalStill.png.mcmeta
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/necklace.png b/resources/assets/jewelrycraft/textures/items/necklace.png
index 054744d..054744d 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/necklace.png
+++ b/resources/assets/jewelrycraft/textures/items/necklace.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/necklaceMold.png b/resources/assets/jewelrycraft/textures/items/necklaceMold.png
index 0df4b65..0df4b65 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/necklaceMold.png
+++ b/resources/assets/jewelrycraft/textures/items/necklaceMold.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/ring.png b/resources/assets/jewelrycraft/textures/items/ring.png
index ae59f5a..ae59f5a 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/ring.png
+++ b/resources/assets/jewelrycraft/textures/items/ring.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/ringMold.png b/resources/assets/jewelrycraft/textures/items/ringMold.png
index 7bab639..7bab639 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/ringMold.png
+++ b/resources/assets/jewelrycraft/textures/items/ringMold.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/test/ingot2.png b/resources/assets/jewelrycraft/textures/items/test/ingot2.png
index 8bd47da..8bd47da 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/test/ingot2.png
+++ b/resources/assets/jewelrycraft/textures/items/test/ingot2.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/test/ingot5.png b/resources/assets/jewelrycraft/textures/items/test/ingot5.png
index 968b53d..968b53d 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/test/ingot5.png
+++ b/resources/assets/jewelrycraft/textures/items/test/ingot5.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/items/thiefGloves.png b/resources/assets/jewelrycraft/textures/items/thiefGloves.png
index b56e925..b56e925 100644
--- a/src/main/resources/assets/jewelrycraft/textures/items/thiefGloves.png
+++ b/resources/assets/jewelrycraft/textures/items/thiefGloves.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/tileentities/Displayer.png b/resources/assets/jewelrycraft/textures/tileentities/Displayer.png
index 200637b..200637b 100644
--- a/src/main/resources/assets/jewelrycraft/textures/tileentities/Displayer.png
+++ b/resources/assets/jewelrycraft/textures/tileentities/Displayer.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/tileentities/JewelrsCraftingBench.png b/resources/assets/jewelrycraft/textures/tileentities/JewelrsCraftingBench.png
index 1ee75d0..1ee75d0 100644
--- a/src/main/resources/assets/jewelrycraft/textures/tileentities/JewelrsCraftingBench.png
+++ b/resources/assets/jewelrycraft/textures/tileentities/JewelrsCraftingBench.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/tileentities/Molder.png b/resources/assets/jewelrycraft/textures/tileentities/Molder.png
index c5acc88..c5acc88 100644
--- a/src/main/resources/assets/jewelrycraft/textures/tileentities/Molder.png
+++ b/resources/assets/jewelrycraft/textures/tileentities/Molder.png
Binary files differ
diff --git a/src/main/resources/assets/jewelrycraft/textures/tileentities/Smelter.png b/resources/assets/jewelrycraft/textures/tileentities/Smelter.png
index 6ec3595..6ec3595 100644
--- a/src/main/resources/assets/jewelrycraft/textures/tileentities/Smelter.png
+++ b/resources/assets/jewelrycraft/textures/tileentities/Smelter.png
Binary files differ
diff --git a/resources/mcmod.info b/resources/mcmod.info
new file mode 100644
index 0000000..f480667
--- /dev/null
+++ b/resources/mcmod.info
@@ -0,0 +1,16 @@
+[
+{
+ "modid": "examplemod",
+ "name": "Example Mod",
+ "description": "Example placeholder mod.",
+ "version": "${version}",
+ "mcversion": "${mcversion}",
+ "url": "",
+ "updateUrl": "",
+ "authorList": ["ExampleDude"],
+ "credits": "The Forge and FML guys, for making this example",
+ "logoFile": "",
+ "screenshots": [],
+ "dependencies": []
+}
+]
diff --git a/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java b/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java
deleted file mode 100644
index e4329c8..0000000
--- a/src/main/java/darkknight/jewelrycraft/CreativeTabLiquids.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package darkknight.jewelrycraft;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import darkknight.jewelrycraft.item.ItemList;
-import darkknight.jewelrycraft.util.JewelryNBT;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.oredict.OreDictionary;
-
-public class CreativeTabLiquids extends CreativeTabs
-{
- public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
-
- public CreativeTabLiquids(String par2Str)
- {
- super(par2Str);
- metal.add(new ItemStack(Items.gold_ingot));
- metal.add(new ItemStack(Items.iron_ingot));
- }
-
- @Override
- public Item getTabIconItem()
- {
- return ItemList.bucket;
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public void displayAllReleventItems(List par1List)
- {
- int index = 0, index2 = 0;
- while(index < OreDictionary.getOreNames().length)
- {
- Iterator<ItemStack> i = OreDictionary.getOres(OreDictionary.getOreNames()[index]).iterator();
-
- while (i.hasNext())
- {
- ItemStack nextStack = i.next();
-
- if ((nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || nextStack.getItem().getUnlocalizedName().toLowerCase().contains("alloy")) && !metal.contains(nextStack)) metal.add(nextStack);
- }
- index++;
- }
- for(int i = 0; i < metal.size(); i++) par1List.add(ItemList.bucket.getModifiedItemStack(metal.get(i)));
- }
-
-}
diff --git a/src/main/java/darkknight/jewelrycraft/CreativeTabNecklaces.java b/src/main/java/darkknight/jewelrycraft/CreativeTabNecklaces.java
deleted file mode 100644
index 524d31e..0000000
--- a/src/main/java/darkknight/jewelrycraft/CreativeTabNecklaces.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package darkknight.jewelrycraft;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import darkknight.jewelrycraft.item.ItemList;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.oredict.OreDictionary;
-
-public class CreativeTabNecklaces extends CreativeTabs
-{
- public static ArrayList<ItemStack> metal = new ArrayList<ItemStack>();
-
- public CreativeTabNecklaces(String par2Str)
- {
- super(par2Str);
- metal.add(new ItemStack(Items.gold_ingot));
- metal.add(new ItemStack(Items.iron_ingot));
- }
-
- @Override
- public Item getTabIconItem()
- {
- return ItemList.necklace;
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public void displayAllReleventItems(List par1List)
- {
- int index = 0, index2 = 0;
- while(index < OreDictionary.getOreNames().length)
- {
- Iterator<ItemStack> i = OreDictionary.getOres(OreDictionary.getOreNames()[index]).iterator();
-
- while (i.hasNext())
- {
- ItemStack nextStack = i.next();
-
- if ((nextStack.getItem().getUnlocalizedName().toLowerCase().contains("ingot") || nextStack.getItem().getUnlocalizedName().toLowerCase().contains("alloy")) && !metal.contains(nextStack)) metal.add(nextStack);
- }
- index++;
- }
- for(int i = 0; i < metal.size(); i++)
- for(int j = 0; j < JewelrycraftUtil.modifiers.size(); j++)
- for(int k = 0; k < JewelrycraftUtil.jewel.size(); k++)
- par1List.add(ItemList.necklace.getModifiedItemStack(metal.get(i), JewelrycraftUtil.modifiers.get(j), JewelrycraftUtil.jewel.get(k)));
- }
-
-}
diff --git a/src/main/java/darkknight/jewelrycraft/block/BlockList.java b/src/main/java/darkknight/jewelrycraft/block/BlockList.java
deleted file mode 100644
index 60d4b96..0000000
--- a/src/main/java/darkknight/jewelrycraft/block/BlockList.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package darkknight.jewelrycraft.block;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-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;
-import darkknight.jewelrycraft.tileentity.TileEntityAltar;
-import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow;
-import darkknight.jewelrycraft.tileentity.TileEntityDisplayer;
-import darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
-import darkknight.jewelrycraft.tileentity.TileEntityMolder;
-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;
- 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/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
deleted file mode 100644
index 4ba57de..0000000
--- a/src/main/java/darkknight/jewelrycraft/block/BlockMoltenMetal.java
+++ /dev/null
@@ -1,275 +0,0 @@
-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;
-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.JewelrycraftMod;
-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);
- setLightLevel(15f);
- }
-
- @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);
- }
-
- @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, false, null);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return 0;
- }
-
- @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);
- 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)
- {
- 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(!isColorPretty(red, green, blue))
- {
- 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;
- }
-
- public static boolean isColorPretty(int r, int g, int b)
- {
- if((r > 80 || g > 80 || b > 80) || (r > 80 && g > 80 && b > 80 && r < 230 && b < 230 && g < 230)) return true;
- else return false;
- }
-
- 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
deleted file mode 100644
index c88798b..0000000
--- a/src/main/java/darkknight/jewelrycraft/block/BlockSmelter.java
+++ /dev/null
@@ -1,189 +0,0 @@
-package darkknight.jewelrycraft.block;
-
-import java.util.Random;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockContainer;
-import net.minecraft.block.material.Material;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.ChatComponentText;
-import net.minecraft.util.MathHelper;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-import darkknight.jewelrycraft.config.ConfigHandler;
-import darkknight.jewelrycraft.tileentity.TileEntityMolder;
-import darkknight.jewelrycraft.tileentity.TileEntitySmelter;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-
-public class BlockSmelter extends BlockContainer
-{
- Random rand = new Random();
-
- protected BlockSmelter(Material par2Material)
- {
- super(par2Material);
- }
-
- @Override
- public TileEntity createNewTileEntity(World world, int var2)
- {
- return new TileEntitySmelter();
- }
-
- @Override
- public boolean renderAsNormalBlock()
- {
- return false;
- }
-
- public void dropItem(World world, double x, double y, double z, ItemStack stack)
- {
- EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 1.3D, z + 0.5D, stack);
- entityitem.motionX = 0;
- entityitem.motionZ = 0;
- entityitem.motionY = 0.11000000298023224D;
- world.spawnEntityInWorld(entityitem);
- }
-
- public void breakBlock(World world, int i, int j, int k, Block par5, int par6)
- {
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
- if (te != null && te.hasMetal){
- dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy());
- world.removeTileEntity(i, j, k);
- }
- super.breakBlock(world, i, j, k, par5, par6);
- }
-
- @Override
- public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
- {
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
- ItemStack item = entityPlayer.inventory.getCurrentItem();
- if (te != null && !world.isRemote)
- {
- 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 && !te.pouring && item != null && (item.getUnlocalizedName().toLowerCase().contains("ingot") || item.getUnlocalizedName().toLowerCase().contains("alloy") || index != -1) && !item.getUnlocalizedName().toLowerCase().contains("mold"))
- {
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.nowsmeltingingot", item.getDisplayName())));
- te.metal = item.copy();
- te.metal.stackSize = 1;
- te.hasMetal = true;
- te.melting = ConfigHandler.ingotMeltingTime;
- if (!entityPlayer.capabilities.isCreativeMode) --item.stackSize;
- te.isDirty = true;
- }
- else if (te.hasMetal && !te.hasMoltenMetal && item != null && item.getDisplayName().contains("Ingot") && !item.getDisplayName().contains("Mold"))
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.alreadyhasingot", te.metal.getDisplayName())));
- else if (te.hasMoltenMetal)
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.hasmolteningot", te.moltenMetal.getDisplayName())));
- else if (item != null && !item.getUnlocalizedName().toLowerCase().contains("ingot") && item.getDisplayName().contains("Ingot"))
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.itemrenamedtoingot")));
- else if (item != null && (!item.getUnlocalizedName().toLowerCase().contains("ingot") || item.getUnlocalizedName().toLowerCase().contains("mold")))
- entityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.itemneedstobeingot")));
-
- if (te.hasMetal && entityPlayer.isSneaking())
- {
- dropItem(world, (double)te.xCoord, (double)te.yCoord, (double)te.zCoord, te.metal.copy());
- te.hasMetal = false;
- te.melting = -1;
- world.markBlockForUpdate(i, j, k);
- world.setTileEntity(i, j, k, te);
- }
- if(te != null) world.setTileEntity(i, j, k, te);
- }
- return true;
- }
-
- @Override
- public void onBlockClicked(World world, int i, int j, int k, EntityPlayer player)
- {
- TileEntitySmelter te = (TileEntitySmelter) world.getTileEntity(i, j, k);
- TileEntityMolder me = null;
- if (world.getBlockMetadata(i, j, k) == 0 && world.getTileEntity(i, j, k - 1) != null && world.getTileEntity(i, j, k - 1) instanceof TileEntityMolder)
- me = (TileEntityMolder) world.getTileEntity(i, j, k - 1);
- else if (world.getBlockMetadata(i, j, k) == 1 && world.getTileEntity(i + 1, j, k) != null && world.getTileEntity(i + 1, j, k) instanceof TileEntityMolder)
- me = (TileEntityMolder) world.getTileEntity(i + 1, j, k);
- else if (world.getBlockMetadata(i, j, k) == 2 && world.getTileEntity(i, j, k + 1) != null && world.getTileEntity(i, j, k + 1) instanceof TileEntityMolder)
- me = (TileEntityMolder) world.getTileEntity(i, j, k + 1);
- else if (world.getBlockMetadata(i, j, k) == 3 && world.getTileEntity(i - 1, j, k) != null && world.getTileEntity(i - 1, j, k) instanceof TileEntityMolder)
- me = (TileEntityMolder) world.getTileEntity(i - 1, j, k);
-
- if (te != null && me != null && !world.isRemote)
- {
- if (te.hasMoltenMetal && isConnectedToMolder(world, i, j, k) && me != null && me.hasMold && !me.hasMoltenMetal && !me.hasJewelBase)
- {
- te.pouring = true;
- te.isDirty = true;
- world.markBlockForUpdate(i, j, k);
- world.setTileEntity(i, j, k, te);
- }
- else if (te.hasMetal && te.melting > 0)
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("chatmessage.Jewelrycraft.smelter.metalismelting", te.metal.getDisplayName()) + " (" + ((ConfigHandler.ingotMeltingTime - te.melting)*100/ConfigHandler.ingotMeltingTime) + "%)"));
- else if (te.hasMoltenMetal && !isConnectedToMolder(world, i, j, k))
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderismissing")));
- else if (!me.hasMold && te.hasMoltenMetal)
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasnomold")));
- else if (me.hasMoltenMetal && te.hasMoltenMetal)
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.molderhasmoltenmetal")));
- else if (me.hasJewelBase && te.hasMoltenMetal)
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.modlerhasitem")));
- else
- player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("chatmessage.Jewelrycraft.smelter.empty")));
- }
-
- }
-
- public boolean isConnectedToMolder(World world, int i, int j, int k)
- {
- int blockMeta = world.getBlockMetadata(i, j, k);
- if (blockMeta == 0 && world.getBlock(i, j, k - 1) instanceof BlockMolder)
- return true;
- else if (blockMeta == 1 && world.getBlock(i + 1, j, k) instanceof BlockMolder)
- return true;
- else if (blockMeta == 2 && world.getBlock(i, j, k + 1) instanceof BlockMolder)
- return true;
- else if (blockMeta == 3 && world.getBlock(i - 1, j, k) instanceof BlockMolder)
- return true;
- return false;
- }
-
- @Override
- public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack par6ItemStack)
- {
- int rotation = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
- world.setBlockMetadataWithNotify(i, j, k, rotation, 2);
- }
-
- @Override
- public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
- {
- return false;
- }
-
- @Override
- public boolean isOpaqueCube()
- {
- return false;
- }
-
- @Override
- public int getRenderType()
- {
- return -1;
- }
-
- public void registerBlockIcons(IIconRegister icon)
- {
- this.blockIcon = icon.registerIcon("jewelrycraft:smelter");
- }
-
-}
diff --git a/src/main/java/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java b/src/main/java/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java
deleted file mode 100644
index 1085f7d..0000000
--- a/src/main/java/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package darkknight.jewelrycraft.container;
-
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-
-import org.lwjgl.opengl.GL11;
-
-import darkknight.jewelrycraft.client.GuiGuide;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-
-public class GuiTabJewelsAndModifiers extends GuiTab
-{
- public GuiTabJewelsAndModifiers(int id)
- {
- super("Jewels and modifiers", id);
- }
-
- public ItemStack getIcon()
- {
- return new ItemStack(Items.emerald);
- }
-
- @Override
- public void drawBackground(GuiGuide gui, int x, int y, int page)
- {
- int xPos = (page%2==0)?107:-35;
- switch(page)
- {
- case 1:
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Jewels", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- for(int i = 0; i <= 8; i++){
- gui.renderItem(JewelrycraftUtil.jewel.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f);
- gui.getFont().drawString(JewelrycraftUtil.jewel.get(i).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0);
- }
- break;
- case 2:
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Jewels", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- for(int i = 0; i <= 8; i++){
- gui.renderItem(JewelrycraftUtil.jewel.get(i+9), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f);
- gui.getFont().drawString(JewelrycraftUtil.jewel.get(i+9).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0);
- }
- break;
- case 3:
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Jewels", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- for(int i = 0; i <= 8; i++)
- if(i+18 < JewelrycraftUtil.jewel.size()){
- gui.renderItem(JewelrycraftUtil.jewel.get(i+18), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f);
- gui.getFont().drawString(JewelrycraftUtil.jewel.get(i+18).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- break;
- case 4:
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Modifiers", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- for(int i = 0; i <= 8; i++){
- if(i < JewelrycraftUtil.modifiers.size())
- {
- gui.renderItem(JewelrycraftUtil.modifiers.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f);
- gui.getFont().drawString(JewelrycraftUtil.modifiers.get(i).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0);
- }
- }
- break;
- case 5:
- gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Modifiers", gui.getLeft() + xPos + 40, gui.getTop(), 0);
- for(int i = 0; i <= 8; i++){
- if(i+9 < JewelrycraftUtil.modifiers.size()){
- gui.renderItem(JewelrycraftUtil.modifiers.get(i + 9), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f);
- gui.getFont().drawString(JewelrycraftUtil.modifiers.get(i + 9).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- }
- break;
- default:;
- }
- }
-
- public int getMaxPages()
- {
- return 5;
- }
-
- @Override
- public void drawForeground(GuiGuide gui, int x, int y, int page)
- {
- }
-
-}
diff --git a/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java b/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java
deleted file mode 100644
index cf16847..0000000
--- a/src/main/java/darkknight/jewelrycraft/events/BucketHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
- *
- * BuildCraft is distributed under the terms of the Minecraft Mod Public License
- * 1.0, or MMPL. Please check the contents of the license located in
- * http://www.mod-buildcraft.com/MMPL-1.0.txt
- */
-package darkknight.jewelrycraft.events;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.minecraft.block.Block;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.MovingObjectPosition;
-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 {
-
- public static BucketHandler INSTANCE = new BucketHandler();
- public Map<Block, Item> buckets = new HashMap<Block, Item>();
-
- private BucketHandler() {
- }
-
- @SubscribeEvent
- public void onBucketFill(FillBucketEvent event) {
-
- ItemStack result = fillCustomBucket(event.world, event.target);
-
- if (result == null)
- return;
-
- event.result = result;
- event.setResult(Result.ALLOW);
- }
-
-
- private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) {
-
- Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
-
- Item bucket = buckets.get(block);
- if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) {
- world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
- 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;
-
- }
-} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java b/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java
deleted file mode 100644
index 42dc5a7..0000000
--- a/src/main/java/darkknight/jewelrycraft/events/EntityEventHandler.java
+++ /dev/null
@@ -1,100 +0,0 @@
-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.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;
-
-/**
- * Code taken from OpenBlocks
- */
-
-public class EntityEventHandler
-{
- 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 (!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)
- {
- if(!event.world.isRemote)
- {
- new File(JewelrycraftMod.dir + File.separator + "Jewelrycraft").mkdirs();
- JewelrycraftMod.liquidsConf = new File(JewelrycraftMod.dir + File.separator + "Jewelrycraft", "JLP" + event.world.getWorldInfo().getWorldName() + ".cfg");
- try {
- 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
deleted file mode 100644
index 019deab..0000000
--- a/src/main/java/darkknight/jewelrycraft/events/EventHandler.java
+++ /dev/null
@@ -1,65 +0,0 @@
-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/ItemMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java
deleted file mode 100644
index 81c1614..0000000
--- a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetal.java
+++ /dev/null
@@ -1,128 +0,0 @@
-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(!isColorPretty(red, green, blue))
- {
- 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;
- }
-
- public static boolean isColorPretty(int r, int g, int b)
- {
- if((r > 80 || g > 80 || b > 80) || (r > 80 && g > 80 && b > 80 && r < 230 && b < 230 && g < 230)) return true;
- else return false;
- }
-}
diff --git a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java b/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
deleted file mode 100644
index bd1ea72..0000000
--- a/src/main/java/darkknight/jewelrycraft/item/ItemMoltenMetalBucket.java
+++ /dev/null
@@ -1,309 +0,0 @@
-package darkknight.jewelrycraft.item;
-
-import java.awt.image.BufferedImage;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-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.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.CompressedStreamTools;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.IIcon;
-import net.minecraft.util.MovingObjectPosition;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.World;
-import net.minecraft.world.storage.WorldInfo;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.event.entity.player.FillBucketEvent;
-import cpw.mods.fml.common.eventhandler.Event;
-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;
-
-public class ItemMoltenMetalBucket extends Item
-{
- public IIcon liquid;
- public ItemMoltenMetalBucket()
- {
- this.maxStackSize = 1;
- }
-
- /**
- * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
- */
- public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer)
- {
- boolean flag = BlockList.moltenMetal == Blocks.air;
- MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, flag);
-
- if (movingobjectposition == null)
- {
- return stack;
- }
- else
- {
- FillBucketEvent event = new FillBucketEvent(par3EntityPlayer, stack, par2World, movingobjectposition);
- if (MinecraftForge.EVENT_BUS.post(event))
- {
- return stack;
- }
-
- if (event.getResult() == Event.Result.ALLOW)
- {
- if (par3EntityPlayer.capabilities.isCreativeMode)
- {
- return stack;
- }
-
- if (--stack.stackSize <= 0)
- {
- return event.result;
- }
-
- if (!par3EntityPlayer.inventory.addItemStackToInventory(event.result))
- {
- par3EntityPlayer.dropPlayerItemWithRandomChoice(event.result, false);
- }
-
- return stack;
- }
- if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
- {
- int i = movingobjectposition.blockX;
- int j = movingobjectposition.blockY;
- int k = movingobjectposition.blockZ;
-
- if (!par2World.canMineBlock(par3EntityPlayer, i, j, k))
- {
- return stack;
- }
-
- if (flag)
- {
- if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack))
- {
- return stack;
- }
-
- Material material = par2World.getBlock(i, j, k).getMaterial();
- int l = par2World.getBlockMetadata(i, j, k);
- par2World.setBlockToAir(i, j, k);
- return this.func_150910_a(stack, par3EntityPlayer, ItemList.bucket);
- }
- else
- {
- if (BlockList.moltenMetal == Blocks.air)
- {
- return new ItemStack(Items.bucket);
- }
-
- if (movingobjectposition.sideHit == 0)
- {
- --j;
- }
-
- if (movingobjectposition.sideHit == 1)
- {
- ++j;
- }
-
- if (movingobjectposition.sideHit == 2)
- {
- --k;
- }
-
- if (movingobjectposition.sideHit == 3)
- {
- ++k;
- }
-
- if (movingobjectposition.sideHit == 4)
- {
- --i;
- }
-
- if (movingobjectposition.sideHit == 5)
- {
- ++i;
- }
-
- if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, stack))
- {
- return stack;
- }
-
- try {
- if (this.tryPlaceContainedLiquid(par2World, i, j, k, stack) && !par3EntityPlayer.capabilities.isCreativeMode)
- {
- return new ItemStack(Items.bucket);
- }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- return stack;
- }
- }
-
- private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_)
- {
- if (p_150910_2_.capabilities.isCreativeMode)
- {
- return p_150910_1_;
- }
- else if (--p_150910_1_.stackSize <= 0)
- {
- return new ItemStack(p_150910_3_);
- }
- else
- {
- if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_)))
- {
- p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false);
- }
-
- return p_150910_1_;
- }
- }
-
- /**
- * Attempts to place the liquid contained inside the bucket.
- * @throws IOException
- */
- public boolean tryPlaceContainedLiquid(World par1World, int par2, int par3, int par4, ItemStack stack) throws IOException
- {
- if (BlockList.moltenMetal == Blocks.air)
- {
- return false;
- }
- else
- {
- Material material = par1World.getBlock(par2, par3, par4).getMaterial();
- boolean flag = !material.isSolid();
-
- if (!par1World.isAirBlock(par2, par3, par4) && !flag) return false;
- else
- {
- if (!par1World.isRemote && flag && !material.isLiquid()) par1World.func_147480_a(par2, par3, par4, true);
-
- 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;
- }
- }
- }
-
- public void registerIcons(IIconRegister iconRegister)
- {
- itemIcon = iconRegister.registerIcon("bucket_empty");
- liquid = iconRegister.registerIcon("jewelrycraft:bucketOverlay");
- }
-
- @SideOnly(Side.CLIENT)
- public int getColorFromItemStack(ItemStack stack, int pass)
- {
- try
- {
- return color(stack, pass);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- return 16777215;
- }
-
- @Override
- public boolean requiresMultipleRenderPasses()
- {
- return true;
- }
-
- public IIcon getIcon(ItemStack stack, int pass)
- {
- if(pass == 0) return itemIcon;
- if(pass == 1) return liquid;
- return itemIcon;
- }
-
- 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 (pass == 1 && JewelryNBT.ingot(stack) != null && 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(!isColorPretty(red, green, blue))
- {
- 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 && pass == 1) return JewelryNBT.ingotColor(stack);
- return 16777215;
- }
-
- public static boolean isColorPretty(int r, int g, int b)
- {
- if((r > 80 || g > 80 || b > 80) || (r > 80 && g > 80 && b > 80 && r < 230 && b < 230 && g < 230)) return true;
- else return false;
- }
-
- public ItemStack getModifiedItemStack(ItemStack ingot)
- {
- ItemStack itemstack = new ItemStack(this);
- JewelryNBT.addMetal(itemstack, ingot);
- return itemstack;
- }
-
- public String getItemStackDisplayName(ItemStack stack)
- {
- if(JewelryNBT.ingot(stack) != null) return (StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim() + " " + JewelryNBT.ingot(stack).getDisplayName().replace("Ingot", " ").trim() ;
- return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim() + " Metal";
- }
-}
diff --git a/src/main/java/darkknight/jewelrycraft/lib/Reference.java b/src/main/java/darkknight/jewelrycraft/lib/Reference.java
deleted file mode 100644
index ba22205..0000000
--- a/src/main/java/darkknight/jewelrycraft/lib/Reference.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package darkknight.jewelrycraft.lib;
-
-public class Reference
-{
- public static final String MODID = "Jewelrycraft";
- public static final String MODNAME = "Jewelrycraft";
- public static final String VERSION = "1.4";
- public static final String PACKET_CHANNEL = "Jewelrycraft";
-}
diff --git a/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java b/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java
deleted file mode 100644
index 1cc3f72..0000000
--- a/src/main/java/darkknight/jewelrycraft/model/ModelJewlersCraftingBench.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package darkknight.jewelrycraft.model;
-
-import net.minecraft.client.model.ModelBase;
-import net.minecraft.client.model.ModelRenderer;
-import net.minecraft.entity.Entity;
-
-public class ModelJewlersCraftingBench extends ModelBase
-{
- //fields
- ModelRenderer Leg1;
- ModelRenderer Leg2;
- ModelRenderer Leg3;
- ModelRenderer Leg4;
- ModelRenderer Top;
- ModelRenderer Support1;
- ModelRenderer Support2;
- ModelRenderer Support3;
- ModelRenderer Support4;
- ModelRenderer Support5;
- ModelRenderer Support6;
- ModelRenderer Support7;
- ModelRenderer Support8;
-
- public ModelJewlersCraftingBench()
- {
- textureWidth = 64;
- textureHeight = 32;
-
- Leg1 = new ModelRenderer(this, 0, 0);
- Leg1.addBox(0F, 0F, 0F, 2, 10, 2);
- Leg1.setRotationPoint(-6F, 14F, 4F);
- Leg1.setTextureSize(64, 32);
- Leg1.mirror = true;
- setRotation(Leg1, 0F, 0F, 0F);
- Leg2 = new ModelRenderer(this, 0, 0);
- Leg2.addBox(0F, 0F, 0F, 2, 10, 2);
- Leg2.setRotationPoint(-6F, 14F, -6F);
- Leg2.setTextureSize(64, 32);
- Leg2.mirror = true;
- setRotation(Leg2, 0F, 0F, 0F);
- Leg3 = new ModelRenderer(this, 0, 0);
- Leg3.addBox(0F, 0F, 0F, 2, 10, 2);
- Leg3.setRotationPoint(4F, 14F, -6F);
- Leg3.setTextureSize(64, 32);
- Leg3.mirror = true;
- setRotation(Leg3, 0F, 0F, 0F);
- Leg4 = new ModelRenderer(this, 0, 0);
- Leg4.addBox(0F, 0F, 0F, 2, 10, 2);
- Leg4.setRotationPoint(4F, 14F, 4F);
- Leg4.setTextureSize(64, 32);
- Leg4.mirror = true;
- setRotation(Leg4, 0F, 0F, 0F);
- Top = new ModelRenderer(this, 0, 13);
- Top.addBox(0F, 0F, 0F, 16, 1, 16);
- Top.setRotationPoint(-8F, 13F, -8F);
- Top.setTextureSize(64, 32);
- Top.mirror = true;
- setRotation(Top, 0F, 0F, 0F);
- Support1 = new ModelRenderer(this, 0, 0);
- Support1.addBox(0F, 0F, 0F, 3, 1, 1);
- Support1.setRotationPoint(3F, 12F, 5F);
- Support1.setTextureSize(64, 32);
- Support1.mirror = true;
- setRotation(Support1, 0F, 0F, 0F);
- Support2 = new ModelRenderer(this, 0, 0);
- Support2.addBox(0F, 0F, 0F, 1, 1, 3);
- Support2.setRotationPoint(2F, 12F, 2F);
- Support2.setTextureSize(64, 32);
- Support2.mirror = true;
- setRotation(Support2, 0F, 0F, 0F);
- Support3 = new ModelRenderer(this, 0, 0);
- Support3.addBox(0F, 0F, 0F, 1, 1, 3);
- Support3.setRotationPoint(6F, 12F, 2F);
- Support3.setTextureSize(64, 32);
- Support3.mirror = true;
- setRotation(Support3, 0F, 0F, 0F);
- Support4 = new ModelRenderer(this, 0, 0);
- Support4.addBox(0F, 0F, 0F, 3, 1, 1);
- Support4.setRotationPoint(3F, 12F, 1F);
- Support4.setTextureSize(64, 32);
- Support4.mirror = true;
- setRotation(Support4, 0F, 0F, 0F);
- Support5 = new ModelRenderer(this, 0, 0);
- Support5.addBox(0F, 0F, 0F, 1, 1, 3);
- Support5.setRotationPoint(-3F, 12F, 2F);
- Support5.setTextureSize(64, 32);
- Support5.mirror = true;
- setRotation(Support5, 0F, 0F, 0F);
- Support6 = new ModelRenderer(this, 0, 0);
- Support6.addBox(0F, 0F, 0F, 3, 1, 1);
- Support6.setRotationPoint(-6F, 12F, 5F);
- Support6.setTextureSize(64, 32);
- Support6.mirror = true;
- setRotation(Support6, 0F, 0F, 0F);
- Support7 = new ModelRenderer(this, 0, 0);
- Support7.addBox(0F, 0F, 0F, 1, 1, 3);
- Support7.setRotationPoint(-7F, 12F, 2F);
- Support7.setTextureSize(64, 32);
- Support7.mirror = true;
- setRotation(Support7, 0F, 0F, 0F);
- Support8 = new ModelRenderer(this, 0, 0);
- Support8.addBox(0F, 0F, 0F, 3, 1, 1);
- Support8.setRotationPoint(-6F, 12F, 1F);
- Support8.setTextureSize(64, 32);
- Support8.mirror = true;
- setRotation(Support8, 0F, 0F, 0F);
- }
-
- public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
- {
- super.render(entity, f, f1, f2, f3, f4, f5);
- setRotationAngles(f, f1, f2, f3, f4, f5);
- Leg1.render(f5);
- Leg2.render(f5);
- Leg3.render(f5);
- Leg4.render(f5);
- Top.render(f5);
- Support1.render(f5);
- Support2.render(f5);
- Support3.render(f5);
- Support4.render(f5);
- Support5.render(f5);
- Support6.render(f5);
- Support7.render(f5);
- Support8.render(f5);
- }
-
- private void setRotation(ModelRenderer model, float x, float y, float z)
- {
- model.rotateAngleX = x;
- model.rotateAngleY = y;
- model.rotateAngleZ = z;
- }
-
- public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)
- {
- super.setRotationAngles(f, f1, f2, f3, f4, f5, null);
- }
-
-}
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
deleted file mode 100644
index 5f4be83..0000000
--- a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java
+++ /dev/null
@@ -1,159 +0,0 @@
-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;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.Packet;
-import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
-import net.minecraft.tileentity.TileEntity;
-
-public class TileEntitySmelter extends TileEntity
-{
- 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);
- }
-}