diff --git a/build.gradle b/build.gradle index acea60c1..d33b9d1b 100644 --- a/build.gradle +++ b/build.gradle @@ -65,10 +65,10 @@ configurations { dependencies { compile "mantle:Mantle:${config.minecraft_version}-${config.mantle_version}:deobf" - compile "codechicken:CodeChickenLib:${config.minecraft_version}-${config.CCLIB_version}:dev" - compile "codechicken:ForgeMultipart:${config.minecraft_version}-${config.FMP_version}:dev" - compile "codechicken:CodeChickenCore:${config.minecraft_version}-${config.ccc_version}:dev" - compile "codechicken:NotEnoughItems:${config.minecraft_version}-${config.NEI_version}:dev" + compile "codechicken:CodeChickenLib:${config.minecraft_version_old}-${config.CCLIB_version}:dev" + compile "codechicken:ForgeMultipart:${config.minecraft_version_old}-${config.FMP_version}:dev" + compile "codechicken:CodeChickenCore:${config.minecraft_version_old}-${config.ccc_version}:dev" + compile "codechicken:NotEnoughItems:${config.minecraft_version_old}-${config.NEI_version}:dev" compile "mcp.mobius.waila:Waila:${config.waila_version}:dev" deployerJars 'org.apache.maven.wagon:wagon-ssh:2.2' } diff --git a/build.properties b/build.properties index ef163b1f..9abbffbe 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,7 @@ -minecraft_version=1.7.2 -forge_version=10.12.1.1101 -mantle_version=145.3a637c2 +minecraft_version=1.7.10 +minecraft_version_old=1.7.2 +forge_version=10.13.0.1151 +mantle_version=152.e3820d9 FMP_version=1.1.0.268 CCLIB_version=1.1.0.77 NEI_version=1.0.1 diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index 379c4d23..fe7f4d14 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -255,6 +255,11 @@ item.tconstruct.Materials.SteelNugget.name=Steel Nugget item.tconstruct.Materials.PigIronIngot.name=Pig Iron Ingot item.tconstruct.Materials.PigIronNugget.name=Pig Iron Platter item.tconstruct.Materials.GlueBall.name=Ball of Glue +item.tconstruct.Materials.ArditeDust.name=Ardite Dust +item.tconstruct.Materials.CobaltDust.name=Cobalt Dust +item.tconstruct.Materials.AluminumDust.name=Aluminum Dust +item.tconstruct.Materials.ManyullynDust.name=Manyullyn Dust +item.tconstruct.Materials.AluBrassDust.name=Aluminum Brass Dust item.tconstruct.ArmorPattern.helmet.name=Helmet Cast item.tconstruct.ArmorPattern.chestplate.name=Chestplate Cast @@ -806,4 +811,4 @@ materialtraits.thaumic=Thaumic creativeModLock.tooltip=Target Lock: -attribute.generic.ammo.attackDamage=Average Shot Damage +attribute.name.ammo.attackDamage=Average Shot Damage diff --git a/resources/assets/tinker/lang/it_IT.lang b/resources/assets/tinker/lang/it_IT.lang index f8e48d6b..51163d82 100644 --- a/resources/assets/tinker/lang/it_IT.lang +++ b/resources/assets/tinker/lang/it_IT.lang @@ -257,6 +257,11 @@ item.tconstruct.Materials.SteelNugget.name=Pepita d'Acciaio item.tconstruct.Materials.PigIronIngot.name=Lingotto di Ferro Suino item.tconstruct.Materials.PigIronNugget.name=Piatto di Ferro Suino item.tconstruct.Materials.GlueBall.name=Palla di Colla +item.tconstruct.Materials.ArditeDust.name=Polvere di Ardite +item.tconstruct.Materials.CobaltDust.name=Polvere di Coblato +item.tconstruct.Materials.AluminumDust.name=Polvere di Alluminio +item.tconstruct.Materials.ManyullynDust.name=Polvere di Manyullyn +item.tconstruct.Materials.AluBrassDust.name=Polvere di Ottone item.tconstruct.helmetWood.name=Elmo di Legno item.tconstruct.chestplateWood.name=Corazza di Legno diff --git a/src/main/java/tconstruct/TConstruct.java b/src/main/java/tconstruct/TConstruct.java index 8a58224e..0137a693 100644 --- a/src/main/java/tconstruct/TConstruct.java +++ b/src/main/java/tconstruct/TConstruct.java @@ -66,18 +66,21 @@ public class TConstruct public static final int liquidUpdateAmount = 6; + // the entire mod + public static final String modID = "TConstruct"; + // Shared mod logger - public static final Logger logger = LogManager.getLogger("TConstruct"); + public static final Logger logger = LogManager.getLogger(modID); /* Instance of this mod, used for grabbing prototype fields */ - @Instance("TConstruct") + @Instance(modID) public static TConstruct instance; /* Proxies for sides, used for graphics processing */ @SidedProxy(clientSide = "tconstruct.client.TProxyClient", serverSide = "tconstruct.common.TProxyCommon") public static TProxyCommon proxy; // Module loader - public static final ModuleController moduleLoader = new ModuleController("TDynstruct.cfg", "TConstruct"); + public static final ModuleController moduleLoader = new ModuleController("TDynstruct.cfg", modID); // The packet pipeline public static final PacketPipeline packetPipeline = new PacketPipeline(); @@ -159,7 +162,7 @@ public class TConstruct packetPipeline.initalise(); if (event.getSide() == Side.CLIENT) { - MinecraftForge.EVENT_BUS.register(new EventCloakRender()); + //MinecraftForge.EVENT_BUS.register(new EventCloakRender()); } DimensionBlacklist.getBadBimensions(); diff --git a/src/main/java/tconstruct/armor/ArmorProxyClient.java b/src/main/java/tconstruct/armor/ArmorProxyClient.java index 9547a9cb..ef954f4d 100644 --- a/src/main/java/tconstruct/armor/ArmorProxyClient.java +++ b/src/main/java/tconstruct/armor/ArmorProxyClient.java @@ -153,7 +153,7 @@ public class ArmorProxyClient extends ArmorProxyCommon { updateCounter++; - ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight); int scaledWidth = scaledresolution.getScaledWidth(); int scaledHeight = scaledresolution.getScaledHeight(); int xBasePos = scaledWidth / 2 - 91; diff --git a/src/main/java/tconstruct/armor/blocks/DryingRack.java b/src/main/java/tconstruct/armor/blocks/DryingRack.java index e741903c..2b87307f 100644 --- a/src/main/java/tconstruct/armor/blocks/DryingRack.java +++ b/src/main/java/tconstruct/armor/blocks/DryingRack.java @@ -159,7 +159,7 @@ public class DryingRack extends InventoryBlock yMin = 0.75F; break; } - return AxisAlignedBB.getAABBPool().getAABB((double) x + xMin, (double) y + yMin, (double) z + zMin, (double) x + xMax, (double) y + yMax, (double) z + zMax); + return AxisAlignedBB.getBoundingBox((double) x + xMin, (double) y + yMin, (double) z + zMin, (double) x + xMax, (double) y + yMax, (double) z + zMax); } @Override @@ -296,7 +296,7 @@ public class DryingRack extends InventoryBlock /* * @Override public AxisAlignedBB getCollisionBoundingBoxFromPool (World * world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); - * if (meta != 1) { return AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + + * if (meta != 1) { return AxisAlignedBB.getBoundingBox(x, y, z, x + * 1, y + 1, z + 1); } else { FaucetLogic logic = (FaucetLogic) * world.getBlockTileEntity(x, y, z); if (logic != null) { float xMin = * 0.25F; float xMax = 0.75F; float zMin = 0.25F; float zMax = 0.75F; @@ -305,7 +305,7 @@ public class DryingRack extends InventoryBlock * break; case 3: zMax = 0.375F; zMin = 0F; break; case 4: xMin = 0.625F; * xMax = 1.0F; break; case 5: xMax = 0.375F; xMin = 0F; break; } * - * return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + xMin), + * return AxisAlignedBB.getBoundingBox((double) ((float) x + xMin), * (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x + * xMax), (double) y + 0.625, (double) ((float) z + zMax)); } } * diff --git a/src/main/java/tconstruct/blocks/logic/DryingRackLogic.java b/src/main/java/tconstruct/blocks/logic/DryingRackLogic.java index 64e5e934..cbfd9e44 100644 --- a/src/main/java/tconstruct/blocks/logic/DryingRackLogic.java +++ b/src/main/java/tconstruct/blocks/logic/DryingRackLogic.java @@ -122,7 +122,7 @@ public class DryingRackLogic extends InventoryLogic @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox () { - AxisAlignedBB cbb = AxisAlignedBB.getAABBPool().getAABB(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); + AxisAlignedBB cbb = AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1); return cbb; } diff --git a/src/main/java/tconstruct/blocks/traps/Landmine.java b/src/main/java/tconstruct/blocks/traps/Landmine.java index b39d43a3..ee5bf461 100644 --- a/src/main/java/tconstruct/blocks/traps/Landmine.java +++ b/src/main/java/tconstruct/blocks/traps/Landmine.java @@ -184,7 +184,7 @@ public class Landmine extends MantleBlock { var8 = world.getEntitiesWithinAABBExcludingEntity( (Entity) null, - AxisAlignedBB.getAABBPool().getAABB((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D, + AxisAlignedBB.getBoundingBox((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D, (double) ((float) (posZ + 1) - var7))); } @@ -192,14 +192,14 @@ public class Landmine extends MantleBlock { var8 = world.getEntitiesWithinAABB( EntityLiving.class, - AxisAlignedBB.getAABBPool().getAABB((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D, + AxisAlignedBB.getBoundingBox((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D, (double) ((float) (posZ + 1) - var7))); } /* * if (this.triggerMobType == EnumCreatureType.players) { var8 = * world.getEntitiesWithinAABB( EntityPlayer.class, - * AxisAlignedBB.getAABBPool().getAABB((double) ((float) posX + var7), + * AxisAlignedBB.getBoundingBox((double) ((float) posX + var7), * (double) posY, (double) ((float) posZ + var7), (double) ((float) * (posX + 1) - var7), (double) posY + 0.25D, (double) ((float) (posZ + * 1) - var7))); } diff --git a/src/main/java/tconstruct/client/event/EventCloakRender.java b/src/main/java/tconstruct/client/event/EventCloakRender.java index 4e0e1dc8..2507d365 100644 --- a/src/main/java/tconstruct/client/event/EventCloakRender.java +++ b/src/main/java/tconstruct/client/event/EventCloakRender.java @@ -62,9 +62,9 @@ public class EventCloakRender capePlayers.add(abstractClientPlayer); - abstractClientPlayer.getTextureCape().textureUploaded = false; - new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start(); - event.renderCape = true; + //abstractClientPlayer.getTextureCape().textureUploaded = false; + //new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start(); + //event.renderCape = true; } } } @@ -132,9 +132,9 @@ public class EventCloakRender try { Image cape = new ImageIcon(new URL(cloakURL)).getImage(); - BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB); - bo.getGraphics().drawImage(cape, 0, 0, null); - abstractClientPlayer.getTextureCape().setBufferedImage(bo); + //BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB); + //bo.getGraphics().drawImage(cape, 0, 0, null); + //abstractClientPlayer.getTextureCape().setBufferedImage(bo); } catch (MalformedURLException e) { diff --git a/src/main/java/tconstruct/common/TRecipes.java b/src/main/java/tconstruct/common/TRecipes.java new file mode 100644 index 00000000..218b5105 --- /dev/null +++ b/src/main/java/tconstruct/common/TRecipes.java @@ -0,0 +1,1659 @@ +package tconstruct.common; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; + +import mantle.blocks.abstracts.MultiServantLogic; +import mantle.utils.RecipeRemover; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDispenser; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.item.crafting.ShapedRecipes; +import net.minecraft.util.StatCollector; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import net.minecraftforge.oredict.ShapelessOreRecipe; +import tconstruct.TConstruct; +import tconstruct.armor.modifiers.AModDamageBoost; +import tconstruct.armor.modifiers.AModDoubleJump; +import tconstruct.armor.modifiers.AModHealthBoost; +import tconstruct.armor.modifiers.AModKnockbackResistance; +import tconstruct.armor.modifiers.AModMoveSpeed; +import tconstruct.armor.modifiers.AModProtection; +import tconstruct.blocks.logic.DryingRackLogic; +import tconstruct.common.itemblocks.MetadataItemBlock; +import tconstruct.library.TConstructRegistry; +import tconstruct.library.armor.EnumArmorPart; +import tconstruct.library.client.TConstructClientRegistry; +import tconstruct.library.crafting.Detailing; +import tconstruct.library.crafting.DryingRackRecipes; +import tconstruct.library.crafting.FluidType; +import tconstruct.library.crafting.LiquidCasting; +import tconstruct.library.crafting.PatternBuilder; +import tconstruct.library.crafting.Smeltery; +import tconstruct.library.crafting.ToolBuilder; +import tconstruct.library.util.IPattern; +import tconstruct.mechworks.itemblocks.ItemBlockLandmine; +import tconstruct.mechworks.logic.TileEntityLandmine; +import tconstruct.smeltery.itemblocks.CastingChannelItem; +import tconstruct.smeltery.itemblocks.GlassBlockItem; +import tconstruct.smeltery.itemblocks.GlassPaneItem; +import tconstruct.smeltery.itemblocks.LavaTankItemBlock; +import tconstruct.smeltery.itemblocks.MetalItemBlock; +import tconstruct.smeltery.itemblocks.SearedSlabItem; +import tconstruct.smeltery.itemblocks.SearedTableItemBlock; +import tconstruct.smeltery.itemblocks.SmelteryItemBlock; +import tconstruct.smeltery.itemblocks.SpeedBlockItem; +import tconstruct.smeltery.itemblocks.SpeedSlabItem; +import tconstruct.smeltery.itemblocks.StainedGlassClearItem; +import tconstruct.smeltery.itemblocks.StainedGlassClearPaneItem; +import tconstruct.smeltery.logic.AdaptiveDrainLogic; +import tconstruct.smeltery.logic.AdaptiveSmelteryLogic; +import tconstruct.smeltery.logic.CastingBasinLogic; +import tconstruct.smeltery.logic.CastingChannelLogic; +import tconstruct.smeltery.logic.CastingTableLogic; +import tconstruct.smeltery.logic.FaucetLogic; +import tconstruct.smeltery.logic.LavaTankLogic; +import tconstruct.smeltery.logic.SmelteryDrainLogic; +import tconstruct.smeltery.logic.SmelteryLogic; +import tconstruct.smeltery.logic.TankAirLogic; +import tconstruct.tools.BowRecipe; +import tconstruct.tools.TDispenserBehaviorArrow; +import tconstruct.tools.itemblocks.CraftingSlabItemBlock; +import tconstruct.tools.itemblocks.MultiBrickFancyItem; +import tconstruct.tools.itemblocks.MultiBrickItem; +import tconstruct.tools.itemblocks.ToolStationItemBlock; +import tconstruct.tools.logic.CraftingStationLogic; +import tconstruct.tools.logic.FrypanLogic; +import tconstruct.tools.logic.FurnaceLogic; +import tconstruct.tools.logic.PartBuilderLogic; +import tconstruct.tools.logic.PatternChestLogic; +import tconstruct.tools.logic.StencilTableLogic; +import tconstruct.tools.logic.ToolForgeLogic; +import tconstruct.tools.logic.ToolStationLogic; +import tconstruct.tools.modifiers.ModAntiSpider; +import tconstruct.tools.modifiers.ModAttack; +import tconstruct.tools.modifiers.ModAutoSmelt; +import tconstruct.tools.modifiers.ModBlaze; +import tconstruct.tools.modifiers.ModButtertouch; +import tconstruct.tools.modifiers.ModCreativeToolModifier; +import tconstruct.tools.modifiers.ModDurability; +import tconstruct.tools.modifiers.ModExtraModifier; +import tconstruct.tools.modifiers.ModFlux; +import tconstruct.tools.modifiers.ModInteger; +import tconstruct.tools.modifiers.ModLapis; +import tconstruct.tools.modifiers.ModPiston; +import tconstruct.tools.modifiers.ModRedstone; +import tconstruct.tools.modifiers.ModReinforced; +import tconstruct.tools.modifiers.ModRepair; +import tconstruct.tools.modifiers.ModSmite; +import tconstruct.tools.modifiers.TActiveOmniMod; +import tconstruct.util.config.PHConstruct; +import tconstruct.world.TDispenserBehaviorSpawnEgg; +import tconstruct.world.itemblocks.BarricadeItem; +import tconstruct.world.itemblocks.CraftedSoilItemBlock; +import tconstruct.world.itemblocks.GravelOreItem; +import tconstruct.world.itemblocks.HamboneItemBlock; +import tconstruct.world.itemblocks.MetalOreItemBlock; +import tconstruct.world.itemblocks.OreberryBushItem; +import tconstruct.world.itemblocks.OreberryBushSecondItem; +import tconstruct.world.itemblocks.SlimeGelItemBlock; +import tconstruct.world.itemblocks.SlimeGrassItemBlock; +import tconstruct.world.itemblocks.SlimeLeavesItemBlock; +import tconstruct.world.itemblocks.SlimeSaplingItemBlock; +import tconstruct.world.itemblocks.SlimeTallGrassItem; +import tconstruct.world.itemblocks.WoolSlab1Item; +import tconstruct.world.itemblocks.WoolSlab2Item; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; + +public class TRecipes +{ + static void registerBlockRecipes () + { + // Tool Tables + GameRegistry.registerBlock(TRepo.toolStationWood, ToolStationItemBlock.class, "ToolStationBlock"); + GameRegistry.registerTileEntity(ToolStationLogic.class, "ToolStation"); + GameRegistry.registerTileEntity(PartBuilderLogic.class, "PartCrafter"); + GameRegistry.registerTileEntity(PatternChestLogic.class, "PatternHolder"); + GameRegistry.registerTileEntity(StencilTableLogic.class, "PatternShaper"); + GameRegistry.registerBlock(TRepo.toolForge, MetadataItemBlock.class, "ToolForgeBlock"); + GameRegistry.registerTileEntity(ToolForgeLogic.class, "ToolForge"); + GameRegistry.registerBlock(TRepo.craftingStationWood, "CraftingStation"); + GameRegistry.registerTileEntity(CraftingStationLogic.class, "CraftingStation"); + GameRegistry.registerBlock(TRepo.craftingSlabWood, CraftingSlabItemBlock.class, "CraftingSlab"); + GameRegistry.registerBlock(TRepo.furnaceSlab, "FurnaceSlab"); + GameRegistry.registerTileEntity(FurnaceLogic.class, "TConstruct.Furnace"); + GameRegistry.registerBlock(TRepo.heldItemBlock, "HeldItemBlock"); + GameRegistry.registerTileEntity(FrypanLogic.class, "FrypanLogic"); + + GameRegistry.registerBlock(TRepo.craftedSoil, CraftedSoilItemBlock.class, "CraftedSoil"); + + GameRegistry.registerBlock(TRepo.searedSlab, SearedSlabItem.class, "SearedSlab"); + GameRegistry.registerBlock(TRepo.speedSlab, SpeedSlabItem.class, "SpeedSlab"); + + GameRegistry.registerBlock(TRepo.metalBlock, MetalItemBlock.class, "MetalBlock"); + GameRegistry.registerBlock(TRepo.meatBlock, HamboneItemBlock.class, "MeatBlock"); + + OreDictionary.registerOre("hambone", new ItemStack(TRepo.meatBlock)); + GameRegistry.addRecipe(new ItemStack(TRepo.meatBlock), "mmm", "mbm", "mmm", 'b', new ItemStack(Items.bone), 'm', new ItemStack(Items.porkchop)); + + GameRegistry.registerBlock(TRepo.glueBlock, "GlueBlock"); + OreDictionary.registerOre("blockRubber", new ItemStack(TRepo.glueBlock)); + + GameRegistry.registerBlock(TRepo.woolSlab1, WoolSlab1Item.class, "WoolSlab1"); + GameRegistry.registerBlock(TRepo.woolSlab2, WoolSlab2Item.class, "WoolSlab2"); + + // Smeltery stuff + GameRegistry.registerBlock(TRepo.smeltery, SmelteryItemBlock.class, "Smeltery"); + GameRegistry.registerBlock(TRepo.smelteryNether, SmelteryItemBlock.class, "SmelteryNether"); + if (PHConstruct.newSmeltery) + { + GameRegistry.registerTileEntity(AdaptiveSmelteryLogic.class, "TConstruct.Smeltery"); + GameRegistry.registerTileEntity(AdaptiveDrainLogic.class, "TConstruct.SmelteryDrain"); + } + else + { + GameRegistry.registerTileEntity(SmelteryLogic.class, "TConstruct.Smeltery"); + GameRegistry.registerTileEntity(SmelteryDrainLogic.class, "TConstruct.SmelteryDrain"); + } + GameRegistry.registerTileEntity(MultiServantLogic.class, "TConstruct.Servants"); + GameRegistry.registerBlock(TRepo.lavaTank, LavaTankItemBlock.class, "LavaTank"); + GameRegistry.registerBlock(TRepo.lavaTankNether, LavaTankItemBlock.class, "LavaTankNether"); + GameRegistry.registerTileEntity(LavaTankLogic.class, "TConstruct.LavaTank"); + + GameRegistry.registerBlock(TRepo.searedBlock, SearedTableItemBlock.class, "SearedBlock"); + GameRegistry.registerBlock(TRepo.searedBlockNether, SearedTableItemBlock.class, "SearedBlockNether"); + GameRegistry.registerTileEntity(CastingTableLogic.class, "CastingTable"); + GameRegistry.registerTileEntity(FaucetLogic.class, "Faucet"); + GameRegistry.registerTileEntity(CastingBasinLogic.class, "CastingBasin"); + + GameRegistry.registerBlock(TRepo.castingChannel, CastingChannelItem.class, "CastingChannel"); + GameRegistry.registerTileEntity(CastingChannelLogic.class, "CastingChannel"); + + GameRegistry.registerBlock(TRepo.tankAir, "TankAir"); + GameRegistry.registerTileEntity(TankAirLogic.class, "tconstruct.tank.air"); + + // Traps + GameRegistry.registerBlock(TRepo.landmine, ItemBlockLandmine.class, "Redstone.Landmine"); + GameRegistry.registerTileEntity(TileEntityLandmine.class, "Landmine"); + GameRegistry.registerBlock(TRepo.punji, "trap.punji"); + GameRegistry.registerBlock(TRepo.barricadeOak, BarricadeItem.class, "trap.barricade.oak"); + GameRegistry.registerBlock(TRepo.barricadeSpruce, BarricadeItem.class, "trap.barricade.spruce"); + GameRegistry.registerBlock(TRepo.barricadeBirch, BarricadeItem.class, "trap.barricade.birch"); + GameRegistry.registerBlock(TRepo.barricadeJungle, BarricadeItem.class, "trap.barricade.jungle"); + GameRegistry.registerBlock(TRepo.slimeExplosive, MetadataItemBlock.class, "explosive.slime"); + + GameRegistry.registerBlock(TRepo.dryingRack, "Armor.DryingRack"); + GameRegistry.registerTileEntity(DryingRackLogic.class, "Armor.DryingRack"); + // fluids + + // Slime Islands + GameRegistry.registerBlock(TRepo.slimeGel, SlimeGelItemBlock.class, "slime.gel"); + GameRegistry.registerBlock(TRepo.slimeGrass, SlimeGrassItemBlock.class, "slime.grass"); + GameRegistry.registerBlock(TRepo.slimeTallGrass, SlimeTallGrassItem.class, "slime.grass.tall"); + GameRegistry.registerBlock(TRepo.slimeLeaves, SlimeLeavesItemBlock.class, "slime.leaves"); + GameRegistry.registerBlock(TRepo.slimeSapling, SlimeSaplingItemBlock.class, "slime.sapling"); + GameRegistry.registerBlock(TRepo.slimeChannel, "slime.channel"); + GameRegistry.registerBlock(TRepo.bloodChannel, "blood.channel"); + GameRegistry.registerBlock(TRepo.slimePad, "slime.pad"); + // TODO fix this + /* + * TConstructRegistry.drawbridgeState[TRepo.slimePad] = 1; + * TConstructRegistry.drawbridgeState[TRepo.bloodChannel] = 1; + */ + + // Decoration + GameRegistry.registerBlock(TRepo.stoneTorch, "decoration.stonetorch"); + GameRegistry.registerBlock(TRepo.stoneLadder, "decoration.stoneladder"); + GameRegistry.registerBlock(TRepo.multiBrick, MultiBrickItem.class, "decoration.multibrick"); + GameRegistry.registerBlock(TRepo.multiBrickFancy, MultiBrickFancyItem.class, "decoration.multibrickfancy"); + + // Ores + GameRegistry.registerBlock(TRepo.oreBerry, OreberryBushItem.class, "ore.berries.one"); + GameRegistry.registerBlock(TRepo.oreBerrySecond, OreberryBushSecondItem.class, "ore.berries.two"); + GameRegistry.registerBlock(TRepo.oreSlag, MetalOreItemBlock.class, "SearedBrick"); + GameRegistry.registerBlock(TRepo.oreGravel, GravelOreItem.class, "GravelOre"); + + GameRegistry.registerBlock(TRepo.speedBlock, SpeedBlockItem.class, "SpeedBlock"); + + // Glass + GameRegistry.registerBlock(TRepo.clearGlass, GlassBlockItem.class, "GlassBlock"); + GameRegistry.registerBlock(TRepo.glassPane, GlassPaneItem.class, "GlassPane"); + GameRegistry.registerBlock(TRepo.stainedGlassClear, StainedGlassClearItem.class, "GlassBlock.StainedClear"); + GameRegistry.registerBlock(TRepo.stainedGlassClearPane, StainedGlassClearPaneItem.class, "GlassPaneClearStained"); + + // Rail + GameRegistry.registerBlock(TRepo.woodenRail, "rail.wood"); + } + + static void registerItemRecipes () + { + + } + + public void addOreDictionarySmelteryRecipes () + { + List exceptions = Arrays.asList(new FluidType[] { FluidType.Water, FluidType.Stone, FluidType.Ender, FluidType.Glass, FluidType.Slime, FluidType.Obsidian }); + for (FluidType ft : FluidType.values()) + { + if (exceptions.contains(ft)) + continue; + + // Nuggets + Smeltery.addDictionaryMelting("nugget" + ft.toString(), ft, -100, TConstruct.nuggetLiquidValue); + + // Ingots, Dust + registerIngotCasting(ft); + Smeltery.addDictionaryMelting("ingot" + ft.toString(), ft, -50, TConstruct.ingotLiquidValue); + Smeltery.addDictionaryMelting("dust" + ft.toString(), ft, -75, TConstruct.ingotLiquidValue); + + // Factorization support + Smeltery.addDictionaryMelting("crystalline" + ft.toString(), ft, -50, TConstruct.ingotLiquidValue); + + // Ores + Smeltery.addDictionaryMelting("ore" + ft.toString(), ft, 0, (int) (TConstruct.ingotLiquidValue * PHConstruct.ingotsPerOre)); + + // NetherOres support + Smeltery.addDictionaryMelting("oreNether" + ft.toString(), ft, 75, (int) (TConstruct.ingotLiquidValue * PHConstruct.ingotsPerOre * 2)); + + // Blocks + Smeltery.addDictionaryMelting("block" + ft.toString(), ft, 100, TConstruct.blockLiquidValue); + + if (ft.isToolpart) + { + registerPatternMaterial("ingot" + ft.toString(), 2, ft.toString()); + registerPatternMaterial("block" + ft.toString(), 18, ft.toString()); + } + } + // Obsidian, different dust amount + { + FluidType ft = FluidType.Obsidian; + Smeltery.addDictionaryMelting("nugget" + ft.toString(), ft, -100, TConstruct.nuggetLiquidValue); + + // Ingots, Dust + registerIngotCasting(ft); + Smeltery.addDictionaryMelting("ingot" + ft.toString(), ft, -50, TConstruct.ingotLiquidValue); + Smeltery.addDictionaryMelting("dust" + ft.toString(), ft, -75, TConstruct.ingotLiquidValue / 4); + + // Factorization support + Smeltery.addDictionaryMelting("crystalline" + ft.toString(), ft, -50, TConstruct.ingotLiquidValue); + + // Ores + Smeltery.addDictionaryMelting("ore" + ft.toString(), ft, 0, ((int) TConstruct.ingotLiquidValue * (int) PHConstruct.ingotsPerOre)); + + // NetherOres support + Smeltery.addDictionaryMelting("oreNether" + ft.toString(), ft, 75, ((int) TConstruct.ingotLiquidValue * (int) PHConstruct.ingotsPerOre * 2)); + + // Blocks + Smeltery.addDictionaryMelting("block" + ft.toString(), ft, 100, TConstruct.blockLiquidValue); + + if (ft.isToolpart) + { + registerPatternMaterial("ingot" + ft.toString(), 2, ft.toString()); + registerPatternMaterial("block" + ft.toString(), 18, ft.toString()); + } + } + + // Compressed materials + for (int i = 1; i <= 8; i++) + { + Smeltery.addDictionaryMelting("compressedCobblestone" + i + "x", FluidType.Stone, 0, TConstruct.ingotLiquidValue / 18 * (9 ^ i)); + } + Smeltery.addDictionaryMelting("compressedSand1x", FluidType.Glass, 175, FluidContainerRegistry.BUCKET_VOLUME * 9); + + registerPatternMaterial("plankWood", 2, "Wood"); + registerPatternMaterial("stickWood", 1, "Wood"); + registerPatternMaterial("slabWood", 1, "Wood"); + registerPatternMaterial("compressedCobblestone1x", 18, "Stone"); + } + + protected static void addRecipesForToolBuilder () + { + ToolBuilder tb = ToolBuilder.instance; + tb.addNormalToolRecipe(TRepo.pickaxe, TRepo.pickaxeHead, TRepo.toolRod, TRepo.binding); + tb.addNormalToolRecipe(TRepo.broadsword, TRepo.swordBlade, TRepo.toolRod, TRepo.wideGuard); + tb.addNormalToolRecipe(TRepo.hatchet, TRepo.hatchetHead, TRepo.toolRod); + tb.addNormalToolRecipe(TRepo.shovel, TRepo.shovelHead, TRepo.toolRod); + tb.addNormalToolRecipe(TRepo.longsword, TRepo.swordBlade, TRepo.toolRod, TRepo.handGuard); + tb.addNormalToolRecipe(TRepo.rapier, TRepo.swordBlade, TRepo.toolRod, TRepo.crossbar); + tb.addNormalToolRecipe(TRepo.frypan, TRepo.frypanHead, TRepo.toolRod); + tb.addNormalToolRecipe(TRepo.battlesign, TRepo.signHead, TRepo.toolRod); + tb.addNormalToolRecipe(TRepo.mattock, TRepo.hatchetHead, TRepo.toolRod, TRepo.shovelHead); + tb.addNormalToolRecipe(TRepo.dagger, TRepo.knifeBlade, TRepo.toolRod, TRepo.crossbar); + tb.addNormalToolRecipe(TRepo.cutlass, TRepo.swordBlade, TRepo.toolRod, TRepo.fullGuard); + tb.addNormalToolRecipe(TRepo.chisel, TRepo.chiselHead, TRepo.toolRod); + + tb.addNormalToolRecipe(TRepo.scythe, TRepo.scytheBlade, TRepo.toughRod, TRepo.toughBinding, TRepo.toughRod); + tb.addNormalToolRecipe(TRepo.lumberaxe, TRepo.broadAxeHead, TRepo.toughRod, TRepo.largePlate, TRepo.toughBinding); + tb.addNormalToolRecipe(TRepo.cleaver, TRepo.largeSwordBlade, TRepo.toughRod, TRepo.largePlate, TRepo.toughRod); + tb.addNormalToolRecipe(TRepo.excavator, TRepo.excavatorHead, TRepo.toughRod, TRepo.largePlate, TRepo.toughBinding); + tb.addNormalToolRecipe(TRepo.hammer, TRepo.hammerHead, TRepo.toughRod, TRepo.largePlate, TRepo.largePlate); + tb.addNormalToolRecipe(TRepo.battleaxe, TRepo.broadAxeHead, TRepo.toughRod, TRepo.broadAxeHead, TRepo.toughBinding); + + BowRecipe recipe = new BowRecipe(TRepo.toolRod, TRepo.bowstring, TRepo.toolRod, TRepo.shortbow); + tb.addCustomToolRecipe(recipe); + tb.addNormalToolRecipe(TRepo.arrow, TRepo.arrowhead, TRepo.toolRod, TRepo.fletching); + + ItemStack diamond = new ItemStack(Items.diamond); + tb.registerToolMod(new ModRepair()); + tb.registerToolMod(new ModDurability(new ItemStack[] { diamond }, 0, 500, 0f, 3, StatCollector.translateToLocal("gui.modifier.diamond"), "\u00a7b" + + StatCollector.translateToLocal("modifier.tool.diamond"), "\u00a7b")); + tb.registerToolMod(new ModDurability(new ItemStack[] { new ItemStack(Items.emerald) }, 1, 0, 0.5f, 2, StatCollector.translateToLocal("gui.modifier.emerald"), "\u00a72" + + StatCollector.translateToLocal("modifier.tool.emerald"), "\u00a72")); + + TRepo.modFlux = new ModFlux(); + tb.registerToolMod(TRepo.modFlux); + + ItemStack redstoneItem = new ItemStack(Items.redstone); + ItemStack redstoneBlock = new ItemStack(Blocks.redstone_block); + tb.registerToolMod(new ModRedstone(2, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 })); + + ItemStack lapisItem = new ItemStack(Items.dye, 1, 4); + ItemStack lapisBlock = new ItemStack(Blocks.lapis_block); + TRepo.modLapis = new ModLapis(10, new ItemStack[] { lapisItem, lapisBlock }, new int[] { 1, 9 }); + tb.registerToolMod(TRepo.modLapis); + + tb.registerToolMod(new ModInteger(new ItemStack[] { new ItemStack(TRepo.materials, 1, 6) }, 4, StatCollector.translateToLocal("gui.modifier.moss"), 3, "\u00a72", StatCollector + .translateToLocal("modifier.tool.moss"))); + ItemStack blazePowder = new ItemStack(Items.blaze_powder); + tb.registerToolMod(new ModBlaze(7, new ItemStack[] { blazePowder }, new int[] { 1 })); + tb.registerToolMod(new ModAutoSmelt(new ItemStack[] { new ItemStack(TRepo.materials, 1, 7) }, 6, StatCollector.translateToLocal("gui.modifier.lava"), "\u00a74", StatCollector + .translateToLocal("modifier.tool.lava"))); + tb.registerToolMod(new ModInteger(new ItemStack[] { new ItemStack(TRepo.materials, 1, 8) }, 8, StatCollector.translateToLocal("gui.modifier.necro"), 1, "\u00a78", StatCollector + .translateToLocal("modifier.tool.necro"))); + + TRepo.modAttack = new ModAttack(StatCollector.translateToLocal("gui.modifier.quartz"), 11, new ItemStack[] { new ItemStack(Items.quartz), + new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) }, new int[] { 1, 4 }); + tb.registerToolMod(TRepo.modAttack); + + tb.registerToolMod(new ModExtraModifier(new ItemStack[] { diamond, new ItemStack(Blocks.gold_block) }, "Tier1Free")); + tb.registerToolMod(new ModExtraModifier(new ItemStack[] { new ItemStack(Blocks.diamond_block), new ItemStack(Items.golden_apple, 1, 1) }, "Tier1.5Free")); + tb.registerToolMod(new ModExtraModifier(new ItemStack[] { new ItemStack(Items.nether_star) }, "Tier2Free")); + tb.registerToolMod(new ModCreativeToolModifier(new ItemStack[] { new ItemStack(TRepo.creativeModifier) })); + + ItemStack silkyJewel = new ItemStack(TRepo.materials, 1, 26); + tb.registerToolMod(new ModButtertouch(new ItemStack[] { silkyJewel }, 12)); + + ItemStack piston = new ItemStack(Blocks.piston); + tb.registerToolMod(new ModPiston(3, new ItemStack[] { piston }, new int[] { 1 })); + + tb.registerToolMod(new ModInteger(new ItemStack[] { new ItemStack(Blocks.obsidian), new ItemStack(Items.ender_pearl) }, 13, StatCollector.translateToLocal("modifier.tool.beheading"), 1, + "\u00a7d", StatCollector.translateToLocal("modifier.tool.beheading"))); + + ItemStack holySoil = new ItemStack(TRepo.craftedSoil, 1, 4); + tb.registerToolMod(new ModSmite(StatCollector.translateToLocal("modifier.tool.smite"), 14, new ItemStack[] { holySoil }, new int[] { 1 })); + + ItemStack spidereyeball = new ItemStack(Items.fermented_spider_eye); + tb.registerToolMod(new ModAntiSpider(StatCollector.translateToLocal("gui.modifier.spider"), 15, new ItemStack[] { spidereyeball }, new int[] { 1 })); + + ItemStack obsidianPlate = new ItemStack(TRepo.largePlate, 1, 6); + tb.registerToolMod(new ModReinforced(new ItemStack[] { obsidianPlate }, 16, 1)); + + EnumSet allArmors = EnumSet.of(EnumArmorPart.HELMET, EnumArmorPart.CHEST, EnumArmorPart.PANTS, EnumArmorPart.SHOES); + EnumSet chest = EnumSet.of(EnumArmorPart.CHEST); + tb.registerArmorMod(new AModMoveSpeed(0, allArmors, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }, false)); + tb.registerArmorMod(new AModKnockbackResistance(1, allArmors, new ItemStack[] { new ItemStack(Items.gold_ingot), new ItemStack(Blocks.gold_block) }, new int[] { 1, 9 }, false)); + tb.registerArmorMod(new AModHealthBoost(2, allArmors, new ItemStack[] { new ItemStack(TRepo.heartCanister, 1, 2) }, new int[] { 2 }, true)); + tb.registerArmorMod(new AModDamageBoost(3, allArmors, new ItemStack[] { new ItemStack(Items.diamond), new ItemStack(Blocks.diamond_block) }, new int[] { 1, 9 }, false, 3, 0.05)); + tb.registerArmorMod(new AModDamageBoost(4, chest, new ItemStack[] { new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) }, new int[] { 1 }, true, 5, 1)); + tb.registerArmorMod(new AModProtection(5, allArmors, new ItemStack[] { new ItemStack(TRepo.largePlate, 1, 2) }, new int[] { 2 })); + + tb.registerArmorMod(new AModDoubleJump(new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TRepo.slimeGel, 1, 0), new ItemStack(TRepo.slimeGel, 1, 1) })); + + TConstructRegistry.registerActiveToolMod(new TActiveOmniMod()); + } + + protected static void addPartMapping () + { + /* Tools */ + TRepo.patternOutputs = new Item[] { TRepo.toolRod, TRepo.pickaxeHead, TRepo.shovelHead, TRepo.hatchetHead, TRepo.swordBlade, TRepo.wideGuard, TRepo.handGuard, TRepo.crossbar, TRepo.binding, + TRepo.frypanHead, TRepo.signHead, TRepo.knifeBlade, TRepo.chiselHead, TRepo.toughRod, TRepo.toughBinding, TRepo.largePlate, TRepo.broadAxeHead, TRepo.scytheBlade, TRepo.excavatorHead, + TRepo.largeSwordBlade, TRepo.hammerHead, TRepo.fullGuard, null, null, TRepo.arrowhead, null }; + + int[] nonMetals = { 0, 1, 3, 4, 5, 6, 7, 8, 9, 17 }; + + if (PHConstruct.craftMetalTools) + { + for (int mat = 0; mat < 18; mat++) + { + for (int meta = 0; meta < TRepo.patternOutputs.length; meta++) + { + if (TRepo.patternOutputs[meta] != null) + TConstructRegistry.addPartMapping(TRepo.woodPattern, meta + 1, mat, new ItemStack(TRepo.patternOutputs[meta], 1, mat)); + } + } + } + else + { + for (int mat = 0; mat < nonMetals.length; mat++) + { + for (int meta = 0; meta < TRepo.patternOutputs.length; meta++) + { + if (TRepo.patternOutputs[meta] != null) + TConstructRegistry.addPartMapping(TRepo.woodPattern, meta + 1, nonMetals[mat], new ItemStack(TRepo.patternOutputs[meta], 1, nonMetals[mat])); + } + } + } + } + + protected static void addRecipesForTableCasting () + { + /* Smeltery */ + ItemStack ingotcast = new ItemStack(TRepo.metalPattern, 1, 0); + ItemStack gemcast = new ItemStack(TRepo.metalPattern, 1, 26); + LiquidCasting tableCasting = TConstructRegistry.instance.getTableCasting(); + // Blank + tableCasting.addCastingRecipe(new ItemStack(TRepo.blankPattern, 1, 1), new FluidStack(TRepo.moltenAlubrassFluid, TConstruct.ingotLiquidValue), 80); + tableCasting.addCastingRecipe(new ItemStack(TRepo.blankPattern, 1, 2), new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue * 2), 80); + tableCasting.addCastingRecipe(gemcast, new FluidStack(TRepo.moltenAlubrassFluid, TConstruct.ingotLiquidValue), new ItemStack(Items.emerald), 80); + tableCasting.addCastingRecipe(gemcast, new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue * 2), new ItemStack(Items.emerald), 80); + + // Ingots + tableCasting.addCastingRecipe(new ItemStack(TRepo.materials, 1, 2), new FluidStack(TRepo.moltenStoneFluid, TConstruct.ingotLiquidValue / 4), ingotcast, 80); // stone + + // Misc + tableCasting.addCastingRecipe(new ItemStack(Items.emerald), new FluidStack(TRepo.moltenEmeraldFluid, 640), gemcast, 80); + tableCasting.addCastingRecipe(new ItemStack(TRepo.materials, 1, 36), new FluidStack(TRepo.glueFluid, TConstruct.ingotLiquidValue), null, 50); + tableCasting.addCastingRecipe(new ItemStack(TRepo.strangeFood, 1, 1), new FluidStack(TRepo.bloodFluid, 160), null, 50); + + // Buckets + ItemStack bucket = new ItemStack(Items.bucket); + + for (int sc = 0; sc < 24; sc++) + { + tableCasting.addCastingRecipe(new ItemStack(TRepo.buckets, 1, sc), new FluidStack(TRepo.fluids[sc], FluidContainerRegistry.BUCKET_VOLUME), bucket, true, 10); + } + tableCasting.addCastingRecipe(new ItemStack(TRepo.buckets, 1, 26), new FluidStack(TRepo.fluids[26], FluidContainerRegistry.BUCKET_VOLUME), bucket, true, 10); + + // Clear glass pane casting + tableCasting.addCastingRecipe(new ItemStack(TRepo.glassPane), new FluidStack(TRepo.moltenGlassFluid, 250), null, 80); + + // Metal toolpart casting + TRepo.liquids = new FluidStack[] { new FluidStack(TRepo.moltenIronFluid, 1), new FluidStack(TRepo.moltenCopperFluid, 1), new FluidStack(TRepo.moltenCobaltFluid, 1), + new FluidStack(TRepo.moltenArditeFluid, 1), new FluidStack(TRepo.moltenManyullynFluid, 1), new FluidStack(TRepo.moltenBronzeFluid, 1), new FluidStack(TRepo.moltenAlumiteFluid, 1), + new FluidStack(TRepo.moltenObsidianFluid, 1), new FluidStack(TRepo.moltenSteelFluid, 1), new FluidStack(TRepo.pigIronFluid, 1) }; + int[] liquidDamage = new int[] { 2, 13, 10, 11, 12, 14, 15, 6, 16, 18 }; // ItemStack + // damage + // value + int fluidAmount = 0; + Fluid fs = null; + + for (int iter = 0; iter < TRepo.patternOutputs.length; iter++) + { + if (TRepo.patternOutputs[iter] != null) + { + ItemStack cast = new ItemStack(TRepo.metalPattern, 1, iter + 1); + + tableCasting.addCastingRecipe(cast, new FluidStack(TRepo.moltenAlubrassFluid, TConstruct.ingotLiquidValue), new ItemStack(TRepo.patternOutputs[iter], 1, Short.MAX_VALUE), false, 50); + tableCasting.addCastingRecipe(cast, new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue * 2), new ItemStack(TRepo.patternOutputs[iter], 1, Short.MAX_VALUE), false, 50); + + for (int iterTwo = 0; iterTwo < TRepo.liquids.length; iterTwo++) + { + fs = TRepo.liquids[iterTwo].getFluid(); + fluidAmount = ((IPattern) TRepo.metalPattern).getPatternCost(cast) * TConstruct.ingotLiquidValue / 2; + ItemStack metalCast = new ItemStack(TRepo.patternOutputs[iter], 1, liquidDamage[iterTwo]); + tableCasting.addCastingRecipe(metalCast, new FluidStack(fs, fluidAmount), cast, 50); + Smeltery.addMelting(FluidType.getFluidType(fs), metalCast, 0, fluidAmount); + } + } + } + + ItemStack[] ingotShapes = { new ItemStack(Items.brick), new ItemStack(Items.netherbrick), new ItemStack(TRepo.materials, 1, 2), new ItemStack(TRepo.materials, 1, 37) }; + for (int i = 0; i < ingotShapes.length; i++) + { + tableCasting.addCastingRecipe(ingotcast, new FluidStack(TRepo.moltenAlubrassFluid, TConstruct.ingotLiquidValue), ingotShapes[i], false, 50); + tableCasting.addCastingRecipe(ingotcast, new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue * 2), ingotShapes[i], false, 50); + } + + ItemStack fullguardCast = new ItemStack(TRepo.metalPattern, 1, 22); + tableCasting.addCastingRecipe(fullguardCast, new FluidStack(TRepo.moltenAlubrassFluid, TConstruct.ingotLiquidValue), new ItemStack(TRepo.fullGuard, 1, Short.MAX_VALUE), false, 50); + tableCasting.addCastingRecipe(fullguardCast, new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue * 2), new ItemStack(TRepo.fullGuard, 1, Short.MAX_VALUE), false, 50); + + // Golden Food Stuff + FluidStack goldAmount = null; + if (PHConstruct.goldAppleRecipe) + { + goldAmount = new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue * 8); + } + else + { + goldAmount = new FluidStack(TRepo.moltenGoldFluid, TConstruct.nuggetLiquidValue * 8); + } + tableCasting.addCastingRecipe(new ItemStack(Items.golden_apple, 1), goldAmount, new ItemStack(Items.apple), true, 50); + tableCasting.addCastingRecipe(new ItemStack(Items.golden_carrot, 1), goldAmount, new ItemStack(Items.carrot), true, 50); + tableCasting.addCastingRecipe(new ItemStack(Items.speckled_melon, 1), goldAmount, new ItemStack(Items.melon), true, 50); + tableCasting.addCastingRecipe(new ItemStack(TRepo.goldHead), goldAmount, new ItemStack(Items.skull, 1, 3), true, 50); + } + + protected static void addRecipesForFurnace () + { + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.craftedSoil, 1, 3), new ItemStack(TRepo.craftedSoil, 1, 4), 0.2f); // Concecrated + // Soil + + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.craftedSoil, 1, 0), new ItemStack(TRepo.materials, 1, 1), 2f); // Slime + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.craftedSoil, 1, 1), new ItemStack(TRepo.materials, 1, 2), 2f); // Seared brick item + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.craftedSoil, 1, 2), new ItemStack(TRepo.materials, 1, 17), 2f); // Blue Slime + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.craftedSoil, 1, 6), new ItemStack(TRepo.materials, 1, 37), 2f); // Nether seared + // brick + + // FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreSlag, + // 1, new ItemStack(TRepo.materials, 1, 3), 3f); + // FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreSlag, + // 2, new ItemStack(TRepo.materials, 1, 4), 3f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreSlag, 1, 3), new ItemStack(TRepo.materials, 1, 9), 0.5f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreSlag, 1, 4), new ItemStack(TRepo.materials, 1, 10), 0.5f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreSlag, 1, 5), new ItemStack(TRepo.materials, 1, 11), 0.5f); + + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreBerries, 1, 0), new ItemStack(TRepo.materials, 1, 19), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreBerries, 1, 1), new ItemStack(Items.gold_nugget), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreBerries, 1, 2), new ItemStack(TRepo.materials, 1, 20), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreBerries, 1, 3), new ItemStack(TRepo.materials, 1, 21), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreBerries, 1, 4), new ItemStack(TRepo.materials, 1, 22), 0.2f); + // FurnaceRecipes.smelting().func_151394_a(new + // ItemStack(TRepo.oreBerries, 5, new ItemStack(TRepo.materials, 1, 23), + // 0.2f); + + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreGravel, 1, 0), new ItemStack(Items.iron_ingot), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreGravel, 1, 1), new ItemStack(Items.gold_ingot), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreGravel, 1, 2), new ItemStack(TRepo.materials, 1, 9), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreGravel, 1, 3), new ItemStack(TRepo.materials, 1, 10), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.oreGravel, 1, 4), new ItemStack(TRepo.materials, 1, 11), 0.2f); + + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.speedBlock, 1, 0), new ItemStack(TRepo.speedBlock, 1, 2), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.materials, 1, 38), new ItemStack(TRepo.materials, 1, 4), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.materials, 1, 39), new ItemStack(TRepo.materials, 1, 3), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.materials, 1, 40), new ItemStack(TRepo.materials, 1, 11), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.materials, 1, 41), new ItemStack(TRepo.materials, 1, 5), 0.2f); + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.materials, 1, 42), new ItemStack(TRepo.materials, 1, 14), 0.2f); + + } + + protected static void addRecipesForCraftingTable () + { + String[] patBlock = { "###", "###", "###" }; + String[] patSurround = { "###", "#m#", "###" }; + + Object[] toolForgeBlocks = { "blockIron", "blockGold", Blocks.diamond_block, Blocks.emerald_block, "blockCobalt", "blockArdite", "blockManyullyn", "blockCopper", "blockBronze", "blockTin", + "blockAluminum", "blockAluminumBrass", "blockAlumite", "blockSteel" }; + + // ToolForge Recipes (Metal Version) + for (int sc = 0; sc < toolForgeBlocks.length; sc++) + { + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.toolForge, 1, sc), "bbb", "msm", "m m", 'b', new ItemStack(TRepo.smeltery, 1, 2), 's', new ItemStack(TRepo.toolStationWood, + 1, 0), 'm', toolForgeBlocks[sc])); + // adding slab version recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 5), "bbb", "msm", "m m", 'b', new ItemStack(TRepo.smeltery, 1, 2), 's', new ItemStack( + TRepo.craftingSlabWood, 1, 1), 'm', toolForgeBlocks[sc])); + } + + // ToolStation Recipes (Wooden Version) + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.toolStationWood, 1, 0), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', "crafterWood")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.toolStationWood, 1, 0), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', "craftingTableWood")); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 0), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', new ItemStack(TRepo.craftingStationWood, 1, 0)); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 0), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', new ItemStack(TRepo.craftingSlabWood, 1, 0)); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 2), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', new ItemStack(Blocks.log, 1, 1)); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 3), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', new ItemStack(Blocks.log, 1, 2)); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 4), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', new ItemStack(Blocks.log, 1, 3)); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 5), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', Blocks.chest); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.toolStationWood, 1, 1), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', "logWood")); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 10), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', new ItemStack(Blocks.planks, 1, 0)); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 11), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', new ItemStack(Blocks.planks, 1, 1)); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 12), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', new ItemStack(Blocks.planks, 1, 2)); + GameRegistry.addRecipe(new ItemStack(TRepo.toolStationWood, 1, 13), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', new ItemStack(Blocks.planks, 1, 3)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.toolStationWood, 1, 10), "p", "w", 'p', new ItemStack(TRepo.blankPattern, 1, 0), 'w', "plankWood")); + + GameRegistry.addRecipe(new ItemStack(TRepo.furnaceSlab, 1, 0), "###", "# #", "###", '#', new ItemStack(Blocks.stone_slab, 1, 3)); + + // Blank Pattern Recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.blankPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', "stickWood")); + // Manual Book Recipes + GameRegistry.addRecipe(new ItemStack(TRepo.manualBook), "wp", 'w', new ItemStack(TRepo.blankPattern, 1, 0), 'p', Items.paper); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.manualBook, 2, 0), new ItemStack(TRepo.manualBook, 1, 0), Items.book); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.manualBook, 1, 1), new ItemStack(TRepo.manualBook, 1, 0)); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.manualBook, 2, 1), new ItemStack(TRepo.manualBook, 1, 1), Items.book); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.manualBook, 1, 2), new ItemStack(TRepo.manualBook, 1, 1)); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.manualBook, 2, 2), new ItemStack(TRepo.manualBook, 1, 2), Items.book); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.manualBook, 1, 3), new ItemStack(TRepo.manualBook, 1, 2)); + // alternative Vanilla Book Recipe + GameRegistry.addShapelessRecipe(new ItemStack(Items.book), Items.paper, Items.paper, Items.paper, Items.string, TRepo.blankPattern, TRepo.blankPattern); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.name_tag), "P~ ", "~O ", " ~", '~', Items.string, 'P', Items.paper, 'O', "slimeball")); + + // Paperstack Recipe + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 0), "pp", "pp", 'p', Items.paper); + // Mossball Recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.materials, 1, 6), patBlock, '#', "stoneMossy")); + // LavaCrystal Recipes -Auto-smelt + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 7), "xcx", "cbc", "xcx", 'b', Items.lava_bucket, 'c', Items.fire_charge, 'x', Items.blaze_rod); + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 7), "xcx", "cbc", "xcx", 'b', Items.lava_bucket, 'x', Items.fire_charge, 'c', Items.blaze_rod); + // Slimy sand Recipes + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.craftedSoil, 1, 0), Items.slime_ball, Items.slime_ball, Items.slime_ball, Items.slime_ball, Blocks.sand, Blocks.dirt); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.craftedSoil, 1, 2), TRepo.strangeFood, TRepo.strangeFood, TRepo.strangeFood, TRepo.strangeFood, Blocks.sand, Blocks.dirt); + // Grout Recipes + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.craftedSoil, 2, 1), Items.clay_ball, Blocks.sand, Blocks.gravel); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.craftedSoil, 8, 1), new ItemStack(Blocks.clay, 1, Short.MAX_VALUE), Blocks.sand, Blocks.sand, Blocks.sand, Blocks.sand, Blocks.gravel, + Blocks.gravel, Blocks.gravel, Blocks.gravel); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.craftedSoil, 2, 6), Items.nether_wart, Blocks.soul_sand, Blocks.gravel); + // Graveyard Soil Recipes + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.craftedSoil, 1, 3), Blocks.dirt, Items.rotten_flesh, new ItemStack(Items.dye, 1, 15)); + // Silky Cloth Recipes + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 25), patSurround, 'm', new ItemStack(TRepo.materials, 1, 24), '#', new ItemStack(Items.string)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.materials, 1, 25), patSurround, 'm', "nuggetGold", '#', new ItemStack(Items.string))); + // Silky Jewel Recipes + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 26), " c ", "cec", " c ", 'c', new ItemStack(TRepo.materials, 1, 25), 'e', new ItemStack(Items.emerald)); + // Armor Recipes + Object[] helm = new String[] { "www", "w w" }; + Object[] chest = new String[] { "w w", "www", "www" }; + Object[] pants = new String[] { "www", "w w", "w w" }; + Object[] shoes = new String[] { "w w", "w w" }; + GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.helmetWood, helm, 'w', "logWood")); + GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.chestplateWood, chest, 'w', "logWood")); + GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.leggingsWood, pants, 'w', "logWood")); + GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.bootsWood, shoes, 'w', "logWood")); + + ItemStack exoGoggleStack = new ItemStack(TRepo.exoGoggles); + ItemStack exoChestStack = new ItemStack(TRepo.exoChest); + ItemStack exoPantsStack = new ItemStack(TRepo.exoPants); + ItemStack exoShoesStack = new ItemStack(TRepo.exoShoes); + if (PHConstruct.exoCraftingEnabled) + { + ToolBuilder.instance.addArmorTag(exoGoggleStack); + ToolBuilder.instance.addArmorTag(exoChestStack); + ToolBuilder.instance.addArmorTag(exoPantsStack); + ToolBuilder.instance.addArmorTag(exoShoesStack); + GameRegistry.addShapedRecipe(exoGoggleStack, helm, 'w', new ItemStack(TRepo.largePlate, 1, 14)); + GameRegistry.addShapedRecipe(exoChestStack, chest, 'w', new ItemStack(TRepo.largePlate, 1, 14)); + GameRegistry.addShapedRecipe(exoPantsStack, pants, 'w', new ItemStack(TRepo.largePlate, 1, 14)); + GameRegistry.addShapedRecipe(exoShoesStack, shoes, 'w', new ItemStack(TRepo.largePlate, 1, 14)); + } + + // Metal conversion Recipes + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 3), patBlock, '#', new ItemStack(TRepo.materials, 1, 9)); // Copper + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 5), patBlock, '#', new ItemStack(TRepo.materials, 1, 10)); // Tin + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 6), patBlock, '#', new ItemStack(TRepo.materials, 1, 11)); // Aluminum + // GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 6), + // patBlock, '#', new ItemStack(TRepo.materials, 1, 12)); // Aluminum + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 4), patBlock, '#', new ItemStack(TRepo.materials, 1, 13)); // Bronze + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 7), patBlock, '#', new ItemStack(TRepo.materials, 1, 14)); // AluBrass + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 0), patBlock, '#', new ItemStack(TRepo.materials, 1, 3)); // Cobalt + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 1), patBlock, '#', new ItemStack(TRepo.materials, 1, 4)); // Ardite + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 2), patBlock, '#', new ItemStack(TRepo.materials, 1, 5)); // Manyullyn + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 8), patBlock, '#', new ItemStack(TRepo.materials, 1, 15)); // Alumite + GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 9), patBlock, '#', new ItemStack(TRepo.materials, 1, 16)); // Steel + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 11), "#", '#', new ItemStack(TRepo.materials, 1, 12)); // Aluminum raw -> + // ingot + + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 9), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 3)); // Copper + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 10), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 5)); // Tin + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 11), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 6)); // Aluminum + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 13), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 4)); // Bronze + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 14), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 7)); // AluBrass + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 3), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 0)); // Cobalt + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 4), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 1)); // Ardite + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 5), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 2)); // Manyullyn + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 15), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 8)); // Alumite + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 16), "m", 'm', new ItemStack(TRepo.metalBlock, 1, 9)); // Steel + + GameRegistry.addRecipe(new ItemStack(Items.iron_ingot), patBlock, '#', new ItemStack(TRepo.materials, 1, 19)); // Iron + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 9), patBlock, '#', new ItemStack(TRepo.materials, 1, 20)); // Copper + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 10), patBlock, '#', new ItemStack(TRepo.materials, 1, 21)); // Tin + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 11), patBlock, '#', new ItemStack(TRepo.materials, 1, 22)); // Aluminum + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 14), patBlock, '#', new ItemStack(TRepo.materials, 1, 24)); // Aluminum Brass + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 18), patBlock, '#', new ItemStack(TRepo.materials, 1, 27)); // Obsidian + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 3), patBlock, '#', new ItemStack(TRepo.materials, 1, 28)); // Cobalt + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 4), patBlock, '#', new ItemStack(TRepo.materials, 1, 29)); // Ardite + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 5), patBlock, '#', new ItemStack(TRepo.materials, 1, 30)); // Manyullyn + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 13), patBlock, '#', new ItemStack(TRepo.materials, 1, 31)); // Bronze + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 15), patBlock, '#', new ItemStack(TRepo.materials, 1, 32)); // Alumite + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 16), patBlock, '#', new ItemStack(TRepo.materials, 1, 33)); // Steel + + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 19), "m", 'm', new ItemStack(Items.iron_ingot)); // Iron + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 20), "m", 'm', new ItemStack(TRepo.materials, 1, 9)); // Copper + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 21), "m", 'm', new ItemStack(TRepo.materials, 1, 10)); // Tin + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 22), "m", 'm', new ItemStack(TRepo.materials, 1, 11)); // Aluminum + // GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 22), "m", + // 'm', new ItemStack(TRepo.materials, 1, 12)); //Aluminum + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 24), "m", 'm', new ItemStack(TRepo.materials, 1, 14)); // Aluminum Brass + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 27), "m", 'm', new ItemStack(TRepo.materials, 1, 18)); // Obsidian + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 28), "m", 'm', new ItemStack(TRepo.materials, 1, 3)); // Cobalt + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 29), "m", 'm', new ItemStack(TRepo.materials, 1, 4)); // Ardite + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 30), "m", 'm', new ItemStack(TRepo.materials, 1, 5)); // Manyullyn + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 31), "m", 'm', new ItemStack(TRepo.materials, 1, 13)); // Bronze + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 32), "m", 'm', new ItemStack(TRepo.materials, 1, 15)); // Alumite + GameRegistry.addRecipe(new ItemStack(TRepo.materials, 9, 33), "m", 'm', new ItemStack(TRepo.materials, 1, 16)); // Steel + + // stained Glass Recipes + String[] dyeTypes = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", + "dyeMagenta", "dyeOrange", "dyeWhite" }; + String color = ""; + for (int i = 0; i < 16; i++) + { + color = dyeTypes[15 - i]; + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.wool, 8, i), patSurround, 'm', color, '#', new ItemStack(Blocks.wool, 1, Short.MAX_VALUE))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.stainedGlassClear, 8, i), patSurround, 'm', color, '#', TRepo.clearGlass)); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TRepo.stainedGlassClear, 1, i), color, TRepo.clearGlass)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.stainedGlassClear, 8, i), patSurround, 'm', color, '#', new ItemStack(TRepo.stainedGlassClear, 1, Short.MAX_VALUE))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TRepo.stainedGlassClear, 1, i), color, new ItemStack(TRepo.stainedGlassClear, 1, Short.MAX_VALUE))); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.stainedGlassClearPane, 8, i), patSurround, 'm', color, '#', TRepo.glassPane)); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TRepo.stainedGlassClearPane, 1, i), color, TRepo.glassPane)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.stainedGlassClearPane, 8, i), patSurround, 'm', color, '#', new ItemStack(TRepo.stainedGlassClearPane, 1, Short.MAX_VALUE))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TRepo.stainedGlassClearPane, 1, i), color, new ItemStack(TRepo.stainedGlassClearPane, 1, Short.MAX_VALUE))); + } + + // Glass Recipes + GameRegistry.addRecipe(new ItemStack(Items.glass_bottle, 3), new Object[] { "# #", " # ", '#', TRepo.clearGlass }); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.daylight_detector), new Object[] { "GGG", "QQQ", "WWW", 'G', "blockGlass", 'Q', Items.quartz, 'W', "slabWood" })); + GameRegistry.addRecipe(new ItemStack(Blocks.beacon, 1), new Object[] { "GGG", "GSG", "OOO", 'G', TRepo.clearGlass, 'S', Items.nether_star, 'O', Blocks.obsidian }); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.glassPane, 16, 0), "GGG", "GGG", 'G', TRepo.clearGlass)); + + // Smeltery Components Recipes + ItemStack searedBrick = new ItemStack(TRepo.materials, 1, 2); + GameRegistry.addRecipe(new ItemStack(TRepo.smeltery, 1, 0), "bbb", "b b", "bbb", 'b', searedBrick); // Controller + GameRegistry.addRecipe(new ItemStack(TRepo.smeltery, 1, 1), "b b", "b b", "b b", 'b', searedBrick); // Drain + GameRegistry.addRecipe(new ItemStack(TRepo.smeltery, 1, 2), "bb", "bb", 'b', searedBrick); // Bricks + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.lavaTank, 1, 0), patSurround, '#', searedBrick, 'm', "blockGlass")); // Tank + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.lavaTank, 1, 1), "bgb", "ggg", "bgb", 'b', searedBrick, 'g', "blockGlass")); // Glass + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.lavaTank, 1, 2), "bgb", "bgb", "bgb", 'b', searedBrick, 'g', "blockGlass")); // Window + GameRegistry.addRecipe(new ItemStack(TRepo.searedBlock, 1, 0), "bbb", "b b", "b b", 'b', searedBrick); // Table + GameRegistry.addRecipe(new ItemStack(TRepo.searedBlock, 1, 1), "b b", " b ", 'b', searedBrick); // Faucet + GameRegistry.addRecipe(new ItemStack(TRepo.searedBlock, 1, 2), "b b", "b b", "bbb", 'b', searedBrick); // Basin + GameRegistry.addRecipe(new ItemStack(TRepo.castingChannel, 4, 0), "b b", "bbb", 'b', searedBrick); // Channel + + searedBrick = new ItemStack(TRepo.materials, 1, 37); + GameRegistry.addRecipe(new ItemStack(TRepo.smelteryNether, 1, 0), "bbb", "b b", "bbb", 'b', searedBrick); // Controller + GameRegistry.addRecipe(new ItemStack(TRepo.smelteryNether, 1, 1), "b b", "b b", "b b", 'b', searedBrick); // Drain + GameRegistry.addRecipe(new ItemStack(TRepo.smelteryNether, 1, 2), "bb", "bb", 'b', searedBrick); // Bricks + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.lavaTankNether, 1, 0), patSurround, '#', searedBrick, 'm', "blockGlass")); // Tank + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.lavaTankNether, 1, 1), "bgb", "ggg", "bgb", 'b', searedBrick, 'g', "blockGlass")); // Glass + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.lavaTankNether, 1, 2), "bgb", "bgb", "bgb", 'b', searedBrick, 'g', "blockGlass")); // Window + GameRegistry.addRecipe(new ItemStack(TRepo.searedBlockNether, 1, 0), "bbb", "b b", "b b", 'b', searedBrick); // Table + GameRegistry.addRecipe(new ItemStack(TRepo.searedBlockNether, 1, 1), "b b", " b ", 'b', searedBrick); // Faucet + GameRegistry.addRecipe(new ItemStack(TRepo.searedBlockNether, 1, 2), "b b", "b b", "bbb", 'b', searedBrick); // Basin + GameRegistry.addRecipe(new ItemStack(TRepo.castingChannel, 4, 0), "b b", "bbb", 'b', searedBrick); // Channel + + // Jack o'Latern Recipe - Stone Torch + GameRegistry.addRecipe(new ItemStack(Blocks.lit_pumpkin, 1, 0), "p", "s", 'p', new ItemStack(Blocks.pumpkin), 's', new ItemStack(TRepo.stoneTorch)); + // Stone Torch Recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.stoneTorch, 4), "p", "w", 'p', new ItemStack(Items.coal, 1, Short.MAX_VALUE), 'w', "rodStone")); + // Stone Ladder Recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.stoneLadder, 3), "w w", "www", "w w", 'w', "rodStone")); + // Wooden Rail Recipe + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.woodenRail, 4, 0), "b b", "bxb", "b b", 'b', "plankWood", 'x', "stickWood")); + // Stonesticks Recipes + GameRegistry.addRecipe(new ItemStack(TRepo.toolRod, 4, 1), "c", "c", 'c', new ItemStack(Blocks.stone)); + GameRegistry.addRecipe(new ItemStack(TRepo.toolRod, 2, 1), "c", "c", 'c', new ItemStack(Blocks.cobblestone)); + // + ItemStack aluBrass = new ItemStack(TRepo.materials, 1, 14); + // Clock Recipe - Vanilla alternativ + GameRegistry.addRecipe(new ItemStack(Items.clock), " i ", "iri", " i ", 'i', aluBrass, 'r', new ItemStack(Items.redstone)); + // Gold Pressure Plate - Vanilla alternativ + GameRegistry.addRecipe(new ItemStack(Blocks.light_weighted_pressure_plate), "ii", 'i', aluBrass); + // Accessories + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium")); + // GameRegistry.addRecipe(new ShapedOreRecipe(new + // ItemStack(TRepo.heartCanister, 1, 0), "##", "##", '#', + // "ingotNaturalAluminum")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.heartCanister, 1, 0), " # ", "#B#", " # ", '#', "ingotTin", 'B', Items.bone)); + + GameRegistry.addRecipe(new ItemStack(TRepo.diamondApple), " d ", "d#d", " d ", 'd', new ItemStack(Items.diamond), '#', new ItemStack(Items.apple)); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.heartCanister, 1, 2), new ItemStack(TRepo.diamondApple), new ItemStack(TRepo.materials, 1, 8), new ItemStack(TRepo.heartCanister, 1, 0), + new ItemStack(TRepo.heartCanister, 1, 1)); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.heartCanister, 1, 4), new ItemStack(TRepo.heartCanister, 1, 2), new ItemStack(TRepo.heartCanister, 1, 3), new ItemStack(Items.golden_apple, + 1, 1)); + //GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 6), new ItemStack(heartCanister, 1, 0), new ItemStack(heartCanister, 1, 4), new ItemStack(heartCanister, 1, 5)); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Items.leather), 'r', new ItemStack(TRepo.toughRod, 1, 2), 'm', + "ingotGold")); + GameRegistry.addRecipe(new ItemStack(TRepo.knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Items.leather), 'r', new ItemStack(TRepo.toughRod, 1, 2), 'm', aluBrass); + // Drying Rack Recipes + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.dryingRack, 1, 0), "bbb", 'b', "slabWood")); + // Landmine Recipes + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.landmine, 1, 0), "mcm", "rpr", 'm', "plankWood", 'c', new ItemStack(TRepo.blankPattern, 1, 1), 'r', Items.redstone, 'p', + Blocks.stone_pressure_plate)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.landmine, 1, 1), "mcm", "rpr", 'm', Blocks.stone, 'c', new ItemStack(TRepo.blankPattern, 1, 1), 'r', Items.redstone, 'p', + Blocks.stone_pressure_plate)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.landmine, 1, 2), "mcm", "rpr", 'm', Blocks.obsidian, 'c', new ItemStack(TRepo.blankPattern, 1, 1), 'r', Items.redstone, 'p', + Blocks.stone_pressure_plate)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.landmine, 1, 3), "mcm", "rpr", 'm', Items.repeater, 'c', new ItemStack(TRepo.blankPattern, 1, 1), 'r', Items.redstone, 'p', + Blocks.stone_pressure_plate)); + + // Ultra hardcore recipes + GameRegistry.addRecipe(new ItemStack(TRepo.goldHead), patSurround, '#', new ItemStack(Items.gold_ingot), 'm', new ItemStack(Items.skull, 1, 3)); + + // Slab Smeltery Components Recipes + for (int i = 0; i < 7; i++) + { + GameRegistry.addRecipe(new ItemStack(TRepo.speedSlab, 6, i), "bbb", 'b', new ItemStack(TRepo.speedBlock, 1, i)); + } + GameRegistry.addRecipe(new ItemStack(TRepo.searedSlab, 6, 0), "bbb", 'b', new ItemStack(TRepo.smeltery, 1, 2)); + GameRegistry.addRecipe(new ItemStack(TRepo.searedSlab, 6, 1), "bbb", 'b', new ItemStack(TRepo.smeltery, 1, 4)); + GameRegistry.addRecipe(new ItemStack(TRepo.searedSlab, 6, 2), "bbb", 'b', new ItemStack(TRepo.smeltery, 1, 5)); + GameRegistry.addRecipe(new ItemStack(TRepo.searedSlab, 6, 3), "bbb", 'b', new ItemStack(TRepo.smeltery, 1, 6)); + GameRegistry.addRecipe(new ItemStack(TRepo.searedSlab, 6, 4), "bbb", 'b', new ItemStack(TRepo.smeltery, 1, 8)); + GameRegistry.addRecipe(new ItemStack(TRepo.searedSlab, 6, 5), "bbb", 'b', new ItemStack(TRepo.smeltery, 1, 9)); + GameRegistry.addRecipe(new ItemStack(TRepo.searedSlab, 6, 6), "bbb", 'b', new ItemStack(TRepo.smeltery, 1, 10)); + GameRegistry.addRecipe(new ItemStack(TRepo.searedSlab, 6, 7), "bbb", 'b', new ItemStack(TRepo.smeltery, 1, 11)); + + // Wool Slab Recipes + for (int sc = 0; sc <= 7; sc++) + { + GameRegistry.addRecipe(new ItemStack(TRepo.woolSlab1, 6, sc), "www", 'w', new ItemStack(Blocks.wool, 1, sc)); + GameRegistry.addRecipe(new ItemStack(TRepo.woolSlab2, 6, sc), "www", 'w', new ItemStack(Blocks.wool, 1, sc + 8)); + + GameRegistry.addShapelessRecipe(new ItemStack(Blocks.wool, 1, sc), new ItemStack(TRepo.woolSlab1, 1, sc), new ItemStack(TRepo.woolSlab1, 1, sc)); + GameRegistry.addShapelessRecipe(new ItemStack(Blocks.wool, 1, sc + 8), new ItemStack(TRepo.woolSlab2, 1, sc), new ItemStack(TRepo.woolSlab2, 1, sc)); + } + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Blocks.wool, 1, 0), "slabCloth", "slabCloth")); + // Trap Recipes + GameRegistry.addRecipe(new ItemStack(TRepo.punji, 5, 0), "b b", " b ", "b b", 'b', new ItemStack(Items.reeds)); + GameRegistry.addRecipe(new ItemStack(TRepo.barricadeSpruce, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 1)); + GameRegistry.addRecipe(new ItemStack(TRepo.barricadeBirch, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 2)); + GameRegistry.addRecipe(new ItemStack(TRepo.barricadeJungle, 1, 0), "b", "b", 'b', new ItemStack(Blocks.log, 1, 3)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.barricadeOak, 1, 0), "b", "b", 'b', "logWood")); + // Advanced WorkBench Recipes + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.craftingStationWood, 1, 0), "b", 'b', "crafterWood")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.craftingStationWood, 1, 0), "b", 'b', "craftingTableWood")); + // Slab crafters + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.craftingSlabWood, 6, 0), "bbb", 'b', "crafterWood")); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.craftingSlabWood, 6, 0), "bbb", 'b', "craftingTableWood")); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 0), "b", 'b', new ItemStack(TRepo.craftingStationWood, 1, 0)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 1), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 0)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 2), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 1)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 2), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 2)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 2), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 3)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 2), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 4)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 4), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 5)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 3), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 10)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 3), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 11)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 3), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 12)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 3), "b", 'b', new ItemStack(TRepo.toolStationWood, 1, 13)); + GameRegistry.addRecipe(new ItemStack(TRepo.craftingSlabWood, 1, 5), "b", 'b', new ItemStack(TRepo.toolForge, 1, Short.MAX_VALUE)); + // EssenceExtractor Recipe + // Slime Recipes + GameRegistry.addRecipe(new ItemStack(TRepo.slimeGel, 1, 0), "##", "##", '#', TRepo.strangeFood); + GameRegistry.addRecipe(new ItemStack(TRepo.strangeFood, 4, 0), "#", '#', new ItemStack(TRepo.slimeGel, 1, 0)); + GameRegistry.addRecipe(new ItemStack(TRepo.slimeGel, 1, 1), "##", "##", '#', Items.slime_ball); + GameRegistry.addRecipe(new ItemStack(Items.slime_ball, 4, 0), "#", '#', new ItemStack(TRepo.slimeGel, 1, 1)); + // slimeExplosive + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.slimeExplosive, 1, 0), Items.slime_ball, Blocks.tnt); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.slimeExplosive, 1, 2), TRepo.strangeFood, Blocks.tnt); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TRepo.slimeExplosive, 1, 0), "slimeball", Blocks.tnt)); + + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.slimeChannel, 1, 0), new ItemStack(TRepo.slimeGel, 1, Short.MAX_VALUE), new ItemStack(Items.redstone)); + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.bloodChannel, 1, 0), new ItemStack(TRepo.strangeFood, 1, 1), new ItemStack(TRepo.strangeFood, 1, 1), + new ItemStack(TRepo.strangeFood, 1, 1), new ItemStack(TRepo.strangeFood, 1, 1), new ItemStack(Items.redstone)); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TRepo.slimeChannel, 1, 0), "slimeball", "slimeball", "slimeball", "slimeball", new ItemStack(Items.redstone))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TRepo.slimePad, 1, 0), TRepo.slimeChannel, "slimeball")); + + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TRepo.materials, 1, 41), "dustArdite", "dustCobalt")); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TRepo.materials, 4, 42), "dustAluminium", "dustCopper", "dustCopper", "dustCopper")); + + } + + protected static void addRecipesForDryingRack () + { + // Drying rack + DryingRackRecipes.addDryingRecipe(Items.beef, 20 * 60 * 5, new ItemStack(TRepo.jerky, 1, 0)); + DryingRackRecipes.addDryingRecipe(Items.chicken, 20 * 60 * 5, new ItemStack(TRepo.jerky, 1, 1)); + DryingRackRecipes.addDryingRecipe(Items.porkchop, 20 * 60 * 5, new ItemStack(TRepo.jerky, 1, 2)); + // DryingRackRecipes.addDryingRecipe(Item.muttonRaw, 20 * 60 * 5, new + // ItemStack(TRepo.jerky, 1, 3)); + DryingRackRecipes.addDryingRecipe(Items.fish, 20 * 60 * 5, new ItemStack(TRepo.jerky, 1, 4)); + DryingRackRecipes.addDryingRecipe(Items.rotten_flesh, 20 * 60 * 5, new ItemStack(TRepo.jerky, 1, 5)); + DryingRackRecipes.addDryingRecipe(new ItemStack(TRepo.strangeFood, 1, 0), 20 * 60 * 5, new ItemStack(TRepo.jerky, 1, 6)); + DryingRackRecipes.addDryingRecipe(new ItemStack(TRepo.strangeFood, 1, 1), 20 * 60 * 5, new ItemStack(TRepo.jerky, 1, 7)); + + // DryingRackRecipes.addDryingRecipe(new ItemStack(TRepo.jerky, 1, 5), + // 20 * 60 * 10, Item.leather); + } + + protected static void addRecipesForChisel () + { + /* Detailing */ + Detailing chiseling = TConstructRegistry.getChiselDetailing(); + chiseling.addDetailing(Blocks.stone, 0, Blocks.stonebrick, 0, TRepo.chisel); + chiseling.addDetailing(TRepo.speedBlock, 0, TRepo.speedBlock, 1, TRepo.chisel); + chiseling.addDetailing(TRepo.speedBlock, 2, TRepo.speedBlock, 3, TRepo.chisel); + chiseling.addDetailing(TRepo.speedBlock, 3, TRepo.speedBlock, 4, TRepo.chisel); + chiseling.addDetailing(TRepo.speedBlock, 4, TRepo.speedBlock, 5, TRepo.chisel); + chiseling.addDetailing(TRepo.speedBlock, 5, TRepo.speedBlock, 6, TRepo.chisel); + + chiseling.addDetailing(Blocks.obsidian, 0, TRepo.multiBrick, 0, TRepo.chisel); + chiseling.addDetailing(Blocks.sandstone, 0, Blocks.sandstone, 2, TRepo.chisel); + chiseling.addDetailing(Blocks.sandstone, 2, Blocks.sandstone, 1, TRepo.chisel); + chiseling.addDetailing(Blocks.sandstone, 1, TRepo.multiBrick, 1, TRepo.chisel); + // chiseling.addDetailing(Block.netherrack, 0, TRepo.multiBrick, 2, + // TRepo.chisel); + // chiseling.addDetailing(Block.stone_refined, 0, TRepo.multiBrick, 3, + // TRepo.chisel); + chiseling.addDetailing(Items.iron_ingot, 0, TRepo.multiBrick, 4, TRepo.chisel); + chiseling.addDetailing(Items.gold_ingot, 0, TRepo.multiBrick, 5, TRepo.chisel); + chiseling.addDetailing(Items.dye, 4, TRepo.multiBrick, 6, TRepo.chisel); + chiseling.addDetailing(Items.diamond, 0, TRepo.multiBrick, 7, TRepo.chisel); + chiseling.addDetailing(Items.redstone, 0, TRepo.multiBrick, 8, TRepo.chisel); + chiseling.addDetailing(Items.bone, 0, TRepo.multiBrick, 9, TRepo.chisel); + chiseling.addDetailing(Items.slime_ball, 0, TRepo.multiBrick, 10, TRepo.chisel); + chiseling.addDetailing(TRepo.strangeFood, 0, TRepo.multiBrick, 11, TRepo.chisel); + chiseling.addDetailing(Blocks.end_stone, 0, TRepo.multiBrick, 12, TRepo.chisel); + chiseling.addDetailing(TRepo.materials, 18, TRepo.multiBrick, 13, TRepo.chisel); + + // adding multiBrick / multiBrickFanxy meta 0-13 to list + for (int sc = 0; sc < 14; sc++) + { + chiseling.addDetailing(TRepo.multiBrick, sc, TRepo.multiBrickFancy, sc, TRepo.chisel); + } + + chiseling.addDetailing(Blocks.stonebrick, 0, TRepo.multiBrickFancy, 15, TRepo.chisel); + chiseling.addDetailing(TRepo.multiBrickFancy, 15, TRepo.multiBrickFancy, 14, TRepo.chisel); + chiseling.addDetailing(TRepo.multiBrickFancy, 14, Blocks.stonebrick, 3, TRepo.chisel); + /* + * chiseling.addDetailing(TRepo.multiBrick, 14, TRepo.multiBrickFancy, + * 14, TRepo.chisel); chiseling.addDetailing(TRepo.multiBrick, 15, + * TRepo.multiBrickFancy, 15, TRepo.chisel); + */ + + chiseling.addDetailing(TRepo.smeltery, 4, TRepo.smeltery, 6, TRepo.chisel); + chiseling.addDetailing(TRepo.smeltery, 6, TRepo.smeltery, 11, TRepo.chisel); + chiseling.addDetailing(TRepo.smeltery, 11, TRepo.smeltery, 2, TRepo.chisel); + chiseling.addDetailing(TRepo.smeltery, 2, TRepo.smeltery, 8, TRepo.chisel); + chiseling.addDetailing(TRepo.smeltery, 8, TRepo.smeltery, 9, TRepo.chisel); + chiseling.addDetailing(TRepo.smeltery, 9, TRepo.smeltery, 10, TRepo.chisel); + } + + public void oreRegistry () + { + OreDictionary.registerOre("oreCobalt", new ItemStack(TRepo.oreSlag, 1, 1)); + OreDictionary.registerOre("oreArdite", new ItemStack(TRepo.oreSlag, 1, 2)); + OreDictionary.registerOre("oreCopper", new ItemStack(TRepo.oreSlag, 1, 3)); + OreDictionary.registerOre("oreTin", new ItemStack(TRepo.oreSlag, 1, 4)); + OreDictionary.registerOre("oreAluminum", new ItemStack(TRepo.oreSlag, 1, 5)); + OreDictionary.registerOre("oreAluminium", new ItemStack(TRepo.oreSlag, 1, 5)); + + OreDictionary.registerOre("oreIron", new ItemStack(TRepo.oreGravel, 1, 0)); + OreDictionary.registerOre("oreGold", new ItemStack(TRepo.oreGravel, 1, 1)); + OreDictionary.registerOre("oreCobalt", new ItemStack(TRepo.oreGravel, 1, 5)); + OreDictionary.registerOre("oreCopper", new ItemStack(TRepo.oreGravel, 1, 2)); + OreDictionary.registerOre("oreTin", new ItemStack(TRepo.oreGravel, 1, 3)); + OreDictionary.registerOre("oreAluminum", new ItemStack(TRepo.oreGravel, 1, 4)); + OreDictionary.registerOre("oreAluminium", new ItemStack(TRepo.oreGravel, 1, 4)); + + OreDictionary.registerOre("ingotCobalt", new ItemStack(TRepo.materials, 1, 3)); + OreDictionary.registerOre("ingotArdite", new ItemStack(TRepo.materials, 1, 4)); + OreDictionary.registerOre("ingotManyullyn", new ItemStack(TRepo.materials, 1, 5)); + OreDictionary.registerOre("ingotCopper", new ItemStack(TRepo.materials, 1, 9)); + OreDictionary.registerOre("ingotTin", new ItemStack(TRepo.materials, 1, 10)); + OreDictionary.registerOre("ingotAluminum", new ItemStack(TRepo.materials, 1, 11)); + OreDictionary.registerOre("ingotAluminium", new ItemStack(TRepo.materials, 1, 11)); + OreDictionary.registerOre("ingotBronze", new ItemStack(TRepo.materials, 1, 13)); + OreDictionary.registerOre("ingotAluminumBrass", new ItemStack(TRepo.materials, 1, 14)); + OreDictionary.registerOre("ingotAluminiumBrass", new ItemStack(TRepo.materials, 1, 14)); + OreDictionary.registerOre("ingotAlumite", new ItemStack(TRepo.materials, 1, 15)); + OreDictionary.registerOre("ingotSteel", new ItemStack(TRepo.materials, 1, 16)); + ensureOreIsRegistered("ingotIron", new ItemStack(Items.iron_ingot)); + ensureOreIsRegistered("ingotGold", new ItemStack(Items.gold_ingot)); + OreDictionary.registerOre("ingotObsidian", new ItemStack(TRepo.materials, 1, 18)); + OreDictionary.registerOre("ingotPigIron", new ItemStack(TRepo.materials, 1, 34)); + OreDictionary.registerOre("itemRawRubber", new ItemStack(TRepo.materials, 1, 36)); + + OreDictionary.registerOre("blockCobalt", new ItemStack(TRepo.metalBlock, 1, 0)); + OreDictionary.registerOre("blockArdite", new ItemStack(TRepo.metalBlock, 1, 1)); + OreDictionary.registerOre("blockManyullyn", new ItemStack(TRepo.metalBlock, 1, 2)); + OreDictionary.registerOre("blockCopper", new ItemStack(TRepo.metalBlock, 1, 3)); + OreDictionary.registerOre("blockBronze", new ItemStack(TRepo.metalBlock, 1, 4)); + OreDictionary.registerOre("blockTin", new ItemStack(TRepo.metalBlock, 1, 5)); + OreDictionary.registerOre("blockAluminum", new ItemStack(TRepo.metalBlock, 1, 6)); + OreDictionary.registerOre("blockAluminium", new ItemStack(TRepo.metalBlock, 1, 6)); + OreDictionary.registerOre("blockAluminumBrass", new ItemStack(TRepo.metalBlock, 1, 7)); + OreDictionary.registerOre("blockAluminiumBrass", new ItemStack(TRepo.metalBlock, 1, 7)); + OreDictionary.registerOre("blockAlumite", new ItemStack(TRepo.metalBlock, 1, 8)); + OreDictionary.registerOre("blockSteel", new ItemStack(TRepo.metalBlock, 1, 9)); + OreDictionary.registerOre("blockEnder", new ItemStack(TRepo.metalBlock, 1, 10)); + ensureOreIsRegistered("blockIron", new ItemStack(Blocks.iron_block)); + ensureOreIsRegistered("blockGold", new ItemStack(Blocks.gold_block)); + + OreDictionary.registerOre("nuggetIron", new ItemStack(TRepo.materials, 1, 19)); + OreDictionary.registerOre("nuggetIron", new ItemStack(TRepo.oreBerries, 1, 0)); + OreDictionary.registerOre("nuggetCopper", new ItemStack(TRepo.materials, 1, 20)); + OreDictionary.registerOre("nuggetCopper", new ItemStack(TRepo.oreBerries, 1, 2)); + OreDictionary.registerOre("nuggetTin", new ItemStack(TRepo.materials, 1, 21)); + OreDictionary.registerOre("nuggetTin", new ItemStack(TRepo.oreBerries, 1, 3)); + OreDictionary.registerOre("nuggetAluminum", new ItemStack(TRepo.materials, 1, 22)); + OreDictionary.registerOre("nuggetAluminum", new ItemStack(TRepo.oreBerries, 1, 4)); + OreDictionary.registerOre("nuggetAluminium", new ItemStack(TRepo.materials, 1, 22)); + OreDictionary.registerOre("nuggetAluminium", new ItemStack(TRepo.oreBerries, 1, 4)); + OreDictionary.registerOre("nuggetAluminumBrass", new ItemStack(TRepo.materials, 1, 24)); + OreDictionary.registerOre("nuggetAluminiumBrass", new ItemStack(TRepo.materials, 1, 24)); + OreDictionary.registerOre("nuggetObsidian", new ItemStack(TRepo.materials, 1, 27)); + OreDictionary.registerOre("nuggetCobalt", new ItemStack(TRepo.materials, 1, 28)); + OreDictionary.registerOre("nuggetArdite", new ItemStack(TRepo.materials, 1, 29)); + OreDictionary.registerOre("nuggetManyullyn", new ItemStack(TRepo.materials, 1, 30)); + OreDictionary.registerOre("nuggetBronze", new ItemStack(TRepo.materials, 1, 31)); + OreDictionary.registerOre("nuggetAlumite", new ItemStack(TRepo.materials, 1, 32)); + OreDictionary.registerOre("nuggetSteel", new ItemStack(TRepo.materials, 1, 33)); + OreDictionary.registerOre("nuggetGold", new ItemStack(TRepo.oreBerries, 1, 1)); + ensureOreIsRegistered("nuggetGold", new ItemStack(Items.gold_nugget)); + OreDictionary.registerOre("nuggetPigIron", new ItemStack(TRepo.materials, 1, 35)); + + OreDictionary.registerOre("dustArdite", new ItemStack(TRepo.materials, 1, 38)); + OreDictionary.registerOre("dustCobalt", new ItemStack(TRepo.materials, 1, 39)); + OreDictionary.registerOre("dustAluminium", new ItemStack(TRepo.materials, 1, 40)); + OreDictionary.registerOre("dustAluminum", new ItemStack(TRepo.materials, 1, 40)); + OreDictionary.registerOre("dustManyullyn", new ItemStack(TRepo.materials, 1, 41)); + OreDictionary.registerOre("dustAluminiumBrass", new ItemStack(TRepo.materials, 1, 42)); + OreDictionary.registerOre("dustAluminumBrass", new ItemStack(TRepo.materials, 1, 42)); + + OreDictionary.registerOre("slabCloth", new ItemStack(TRepo.woolSlab1, 1, Short.MAX_VALUE)); + OreDictionary.registerOre("slabCloth", new ItemStack(TRepo.woolSlab2, 1, Short.MAX_VALUE)); + + ensureOreIsRegistered("stoneMossy", new ItemStack(Blocks.stonebrick, 1, 1)); + ensureOreIsRegistered("stoneMossy", new ItemStack(Blocks.mossy_cobblestone)); + + OreDictionary.registerOre("crafterWood", new ItemStack(Blocks.crafting_table, 1)); + OreDictionary.registerOre("craftingTableWood", new ItemStack(Blocks.crafting_table, 1)); + + OreDictionary.registerOre("torchStone", new ItemStack(TRepo.stoneTorch)); + + String[] matNames = { "Wood", "Stone", "Iron", "Flint", "Cactus", "Bone", "Obsidian", "Netherrack", "Slime", "Paper", "Cobalt", "Ardite", "Manyullyn", "Copper", "Bronze", "Alumite", "Steel", + "Blueslime" }; + for (int i = 0; i < matNames.length; i++) + { + //TODO 1.8 remove this ore dict entry as it's outdated(use materialRod instead) + OreDictionary.registerOre(matNames[i].toLowerCase() + "Rod", new ItemStack(TRepo.toolRod, 1, i)); + OreDictionary.registerOre("rod" + matNames[i], new ItemStack(TRepo.toolRod, 1, i)); + } + OreDictionary.registerOre("thaumiumRod", new ItemStack(TRepo.toolRod, 1, 31)); + + String[] glassTypes = { "GlassBlack", "GlassRed", "GlassGreen", "GlassBrown", "GlassBlue", "GlassPurple", "GlassCyan", "GlassLightGray", "GlassGray", "GlassPink", "GlassLime", "GlassYellow", + "GlassLightBlue", "GlassMagenta", "GlassOrange", "GlassWhite" }; + for (int i = 0; i < 16; i++) + { + OreDictionary.registerOre("block" + glassTypes[i], new ItemStack(TRepo.stainedGlassClear, 1, i)); + } + OreDictionary.registerOre("blockGlass", new ItemStack(TRepo.stainedGlassClear, 1, OreDictionary.WILDCARD_VALUE)); + + BlockDispenser.dispenseBehaviorRegistry.putObject(TRepo.titleIcon, new TDispenserBehaviorSpawnEgg()); + + BlockDispenser.dispenseBehaviorRegistry.putObject(TRepo.arrow, new TDispenserBehaviorArrow()); + + // Vanilla stuff + ensureOreIsRegistered("slimeball", new ItemStack(Items.slime_ball)); + OreDictionary.registerOre("slimeball", new ItemStack(TRepo.strangeFood, 1, 0)); + OreDictionary.registerOre("slimeball", new ItemStack(TRepo.strangeFood, 1, 1)); + OreDictionary.registerOre("slimeball", new ItemStack(TRepo.materials, 1, 36)); + OreDictionary.registerOre("blockGlass", new ItemStack(TRepo.clearGlass)); + OreDictionary.registerOre("blockGlassColorless", new ItemStack(TRepo.clearGlass)); + ensureOreIsRegistered("blockGlass", new ItemStack(Blocks.glass)); + ensureOreIsRegistered("blockGlassColorless", new ItemStack(Blocks.glass)); + RecipeRemover.removeShapedRecipe(new ItemStack(Blocks.sticky_piston)); + RecipeRemover.removeShapedRecipe(new ItemStack(Items.magma_cream)); + RecipeRemover.removeShapedRecipe(new ItemStack(Items.lead)); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Blocks.sticky_piston), "slimeball", Blocks.piston)); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.magma_cream), "slimeball", Items.blaze_powder)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.lead, 2), "ss ", "sS ", " s", 's', Items.string, 'S', "slimeball")); + } + + private static void ensureOreIsRegistered (String oreName, ItemStack is) + { + int oreId = OreDictionary.getOreID(is); + if (oreId == -1) + { + OreDictionary.registerOre(oreName, is); + } + } + + public void addShapedRecipeFirst (List recipeList, ItemStack itemstack, Object... objArray) + { + String var3 = ""; + int var4 = 0; + int var5 = 0; + int var6 = 0; + + if (objArray[var4] instanceof String[]) + { + String[] var7 = ((String[]) objArray[var4++]); + + for (int var8 = 0; var8 < var7.length; ++var8) + { + String var9 = var7[var8]; + ++var6; + var5 = var9.length(); + var3 = var3 + var9; + } + } + else + { + while (objArray[var4] instanceof String) + { + String var11 = (String) objArray[var4++]; + ++var6; + var5 = var11.length(); + var3 = var3 + var11; + } + } + + HashMap var12; + + for (var12 = new HashMap(); var4 < objArray.length; var4 += 2) + { + Character var13 = (Character) objArray[var4]; + ItemStack var14 = null; + + if (objArray[var4 + 1] instanceof Item) + { + var14 = new ItemStack((Item) objArray[var4 + 1]); + } + else if (objArray[var4 + 1] instanceof Block) + { + var14 = new ItemStack((Block) objArray[var4 + 1], 1, Short.MAX_VALUE); + } + else if (objArray[var4 + 1] instanceof ItemStack) + { + var14 = (ItemStack) objArray[var4 + 1]; + } + + var12.put(var13, var14); + } + + ItemStack[] var15 = new ItemStack[var5 * var6]; + + for (int var16 = 0; var16 < var5 * var6; ++var16) + { + char var10 = var3.charAt(var16); + + if (var12.containsKey(Character.valueOf(var10))) + { + var15[var16] = ((ItemStack) var12.get(Character.valueOf(var10))).copy(); + } + else + { + var15[var16] = null; + } + } + + ShapedRecipes var17 = new ShapedRecipes(var5, var6, var15, itemstack); + recipeList.add(0, var17); + } + + public void modRecipes () + { + if (!TRepo.initRecipes) + { + TRepo.initRecipes = true; + if (PHConstruct.removeVanillaToolRecipes) + { + RecipeRemover.removeAnyRecipe(new ItemStack(Items.wooden_pickaxe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.wooden_axe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.wooden_shovel)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.wooden_hoe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.wooden_sword)); + + RecipeRemover.removeAnyRecipe(new ItemStack(Items.stone_pickaxe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.stone_axe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.stone_shovel)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.stone_hoe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.stone_sword)); + + RecipeRemover.removeAnyRecipe(new ItemStack(Items.iron_pickaxe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.iron_axe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.iron_shovel)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.iron_hoe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.iron_sword)); + + RecipeRemover.removeAnyRecipe(new ItemStack(Items.diamond_pickaxe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.diamond_axe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.diamond_shovel)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.diamond_hoe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.diamond_sword)); + + RecipeRemover.removeAnyRecipe(new ItemStack(Items.golden_pickaxe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.golden_axe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.golden_shovel)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.golden_hoe)); + RecipeRemover.removeAnyRecipe(new ItemStack(Items.golden_sword)); + } + + if (PHConstruct.labotimizeVanillaTools) + { + Items.wooden_pickaxe.setMaxDamage(1); + Items.wooden_axe.setMaxDamage(1); + Items.wooden_shovel.setMaxDamage(1); + Items.wooden_hoe.setMaxDamage(1); + Items.wooden_sword.setMaxDamage(1); + + Items.stone_pickaxe.setMaxDamage(1); + Items.stone_axe.setMaxDamage(1); + Items.stone_shovel.setMaxDamage(1); + Items.stone_hoe.setMaxDamage(1); + Items.stone_sword.setMaxDamage(1); + + Items.iron_pickaxe.setMaxDamage(1); + Items.iron_axe.setMaxDamage(1); + Items.iron_shovel.setMaxDamage(1); + Items.iron_hoe.setMaxDamage(1); + Items.iron_sword.setMaxDamage(1); + + Items.diamond_pickaxe.setMaxDamage(1); + Items.diamond_axe.setMaxDamage(1); + Items.diamond_shovel.setMaxDamage(1); + Items.diamond_hoe.setMaxDamage(1); + Items.diamond_sword.setMaxDamage(1); + + Items.golden_pickaxe.setMaxDamage(1); + Items.golden_axe.setMaxDamage(1); + Items.golden_shovel.setMaxDamage(1); + Items.golden_hoe.setMaxDamage(1); + Items.golden_sword.setMaxDamage(1); + } + } + } + + private static void registerPatternMaterial (String oreName, int value, String materialName) + { + for (ItemStack ore : OreDictionary.getOres(oreName)) + { + PatternBuilder.instance.registerMaterial(ore, value, materialName); + } + } + + private static void registerIngotCasting (FluidType ft) + { + ItemStack pattern = new ItemStack(TRepo.metalPattern, 1, 0); + LiquidCasting tableCasting = TConstructRegistry.instance.getTableCasting(); + for (ItemStack ore : OreDictionary.getOres("ingot" + ft.toString())) + { + tableCasting.addCastingRecipe(pattern, new FluidStack(TRepo.moltenAlubrassFluid, TConstruct.ingotLiquidValue), new ItemStack(ore.getItem(), 1, ore.getItemDamage()), false, 50); + tableCasting.addCastingRecipe(pattern, new FluidStack(TRepo.moltenGoldFluid, TConstruct.oreLiquidValue), new ItemStack(ore.getItem(), 1, ore.getItemDamage()), false, 50); + tableCasting.addCastingRecipe(new ItemStack(ore.getItem(), 1, ore.getItemDamage()), new FluidStack(ft.fluid, TConstruct.ingotLiquidValue), pattern, 80); + } + + } + + protected static void addRecipesForBasinCasting () + { + LiquidCasting basinCasting = TConstructRegistry.getBasinCasting(); + // Block Casting + basinCasting.addCastingRecipe(new ItemStack(Blocks.iron_block), new FluidStack(TRepo.moltenIronFluid, TConstruct.blockLiquidValue), null, true, 100); // Iron + basinCasting.addCastingRecipe(new ItemStack(Blocks.gold_block), new FluidStack(TRepo.moltenGoldFluid, TConstruct.blockLiquidValue), null, true, 100); // gold + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 3), new FluidStack(TRepo.moltenCopperFluid, TConstruct.blockLiquidValue), null, true, 100); // copper + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 5), new FluidStack(TRepo.moltenTinFluid, TConstruct.blockLiquidValue), null, true, 100); // tin + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 6), new FluidStack(TRepo.moltenAluminumFluid, TConstruct.blockLiquidValue), null, true, 100); // aluminum + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 0), new FluidStack(TRepo.moltenCobaltFluid, TConstruct.blockLiquidValue), null, true, 100); // cobalt + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 1), new FluidStack(TRepo.moltenArditeFluid, TConstruct.blockLiquidValue), null, true, 100); // ardite + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 4), new FluidStack(TRepo.moltenBronzeFluid, TConstruct.blockLiquidValue), null, true, 100); // bronze + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 7), new FluidStack(TRepo.moltenAlubrassFluid, TConstruct.blockLiquidValue), null, true, 100); // albrass + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 2), new FluidStack(TRepo.moltenManyullynFluid, TConstruct.blockLiquidValue), null, true, 100); // manyullyn + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 8), new FluidStack(TRepo.moltenAlumiteFluid, TConstruct.blockLiquidValue), null, true, 100); // alumite + basinCasting.addCastingRecipe(new ItemStack(Blocks.obsidian), new FluidStack(TRepo.moltenObsidianFluid, TConstruct.oreLiquidValue), null, true, 100);// obsidian + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 9), new FluidStack(TRepo.moltenSteelFluid, TConstruct.blockLiquidValue), null, true, 100); // steel + basinCasting.addCastingRecipe(new ItemStack(TRepo.clearGlass, 1, 0), new FluidStack(TRepo.moltenGlassFluid, FluidContainerRegistry.BUCKET_VOLUME), null, true, 100); // glass + basinCasting.addCastingRecipe(new ItemStack(TRepo.smeltery, 1, 4), new FluidStack(TRepo.moltenStoneFluid, TConstruct.ingotLiquidValue), null, true, 100); // seared + // stone + basinCasting.addCastingRecipe(new ItemStack(TRepo.smeltery, 1, 5), new FluidStack(TRepo.moltenStoneFluid, TConstruct.chunkLiquidValue), new ItemStack(Blocks.cobblestone), true, 100); + basinCasting.addCastingRecipe(new ItemStack(Blocks.emerald_block), new FluidStack(TRepo.moltenEmeraldFluid, 640 * 9), null, true, 100); // emerald + basinCasting.addCastingRecipe(new ItemStack(TRepo.speedBlock, 1, 0), new FluidStack(TRepo.moltenTinFluid, TConstruct.nuggetLiquidValue), new ItemStack(Blocks.gravel), true, 100); // brownstone + if (PHConstruct.craftEndstone) + { + basinCasting.addCastingRecipe(new ItemStack(Blocks.end_stone), new FluidStack(TRepo.moltenEnderFluid, 50), new ItemStack(Blocks.obsidian), true, 100); + basinCasting.addCastingRecipe(new ItemStack(Blocks.end_stone), new FluidStack(TRepo.moltenEnderFluid, 250), new ItemStack(Blocks.sandstone), true, 100); + } + basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 10), new FluidStack(TRepo.moltenEnderFluid, 1000), null, true, 100); // ender + basinCasting.addCastingRecipe(new ItemStack(TRepo.glueBlock), new FluidStack(TRepo.glueFluid, TConstruct.blockLiquidValue), null, true, 100); // glue + + // basinCasting.addCastingRecipe(new ItemStack(slimeGel, 1, 0), new + // FluidStack(blueSlimeFluid, FluidContainerRegistry.BUCKET_VOLUME), + // null, true, 100); + + // Armor casts + /* + * FluidRenderProperties frp = new + * FluidRenderProperties(Applications.BASIN.minHeight, 0.65F, + * Applications.BASIN); FluidStack aluFlu = new + * FluidStack(TRepo.moltenAlubrassFluid, TConstruct.ingotLiquidValue * + * 10); FluidStack gloFlu = new FluidStack(TRepo.moltenGoldFluid, + * TConstruct.ingotLiquidValue * 10); ItemStack[] armor = { new + * ItemStack(helmetWood), new ItemStack(chestplateWood), new + * ItemStack(leggingsWood), new ItemStack(bootsWood) }; for (int sc = 0; + * sc < armor.length; sc++) { basinCasting.addCastingRecipe(new + * ItemStack(armorPattern, 1, sc), aluFlu, armor[sc], 50, frp); + * basinCasting.addCastingRecipe(new ItemStack(armorPattern, 1, sc), + * gloFlu, armor[sc], 50, frp); } + */ + } + + protected static void addRecipesForSmeltery () + { + // Alloy Smelting + Smeltery.addAlloyMixing(new FluidStack(TRepo.moltenBronzeFluid, (int) (TConstruct.ingotLiquidValue * PHConstruct.ingotsBronzeAlloy)), new FluidStack(TRepo.moltenCopperFluid, + TConstruct.ingotLiquidValue * 3), new FluidStack(TRepo.moltenTinFluid, TConstruct.ingotLiquidValue)); // Bronze + Smeltery.addAlloyMixing(new FluidStack(TRepo.moltenAlubrassFluid, (int) (TConstruct.ingotLiquidValue * PHConstruct.ingotsAluminumBrassAlloy)), new FluidStack(TRepo.moltenAluminumFluid, + TConstruct.ingotLiquidValue * 3), new FluidStack(TRepo.moltenCopperFluid, TConstruct.ingotLiquidValue * 1)); // Aluminum Brass + Smeltery.addAlloyMixing(new FluidStack(TRepo.moltenAlumiteFluid, (int) (TConstruct.ingotLiquidValue * PHConstruct.ingotsAlumiteAlloy)), new FluidStack(TRepo.moltenAluminumFluid, + TConstruct.ingotLiquidValue * 5), new FluidStack(TRepo.moltenIronFluid, TConstruct.ingotLiquidValue * 2), new FluidStack(TRepo.moltenObsidianFluid, TConstruct.ingotLiquidValue * 2)); // Alumite + Smeltery.addAlloyMixing(new FluidStack(TRepo.moltenManyullynFluid, (int) (TConstruct.ingotLiquidValue * PHConstruct.ingotsManyullynAlloy)), new FluidStack(TRepo.moltenCobaltFluid, + TConstruct.ingotLiquidValue), new FluidStack(TRepo.moltenArditeFluid, TConstruct.ingotLiquidValue)); // Manyullyn + Smeltery.addAlloyMixing(new FluidStack(TRepo.pigIronFluid, (int) (TConstruct.ingotLiquidValue * PHConstruct.ingotsPigironAlloy)), new FluidStack(TRepo.moltenIronFluid, + TConstruct.ingotLiquidValue), new FluidStack(TRepo.moltenEmeraldFluid, 640), new FluidStack(TRepo.bloodFluid, 80)); // Pigiron + Smeltery.addAlloyMixing(new FluidStack(TRepo.moltenObsidianFluid, TConstruct.oreLiquidValue), new FluidStack(FluidRegistry.LAVA, 1000), new FluidStack(FluidRegistry.WATER, 1000)); //Obsidian + // Stone parts + for (int sc = 0; sc < TRepo.patternOutputs.length; sc++) + { + if (TRepo.patternOutputs[sc] != null) + { + Smeltery.addMelting(FluidType.Stone, new ItemStack(TRepo.patternOutputs[sc], 1, 1), 1, + (8 * ((IPattern) TRepo.woodPattern).getPatternCost(new ItemStack(TRepo.woodPattern, 1, sc + 1))) / 2); + } + } + + // Chunks + Smeltery.addMelting(FluidType.Stone, new ItemStack(TRepo.toolShard, 1, 1), 0, 4); + Smeltery.addMelting(FluidType.Iron, new ItemStack(TRepo.toolShard, 1, 2), 0, TConstruct.chunkLiquidValue); + Smeltery.addMelting(FluidType.Obsidian, new ItemStack(TRepo.toolShard, 1, 6), 0, TConstruct.chunkLiquidValue); + Smeltery.addMelting(FluidType.Cobalt, new ItemStack(TRepo.toolShard, 1, 10), 0, TConstruct.chunkLiquidValue); + Smeltery.addMelting(FluidType.Ardite, new ItemStack(TRepo.toolShard, 1, 11), 0, TConstruct.chunkLiquidValue); + Smeltery.addMelting(FluidType.Manyullyn, new ItemStack(TRepo.toolShard, 1, 12), 0, TConstruct.chunkLiquidValue); + Smeltery.addMelting(FluidType.Copper, new ItemStack(TRepo.toolShard, 1, 13), 0, TConstruct.chunkLiquidValue); + Smeltery.addMelting(FluidType.Bronze, new ItemStack(TRepo.toolShard, 1, 14), 0, TConstruct.chunkLiquidValue); + Smeltery.addMelting(FluidType.Alumite, new ItemStack(TRepo.toolShard, 1, 15), 0, TConstruct.chunkLiquidValue); + Smeltery.addMelting(FluidType.Steel, new ItemStack(TRepo.toolShard, 1, 16), 0, TConstruct.chunkLiquidValue); + + // Items + + Smeltery.addMelting(FluidType.AluminumBrass, new ItemStack(TRepo.blankPattern, 4, 1), -50, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Gold, new ItemStack(TRepo.blankPattern, 4, 2), -50, TConstruct.ingotLiquidValue * 2); + Smeltery.addMelting(FluidType.Glue, new ItemStack(TRepo.materials, 1, 36), 0, TConstruct.ingotLiquidValue); + + Smeltery.addMelting(FluidType.Ender, new ItemStack(Items.ender_pearl, 4), 0, 250); + Smeltery.addMelting(TRepo.metalBlock, 10, 50, new FluidStack(TRepo.moltenEnderFluid, 1000)); + Smeltery.addMelting(FluidType.Water, new ItemStack(Items.snowball, 1, 0), 0, 125); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.flint_and_steel, 1, 0), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.compass, 1, 0), 0, TConstruct.ingotLiquidValue * 4); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.bucket), 0, TConstruct.ingotLiquidValue * 3); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.minecart), 0, TConstruct.ingotLiquidValue * 5); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.chest_minecart), 0, TConstruct.ingotLiquidValue * 5); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.hopper_minecart), 50, TConstruct.ingotLiquidValue * 10); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_door), 0, TConstruct.ingotLiquidValue * 6); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.cauldron), 0, TConstruct.ingotLiquidValue * 7); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.shears), 0, TConstruct.ingotLiquidValue * 2); + Smeltery.addMelting(FluidType.Emerald, new ItemStack(Items.emerald), -50, 640); + + Smeltery.addMelting(FluidType.Ardite, new ItemStack(TRepo.materials, 1, 38), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Cobalt, new ItemStack(TRepo.materials, 1, 39), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Aluminum, new ItemStack(TRepo.materials, 1, 40), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Manyullyn, new ItemStack(TRepo.materials, 1, 41), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.AluminumBrass, new ItemStack(TRepo.materials, 1, 42), 0, TConstruct.ingotLiquidValue); + + // Blocks melt as themselves! + // Ore + Smeltery.addMelting(Blocks.iron_ore, 0, 600, new FluidStack(TRepo.moltenIronFluid, TConstruct.ingotLiquidValue * 2)); + Smeltery.addMelting(Blocks.gold_ore, 0, 400, new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue * 2)); + Smeltery.addMelting(TRepo.oreGravel, 0, 600, new FluidStack(TRepo.moltenIronFluid, TConstruct.ingotLiquidValue * 2)); + Smeltery.addMelting(TRepo.oreGravel, 1, 400, new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue * 2)); + + // Blocks + Smeltery.addMelting(Blocks.iron_block, 0, 600, new FluidStack(TRepo.moltenIronFluid, TConstruct.ingotLiquidValue * 9)); + Smeltery.addMelting(Blocks.gold_block, 0, 400, new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue * 9)); + Smeltery.addMelting(Blocks.obsidian, 0, 800, new FluidStack(TRepo.moltenObsidianFluid, TConstruct.ingotLiquidValue * 2)); + Smeltery.addMelting(Blocks.ice, 0, 75, new FluidStack(FluidRegistry.getFluid("water"), 1000)); + Smeltery.addMelting(Blocks.snow, 0, 75, new FluidStack(FluidRegistry.getFluid("water"), 500)); + Smeltery.addMelting(Blocks.snow_layer, 0, 75, new FluidStack(FluidRegistry.getFluid("water"), 250)); + Smeltery.addMelting(Blocks.sand, 0, 625, new FluidStack(TRepo.moltenGlassFluid, FluidContainerRegistry.BUCKET_VOLUME)); + Smeltery.addMelting(Blocks.glass, 0, 625, new FluidStack(TRepo.moltenGlassFluid, FluidContainerRegistry.BUCKET_VOLUME)); + Smeltery.addMelting(Blocks.glass_pane, 0, 625, new FluidStack(TRepo.moltenGlassFluid, 250)); + Smeltery.addMelting(Blocks.stone, 0, 800, new FluidStack(TRepo.moltenStoneFluid, TConstruct.ingotLiquidValue / 18)); + Smeltery.addMelting(Blocks.cobblestone, 0, 800, new FluidStack(TRepo.moltenStoneFluid, TConstruct.ingotLiquidValue / 18)); + Smeltery.addMelting(Blocks.emerald_block, 0, 800, new FluidStack(TRepo.moltenEmeraldFluid, 640 * 9)); + Smeltery.addMelting(TRepo.glueBlock, 0, 250, new FluidStack(TRepo.glueFluid, TConstruct.blockLiquidValue)); + Smeltery.addMelting(TRepo.craftedSoil, 1, 600, new FluidStack(TRepo.moltenStoneFluid, TConstruct.ingotLiquidValue / 4)); + + Smeltery.addMelting(TRepo.clearGlass, 0, 500, new FluidStack(TRepo.moltenGlassFluid, 1000)); + Smeltery.addMelting(TRepo.glassPane, 0, 350, new FluidStack(TRepo.moltenGlassFluid, 250)); + + for (int i = 0; i < 16; i++) + { + Smeltery.addMelting(TRepo.stainedGlassClear, i, 500, new FluidStack(TRepo.moltenGlassFluid, 1000)); + Smeltery.addMelting(TRepo.stainedGlassClearPane, i, 350, new FluidStack(TRepo.moltenGlassFluid, 250)); + } + + // Bricks + Smeltery.addMelting(TRepo.multiBrick, 4, 600, new FluidStack(TRepo.moltenIronFluid, TConstruct.ingotLiquidValue)); + Smeltery.addMelting(TRepo.multiBrickFancy, 4, 600, new FluidStack(TRepo.moltenIronFluid, TConstruct.ingotLiquidValue)); + Smeltery.addMelting(TRepo.multiBrick, 5, 400, new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue)); + Smeltery.addMelting(TRepo.multiBrickFancy, 5, 400, new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue)); + Smeltery.addMelting(TRepo.multiBrick, 0, 800, new FluidStack(TRepo.moltenObsidianFluid, TConstruct.ingotLiquidValue * 2)); + Smeltery.addMelting(TRepo.multiBrickFancy, 0, 800, new FluidStack(TRepo.moltenObsidianFluid, TConstruct.ingotLiquidValue * 2)); + + // Vanilla blocks + Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.iron_bars), 0, TConstruct.ingotLiquidValue * 6 / 16); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.heavy_weighted_pressure_plate), 0, TConstruct.oreLiquidValue); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Blocks.light_weighted_pressure_plate, 4), 0, TConstruct.oreLiquidValue); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.rail), 0, TConstruct.ingotLiquidValue * 6 / 16); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Blocks.golden_rail), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.detector_rail), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.activator_rail), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Obsidian, new ItemStack(Blocks.enchanting_table), 0, TConstruct.ingotLiquidValue * 4); + // Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.cauldron), + // 0, TConstruct.ingotLiquidValue * 7); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.anvil, 1, 0), 200, TConstruct.ingotLiquidValue * 31); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.anvil, 1, 1), 200, TConstruct.ingotLiquidValue * 31); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.anvil, 1, 2), 200, TConstruct.ingotLiquidValue * 31); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Blocks.hopper), 0, TConstruct.ingotLiquidValue * 5); + + // Vanilla Armor + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_helmet, 1, 0), 50, TConstruct.ingotLiquidValue * 5); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_chestplate, 1, 0), 50, TConstruct.ingotLiquidValue * 8); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_leggings, 1, 0), 50, TConstruct.ingotLiquidValue * 7); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_boots, 1, 0), 50, TConstruct.ingotLiquidValue * 4); + + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_helmet, 1, 0), 50, TConstruct.ingotLiquidValue * 5); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_chestplate, 1, 0), 50, TConstruct.ingotLiquidValue * 8); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_leggings, 1, 0), 50, TConstruct.ingotLiquidValue * 7); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_boots, 1, 0), 50, TConstruct.ingotLiquidValue * 4); + + Smeltery.addMelting(FluidType.Steel, new ItemStack(Items.chainmail_helmet, 1, 0), 25, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Steel, new ItemStack(Items.chainmail_chestplate, 1, 0), 50, TConstruct.oreLiquidValue); + Smeltery.addMelting(FluidType.Steel, new ItemStack(Items.chainmail_leggings, 1, 0), 50, TConstruct.oreLiquidValue); + Smeltery.addMelting(FluidType.Steel, new ItemStack(Items.chainmail_boots, 1, 0), 25, TConstruct.ingotLiquidValue); + + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_horse_armor, 1), 100, TConstruct.ingotLiquidValue * 8); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_horse_armor, 1), 100, TConstruct.ingotLiquidValue * 8); + + // Vanilla tools + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_hoe, 1, 0), 0, TConstruct.oreLiquidValue); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_sword, 1, 0), 0, TConstruct.oreLiquidValue); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_shovel, 1, 0), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_pickaxe, 1, 0), 0, TConstruct.ingotLiquidValue * 3); + Smeltery.addMelting(FluidType.Iron, new ItemStack(Items.iron_axe, 1, 0), 0, TConstruct.ingotLiquidValue * 3); + + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_hoe, 1, 0), 0, TConstruct.oreLiquidValue); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_sword, 1, 0), 0, TConstruct.oreLiquidValue); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_shovel, 1, 0), 0, TConstruct.ingotLiquidValue); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_pickaxe, 1, 0), 0, TConstruct.ingotLiquidValue * 3); + Smeltery.addMelting(FluidType.Gold, new ItemStack(Items.golden_axe, 1, 0), 0, TConstruct.ingotLiquidValue * 3); + } + + public void modIntegration () + { + /* Natura */ + Block taintedSoil = GameRegistry.findBlock("Natura", "soil.tainted"); + Block heatSand = GameRegistry.findBlock("Natura", "heatsand"); + if (taintedSoil != null && heatSand != null) + GameRegistry.addShapelessRecipe(new ItemStack(TRepo.craftedSoil, 2, 6), Items.nether_wart, taintedSoil, heatSand); + + ItemStack ironpick = ToolBuilder.instance.buildTool(new ItemStack(TRepo.pickaxeHead, 1, 6), new ItemStack(TRepo.toolRod, 1, 2), new ItemStack(TRepo.binding, 1, 6), ""); + /* TE3 Flux */ + ItemStack batHardened = GameRegistry.findItemStack("ThermalExpansion", "capacitorHardened", 1); + if (batHardened != null) + { + TRepo.modFlux.batteries.add(batHardened); + } + ItemStack basicCell = GameRegistry.findItemStack("ThermalExpansion", "cellBasic", 1); + if (basicCell != null) + { + TRepo.modFlux.batteries.add(basicCell); + } + if (batHardened != null) + TConstructClientRegistry.registerManualModifier("fluxmod", ironpick.copy(), (ItemStack) batHardened); + if (basicCell != null) + TConstructClientRegistry.registerManualModifier("fluxmod2", ironpick.copy(), (ItemStack) basicCell); + + /* Thaumcraft */ + Object obj = getStaticItem("itemResource", "thaumcraft.common.config.ConfigItems"); + if (obj != null) + { + TConstruct.logger.info("Thaumcraft detected. Adding thaumium tools."); + TRepo.thaumcraftAvailable = true; + TConstructClientRegistry.addMaterialRenderMapping(31, "tinker", "thaumium", true); + TConstructRegistry.addToolMaterial(31, "Thaumium", 3, 400, 700, 2, 1.3F, 0, 0f, "\u00A75", StatCollector.translateToLocal("materialtraits.thaumic")); + PatternBuilder.instance.registerFullMaterial(new ItemStack((Item) obj, 1, 2), 2, StatCollector.translateToLocal("gui.partbuilder.material.thaumium"), + new ItemStack(TRepo.toolShard, 1, 31), new ItemStack(TRepo.toolRod, 1, 31), 31); + for (int meta = 0; meta < TRepo.patternOutputs.length; meta++) + { + if (TRepo.patternOutputs[meta] != null) + TConstructRegistry.addPartMapping(TRepo.woodPattern, meta + 1, 31, new ItemStack(TRepo.patternOutputs[meta], 1, 31)); + } + + TConstructRegistry.addBowstringMaterial(1, 2, new ItemStack((Item) obj, 1, 7), new ItemStack(TRepo.bowstring, 1, 1), 1F, 1F, 0.9f); + TConstructRegistry.addBowMaterial(31, 576, 40, 1.2f); + TConstructRegistry.addArrowMaterial(31, 1.8F, 0.5F, 100F); + } + else + { + TConstruct.logger.warn("Thaumcraft not detected."); + } + + if (Loader.isModLoaded("Natura")) + { + try + { + Object plantItem = getStaticItem("plantItem", "mods.natura.common.NContent"); + TConstructRegistry.addBowstringMaterial(2, 2, new ItemStack((Item) plantItem, 1, 7), new ItemStack(TRepo.bowstring, 1, 2), 1.2F, 0.8F, 1.3f); + } + catch (Exception e) + { + } // No need to handle + } + + ItemStack ingotcast = new ItemStack(TRepo.metalPattern, 1, 0); + LiquidCasting tableCasting = TConstructRegistry.instance.getTableCasting(); + LiquidCasting basinCasting = TConstructRegistry.instance.getBasinCasting(); + + /* Thermal Expansion 3 Metals */ + ArrayList ores = OreDictionary.getOres("ingotNickel"); + if (ores.size() > 0) + { + tableCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenNickelFluid, TConstruct.ingotLiquidValue), ingotcast, 80); + } + ores = OreDictionary.getOres("ingotLead"); + if (ores.size() > 0) + { + tableCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenLeadFluid, TConstruct.ingotLiquidValue), ingotcast, 80); + } + ores = OreDictionary.getOres("ingotSilver"); + if (ores.size() > 0) + { + tableCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenSilverFluid, TConstruct.ingotLiquidValue), ingotcast, 80); + } + ores = OreDictionary.getOres("ingotPlatinum"); + if (ores.size() > 0) + { + tableCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenShinyFluid, TConstruct.ingotLiquidValue), ingotcast, 80); + } + ores = OreDictionary.getOres("ingotInvar"); + if (ores.size() > 0) + { + tableCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenInvarFluid, TConstruct.ingotLiquidValue), ingotcast, 80); + Smeltery.addAlloyMixing(new FluidStack(TRepo.moltenInvarFluid, TConstruct.ingotLiquidValue * 3), new FluidStack(TRepo.moltenIronFluid, TConstruct.ingotLiquidValue * 2), new FluidStack( + TRepo.moltenNickelFluid, TConstruct.ingotLiquidValue * 1)); // Invar + } + ores = OreDictionary.getOres("ingotElectrum"); + if (ores.size() > 0) + { + tableCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenElectrumFluid, TConstruct.ingotLiquidValue), ingotcast, 80); + Smeltery.addAlloyMixing(new FluidStack(TRepo.moltenElectrumFluid, TConstruct.ingotLiquidValue * 2), new FluidStack(TRepo.moltenGoldFluid, TConstruct.ingotLiquidValue), new FluidStack( + TRepo.moltenSilverFluid, TConstruct.ingotLiquidValue)); // Electrum + } + + ores = OreDictionary.getOres("blockNickel"); + if (ores.size() > 0) + { + basinCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenNickelFluid, TConstruct.blockLiquidValue), null, 100); + } + ores = OreDictionary.getOres("blockLead"); + if (ores.size() > 0) + { + basinCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenLeadFluid, TConstruct.blockLiquidValue), null, 100); + } + ores = OreDictionary.getOres("blockSilver"); + if (ores.size() > 0) + { + basinCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenSilverFluid, TConstruct.blockLiquidValue), null, 100); + } + ores = OreDictionary.getOres("blockPlatinum"); + if (ores.size() > 0) + { + basinCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenShinyFluid, TConstruct.blockLiquidValue), null, 100); + } + ores = OreDictionary.getOres("blockInvar"); + if (ores.size() > 0) + { + basinCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenInvarFluid, TConstruct.blockLiquidValue), null, 100); + } + ores = OreDictionary.getOres("blockElectrum"); + if (ores.size() > 0) + { + basinCasting.addCastingRecipe(ores.get(0), new FluidStack(TRepo.moltenElectrumFluid, TConstruct.blockLiquidValue), null, 100); + } + + /* Extra Utilities */ + ores = OreDictionary.getOres("compressedGravel1x"); + if (ores.size() > 0) + { + basinCasting.addCastingRecipe(new ItemStack(TRepo.speedBlock, 9), new FluidStack(TRepo.moltenElectrumFluid, TConstruct.blockLiquidValue), ores.get(0), 100); + } + ores = OreDictionary.getOres("compressedGravel2x"); // Higher won't save + // properly + if (ores.size() > 0) + { + basinCasting.addCastingRecipe(new ItemStack(TRepo.speedBlock, 81), new FluidStack(TRepo.moltenElectrumFluid, TConstruct.blockLiquidValue * 9), ores.get(0), 100); + } + + /* Rubber */ + ores = OreDictionary.getOres("itemRubber"); + if (ores.size() > 0) + { + FurnaceRecipes.smelting().func_151394_a(new ItemStack(TRepo.materials, 1, 36), ores.get(0), 0.2f); + } + } + + public Object getStaticItem (String name, String classPackage) + { + try + { + Class clazz = Class.forName(classPackage); + Field field = clazz.getDeclaredField(name); + Object ret = field.get(null); + if (ret != null && (ret instanceof ItemStack || ret instanceof Item)) + return ret; + return null; + } + catch (Exception e) + { + TConstruct.logger.warn("Could not find " + name + "from " + classPackage); + return null; + } + } + +} diff --git a/src/main/java/tconstruct/common/TRepo.java b/src/main/java/tconstruct/common/TRepo.java new file mode 100644 index 00000000..3fdc8143 --- /dev/null +++ b/src/main/java/tconstruct/common/TRepo.java @@ -0,0 +1,285 @@ +package tconstruct.common; + +import net.minecraft.block.Block; +import net.minecraft.block.Block.SoundType; +import net.minecraft.block.material.Material; +import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraftforge.common.ChestGenHooks; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import tconstruct.*; +import tconstruct.blocks.slime.*; +import tconstruct.library.tools.*; +import tconstruct.tools.modifiers.*; +import tconstruct.world.blocks.*; +import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder; + +@ObjectHolder(TConstruct.modID) +public class TRepo +{ + // Supresses console spam when iguana's tweaks remove stuff + public static boolean supressMissingToolLogs = false; + + // Patterns and other materials + public static Item blankPattern; + public static Item materials; + public static Item toolRod; + public static Item toolShard; + public static Item woodPattern; + public static Item metalPattern; + // public static Item armorPattern; + + public static Item manualBook; + public static Item buckets; + public static Item titleIcon; + + public static Item strangeFood; + public static Item diamondApple; + public static Item jerky; + // public static Item stonePattern; + // public static Item netherPattern; + + // Tools + public static ToolCore pickaxe; + public static ToolCore shovel; + public static ToolCore hatchet; + public static ToolCore broadsword; + public static ToolCore longsword; + public static ToolCore rapier; + public static ToolCore dagger; + public static ToolCore cutlass; + + public static ToolCore frypan; + public static ToolCore battlesign; + public static ToolCore chisel; + public static ToolCore mattock; + + public static ToolCore scythe; + public static ToolCore lumberaxe; + public static ToolCore cleaver; + public static ToolCore excavator; + public static ToolCore hammer; + public static ToolCore battleaxe; + + public static ToolCore shortbow; + public static ToolCore arrow; + + public static Item potionLauncher; + + // Tool parts + public static Item binding; + public static Item toughBinding; + public static Item toughRod; + public static Item largePlate; + + public static Item pickaxeHead; + public static Item shovelHead; + public static Item hatchetHead; + public static Item frypanHead; + public static Item signHead; + public static Item chiselHead; + public static Item scytheBlade; + public static Item broadAxeHead; + public static Item excavatorHead; + public static Item hammerHead; + + public static Item swordBlade; + public static Item largeSwordBlade; + public static Item knifeBlade; + + public static Item wideGuard; + public static Item handGuard; + public static Item crossbar; + public static Item fullGuard; + + public static Item bowstring; + public static Item arrowhead; + public static Item fletching; + + // Crafting blocks + public static Block toolStationWood; + public static Block toolStationStone; + public static Block toolForge; + public static Block craftingStationWood; + public static Block craftingSlabWood; + public static Block furnaceSlab; + + public static Block heldItemBlock; + public static Block battlesignBlock; + public static Block craftedSoil; + + public static Block smeltery; + public static Block lavaTank; + public static Block searedBlock; + public static Block castingChannel; + public static Block metalBlock; + public static Block tankAir; + public static Block smelteryNether; + public static Block lavaTankNether; + public static Block searedBlockNether; + + public static Block dryingRack; + + // Decoration + public static Block stoneTorch; + public static Block stoneLadder; + public static Block multiBrick; + public static Block multiBrickFancy; + + public static Block searedSlab; + public static Block speedSlab; + + public static Block meatBlock; + public static Block woolSlab1; + public static Block woolSlab2; + public static Block glueBlock; + + // Traps + public static Block landmine; + public static Block punji; + public static Block barricadeOak; + public static Block barricadeSpruce; + public static Block barricadeBirch; + public static Block barricadeJungle; + public static Block slimeExplosive; + + // InfiBlocks + public static Block speedBlock; + public static Block clearGlass; + // public static Block stainedGlass; + public static Block stainedGlassClear; + public static Block glassPane; + // public static Block stainedGlassPane; + public static Block stainedGlassClearPane; + public static Block glassMagicSlab; + public static Block stainedGlassMagicSlab; + public static Block stainedGlassClearMagicSlab; + + // Liquids + public static Material liquidMetal; + + public static Fluid moltenIronFluid; + public static Fluid moltenGoldFluid; + public static Fluid moltenCopperFluid; + public static Fluid moltenTinFluid; + public static Fluid moltenAluminumFluid; + public static Fluid moltenCobaltFluid; + public static Fluid moltenArditeFluid; + public static Fluid moltenBronzeFluid; + public static Fluid moltenAlubrassFluid; + public static Fluid moltenManyullynFluid; + public static Fluid moltenAlumiteFluid; + public static Fluid moltenObsidianFluid; + public static Fluid moltenSteelFluid; + public static Fluid moltenGlassFluid; + public static Fluid moltenStoneFluid; + public static Fluid moltenEmeraldFluid; + public static Fluid bloodFluid; + public static Fluid moltenNickelFluid; + public static Fluid moltenLeadFluid; + public static Fluid moltenSilverFluid; + public static Fluid moltenShinyFluid; + public static Fluid moltenInvarFluid; + public static Fluid moltenElectrumFluid; + public static Fluid moltenEnderFluid; + public static Fluid blueSlimeFluid; + public static Fluid pigIronFluid; + + public static Block moltenIron; + public static Block moltenGold; + public static Block moltenCopper; + public static Block moltenTin; + public static Block moltenAluminum; + public static Block moltenCobalt; + public static Block moltenArdite; + public static Block moltenBronze; + public static Block moltenAlubrass; + public static Block moltenManyullyn; + public static Block moltenAlumite; + public static Block moltenObsidian; + public static Block moltenSteel; + public static Block moltenGlass; + public static Block moltenStone; + public static Block moltenEmerald; + public static Block blood; + public static Block moltenNickel; + public static Block moltenLead; + public static Block moltenSilver; + public static Block moltenShiny; + public static Block moltenInvar; + public static Block moltenElectrum; + public static Block moltenEnder; + + // Slime + public static SoundType slimeStep; + public static Block slimePool; + public static Block slimeGel; + public static Block slimeGrass; + public static Block slimeTallGrass; + public static SlimeLeaves slimeLeaves; + public static SlimeSapling slimeSapling; + + public static Block slimeChannel; + public static Block slimePad; + public static Block bloodChannel; + + // Glue + public static Fluid glueFluid; + public static Block glueFluidBlock; + + // Ores + public static Block oreSlag; + public static Block oreGravel; + public static OreberryBush oreBerry; + public static OreberryBush oreBerrySecond; + public static Item oreBerries; + + // Tool modifiers + public static ModFlux modFlux; + public static ModLapis modLapis; + public static ModAttack modAttack; + + public static Item creativeModifier; + + // Wearables + public static Item heavyHelmet; + public static Item heavyChestplate; + public static Item heavyPants; + public static Item heavyBoots; + public static Item glove; + public static Item knapsack; + + public static Item heartCanister; + public static Item goldHead; + + // Rail-related + public static Block woodenRail; + + // Chest hooks + public static ChestGenHooks tinkerHouseChest; + public static ChestGenHooks tinkerHousePatterns; + + // Armor - basic + public static Item helmetWood; + public static Item chestplateWood; + public static Item leggingsWood; + public static Item bootsWood; + public static ArmorMaterial materialWood; + + // Armor - exosuit + public static Item exoGoggles; + public static Item exoChest; + public static Item exoPants; + public static Item exoShoes; + + public static Fluid[] fluids = new Fluid[27]; + public static Block[] fluidBlocks = new Block[26]; + + // recipe stuff + public static boolean thaumcraftAvailable; + public static boolean initRecipes; + public static Item[] patternOutputs; + public static FluidStack[] liquids; + +} diff --git a/src/main/java/tconstruct/items/tools/Battleaxe.java b/src/main/java/tconstruct/items/tools/Battleaxe.java index 32bc9fc8..707352e4 100644 --- a/src/main/java/tconstruct/items/tools/Battleaxe.java +++ b/src/main/java/tconstruct/items/tools/Battleaxe.java @@ -7,6 +7,7 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -247,56 +248,26 @@ public class Battleaxe extends HarvestTool if (!stack.hasTagCompound()) return false; - World world = player.worldObj; - final Block wood = world.getBlock(x, y, z); - NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); - final int meta = world.getBlockMetadata(x, y, z); - for (int yPos = y + 1; yPos < y + 9; yPos++) + if (player instanceof EntityPlayerMP) { - Block block = world.getBlock(x, yPos, z); - if (!(tags.getBoolean("Broken")) && block != null && block.getMaterial() == Material.wood) + EntityPlayerMP mplayer = (EntityPlayerMP)player; + World world = player.worldObj; + NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); + if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking")) { - Block localblock = world.getBlock(x, yPos, z); - int localMeta = world.getBlockMetadata(x, yPos, z); - int hlvl = block.getHarvestLevel(meta); - - if (hlvl <= tags.getInteger("HarvestLevel")) + tags.setBoolean("AOEBreaking", true); + for (int yPos = y + 1; yPos < y + 9; yPos++) { - boolean cancelHarvest = false; - for (ActiveToolMod mod : TConstructRegistry.activeModifiers) - { - if (mod.beforeBlockBreak(this, stack, x, yPos, z, player)) - cancelHarvest = true; - } - - if (!cancelHarvest) - { - if (block != null && block.getMaterial() == Material.wood) - { - localMeta = world.getBlockMetadata(x, yPos, z); - if (!player.capabilities.isCreativeMode) - { - if (block.removedByPlayer(world, player, x, yPos, z)) - { - block.onBlockDestroyedByPlayer(world, x, yPos, z, localMeta); - } - block.harvestBlock(world, player, x, yPos, z, localMeta); - block.onBlockHarvested(world, x, yPos, z, localMeta, player); - onBlockDestroyed(stack, world, block, x, yPos, z, player); - } - else - { - WorldHelper.setBlockToAir(world, x, yPos, z); - } - } - } + Block block = world.getBlock(x, yPos, z); + if (block != null && block.getMaterial() == Material.wood + && block.getPlayerRelativeBlockHardness(mplayer, world, x, yPos, z) > 0) + mplayer.theItemInWorldManager.tryHarvestBlock(x, yPos, z); + else + break; } + tags.setBoolean("AOEBreaking", false); } - else - break; } - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(wood) + (meta << 12)); return super.onBlockStartBreak(stack, x, y, z, player); } } diff --git a/src/main/java/tconstruct/items/tools/Excavator.java b/src/main/java/tconstruct/items/tools/Excavator.java index 35a7961f..cb271d2f 100644 --- a/src/main/java/tconstruct/items/tools/Excavator.java +++ b/src/main/java/tconstruct/items/tools/Excavator.java @@ -4,6 +4,7 @@ import mantle.world.WorldHelper; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -141,107 +142,54 @@ public class Excavator extends HarvestTool return false; World world = player.worldObj; - final int meta = world.getBlockMetadata(x, y, z); - Block block = world.getBlock(x, y, z); - if (!stack.hasTagCompound()) - return false; - - if (block == null) - return super.onBlockStartBreak(stack, x, y, z, player); - - float blockHardness = block.getBlockHardness(world, x, y, z); - - boolean validStart = false; - for (int iter = 0; iter < materials.length; iter++) - { - if (materials[iter] == block.getMaterial()) - { - validStart = true; - break; - } - } - MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 5.0D); - if (mop == null || !validStart) - return super.onBlockStartBreak(stack, x, y, z, player); - - int xRange = 1; - int yRange = 1; - int zRange = 1; - switch (mop.sideHit) + if (mop != null && player instanceof EntityPlayerMP) { - case 0: - case 1: - yRange = 0; - break; - case 2: - case 3: - zRange = 0; - break; - case 4: - case 5: - xRange = 0; - break; - } - NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); - for (int xPos = x - xRange; xPos <= x + xRange; xPos++) - { - for (int yPos = y - yRange; yPos <= y + yRange; yPos++) + EntityPlayerMP mplayer = (EntityPlayerMP) player; + NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); + if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking")) { - for (int zPos = z - zRange; zPos <= z + zRange; zPos++) + tags.setBoolean("AOEBreaking", true); + + int xRange = 1; + int yRange = 1; + int zRange = 1; + switch (mop.sideHit) { - if (!(tags.getBoolean("Broken"))) + case 0: + case 1: + yRange = 0; + break; + case 2: + case 3: + zRange = 0; + break; + case 4: + case 5: + xRange = 0; + break; + } + + for (int xPos = x - xRange; xPos <= x + xRange; xPos++) + { + for (int yPos = y - yRange; yPos <= y + yRange; yPos++) { - Block localblock = world.getBlock(xPos, yPos, zPos); - block = localblock; - int localMeta = world.getBlockMetadata(xPos, yPos, zPos); - int hlvl = block.getHarvestLevel(meta); - float localHardness = block == null ? Float.MAX_VALUE : block.getBlockHardness(world, xPos, yPos, zPos); - - if (hlvl <= tags.getInteger("HarvestLevel") && localHardness - 1.5 <= blockHardness) + for (int zPos = z - zRange; zPos <= z + zRange; zPos++) { - boolean cancelHarvest = false; - for (ActiveToolMod mod : TConstructRegistry.activeModifiers) + Block block = world.getBlock(xPos, yPos, zPos); + for (Material mat : this.materials) { - if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player)) - cancelHarvest = true; - } - - if (!cancelHarvest) - { - if (block != null && !(localHardness < 0)) - { - for (int iter = 0; iter < materials.length; iter++) - { - if (materials[iter] == block.getMaterial()) - { - if (!player.capabilities.isCreativeMode) - { - if (block.removedByPlayer(world, player, xPos, yPos, zPos)) - { - block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta); - } - block.harvestBlock(world, player, xPos, yPos, zPos, localMeta); - block.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player); - if (blockHardness > 0f) - onBlockDestroyed(stack, world, localblock, xPos, yPos, zPos, player); - } - else - { - WorldHelper.setBlockToAir(world, xPos, yPos, zPos); - } - } - } - } + if (block != null && mat == block.getMaterial() + && block.getPlayerRelativeBlockHardness(mplayer, world, x, yPos, z) > 0) + mplayer.theItemInWorldManager.tryHarvestBlock(xPos, yPos, zPos); } } } } + tags.setBoolean("AOEBreaking", false); } } - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); - return true; + return super.onBlockStartBreak(stack, x, y, z, player); } @Override diff --git a/src/main/java/tconstruct/items/tools/Hammer.java b/src/main/java/tconstruct/items/tools/Hammer.java index 517a22a4..83180b2c 100644 --- a/src/main/java/tconstruct/items/tools/Hammer.java +++ b/src/main/java/tconstruct/items/tools/Hammer.java @@ -7,6 +7,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -235,115 +236,54 @@ public class Hammer extends HarvestTool return false; World world = player.worldObj; - final Block block = world.getBlock(x, y, z); - final int meta = world.getBlockMetadata(x, y, z); - if (!stack.hasTagCompound()) - return false; - - if (block == null) - return super.onBlockStartBreak(stack, x, y, z, player); - - float blockHardness = block.getBlockHardness(world, x, y, z); - - boolean validStart = false; - for (int iter = 0; iter < materials.length; iter++) - { - if (materials[iter] == block.getMaterial()) - { - validStart = true; - break; - } - } - - if (block == Blocks.monster_egg) - validStart = true; - MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, player, true, 4.5D); - if (mop == null || !validStart) - return super.onBlockStartBreak(stack, x, y, z, player); - - int xRange = 1; - int yRange = 1; - int zRange = 1; - switch (mop.sideHit) + if (mop != null && player instanceof EntityPlayerMP) { - case 0: - case 1: - yRange = 0; - break; - case 2: - case 3: - zRange = 0; - break; - case 4: - case 5: - xRange = 0; - break; - } - - NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); - int toolLevel = tags.getInteger("HarvestLevel"); - for (int xPos = x - xRange; xPos <= x + xRange; xPos++) - { - for (int yPos = y - yRange; yPos <= y + yRange; yPos++) + EntityPlayerMP mplayer = (EntityPlayerMP) player; + NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); + if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking")) { - for (int zPos = z - zRange; zPos <= z + zRange; zPos++) + tags.setBoolean("AOEBreaking", true); + + int xRange = 1; + int yRange = 1; + int zRange = 1; + switch (mop.sideHit) { - if (!(tags.getBoolean("Broken"))) + case 0: + case 1: + yRange = 0; + break; + case 2: + case 3: + zRange = 0; + break; + case 4: + case 5: + xRange = 0; + break; + } + + for (int xPos = x - xRange; xPos <= x + xRange; xPos++) + { + for (int yPos = y - yRange; yPos <= y + yRange; yPos++) { - Block localBlock = world.getBlock(xPos, yPos, zPos); - int localMeta = world.getBlockMetadata(xPos, yPos, zPos); - int hlvl = -1; - if (localBlock.getHarvestTool(localMeta) != null && localBlock.getHarvestTool(localMeta).equals(this.getHarvestType())) - hlvl = localBlock.getHarvestLevel(localMeta); - float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, xPos, yPos, zPos); - - if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness) + for (int zPos = z - zRange; zPos <= z + zRange; zPos++) { - boolean cancelHarvest = false; - for (ActiveToolMod mod : TConstructRegistry.activeModifiers) + Block block = world.getBlock(xPos, yPos, zPos); + for (Material mat : this.materials) { - if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player)) - cancelHarvest = true; - } - - if (!cancelHarvest) - { - if (localBlock != null && !(localHardness < 0)) - { - for (int iter = 0; iter < materials.length; iter++) - { - if (materials[iter] == localBlock.getMaterial() || localBlock == Blocks.monster_egg) - { - if (!player.capabilities.isCreativeMode) - { - if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos)) - { - localBlock.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta); - } - localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta); - localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player); - if (blockHardness > 0f) - onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player); - world.func_147479_m(x, y, z); - } - else - { - WorldHelper.setBlockToAir(world, xPos, yPos, zPos); - world.func_147479_m(x, y, z); - } - } - } - } + if (block != null && mat == block.getMaterial() + && block.getPlayerRelativeBlockHardness(mplayer, world, x, yPos, z) > 0) + mplayer.theItemInWorldManager.tryHarvestBlock(xPos, yPos, zPos); } } } } + tags.setBoolean("AOEBreaking", false); } } - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); - return true; + return super.onBlockStartBreak(stack, x, y, z, player); } @Override diff --git a/src/main/java/tconstruct/items/tools/LumberAxe.java b/src/main/java/tconstruct/items/tools/LumberAxe.java index 92cc6b3d..99fbae10 100644 --- a/src/main/java/tconstruct/items/tools/LumberAxe.java +++ b/src/main/java/tconstruct/items/tools/LumberAxe.java @@ -5,6 +5,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -135,150 +136,81 @@ public class LumberAxe extends HarvestTool if (!stack.hasTagCompound()) return false; - World world = player.worldObj; - final Block wood = world.getBlock(x, y, z); - ; - if (wood == null) + if (player instanceof EntityPlayerMP) { - return super.onBlockStartBreak(stack, x, y, z, player); - } - if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge) - { - int height = y; - boolean foundTop = false; - do + EntityPlayerMP mplayer = (EntityPlayerMP) player; + NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); + if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking")) { - height++; - Block block = world.getBlock(x, height, z); - if (block != wood) + tags.setBoolean("AOEBreaking", true); + World world = player.worldObj; + Block block = world.getBlock(x, y, z); + if (block.isWood(world, x, y, z)) { - height--; - foundTop = true; - } - } while (!foundTop); - - int numLeaves = 0; - if (height - y < 50) - { - for (int xPos = x - 1; xPos <= x + 1; xPos++) - { - for (int yPos = height - 1; yPos <= height + 1; yPos++) + int height = y; + while (true) { - for (int zPos = z - 1; zPos <= z + 1; zPos++) + height++; + if (block != world.getBlock(x, height, z)) { - Block leaves = world.getBlock(xPos, yPos, zPos); - if (leaves != null && leaves.isLeaves(world, xPos, yPos, zPos)) - numLeaves++; + height--; + break; } } + + int numLeaves = 0; + if (height - y < 50) + { + for (int xPos = x - 1; xPos <= x + 1; xPos++) + { + for (int zPos = z - 1; zPos <= z + 1; zPos++) + { + for (int yPos = height - 1; yPos <= height + 1; yPos++) + { + Block leaf = world.getBlock(xPos, yPos, zPos); + if (leaf != null && leaf.isLeaves(world, xPos, yPos, zPos)) + numLeaves++; + } + } + } + } + + if (numLeaves > 3) + breakTree(world, x, y, z, stack, tags, block, world.getBlockMetadata(x, y, z), mplayer); + else + destroyWood(world, x, y, z, stack, tags, mplayer); } + else if (block.getMaterial() == Material.wood) + { + destroyWood(world, x, y, z, stack, tags, mplayer); + } + tags.setBoolean("AOEBreaking", false); } - - NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); - int meta = world.getBlockMetadata(x, y, z); - if (numLeaves > 3) - breakTree(world, x, y, z, stack, tags, wood, meta, player); - else - destroyWood(world, x, y, z, stack, tags, player); - - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(wood) + (meta << 12)); - } - else if (wood.getMaterial() == Material.wood) - { - NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); - int meta = world.getBlockMetadata(x, y, z); - destroyWood(world, x, y, z, stack, tags, player); - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(wood) + (meta << 12)); } return super.onBlockStartBreak(stack, x, y, z, player); } - void breakTree (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, Block bID, int meta, EntityPlayer player) + void breakTree (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, Block bID, int meta, EntityPlayerMP player) { - Block block; for (int xPos = x - 1; xPos <= x + 1; xPos++) { for (int yPos = y; yPos <= y + 1; yPos++) { for (int zPos = z - 1; zPos <= z + 1; zPos++) { - if (!(tags.getBoolean("Broken"))) + Block block = world.getBlock(xPos, yPos, zPos); + if (bID == block && world.getBlockMetadata(xPos, yPos, zPos) == meta) { - Block localblock = world.getBlock(xPos, yPos, zPos); - if (bID == localblock) - { - block = localblock; - meta = world.getBlockMetadata(xPos, yPos, zPos); - int hlvl = block.getHarvestLevel(meta); - - if (hlvl <= tags.getInteger("HarvestLevel")) - { - boolean cancelHarvest = false; - for (ActiveToolMod mod : TConstructRegistry.activeModifiers) - { - if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player)) - cancelHarvest = true; - } - - if (cancelHarvest) - { - breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player); - } - else - { - if (localblock == bID && world.getBlockMetadata(xPos, yPos, zPos) % 4 == meta % 4) - { - /* - * world.setBlock(xPos, yPos, zPos, 0, - * 0, 3); if - * (!player.capabilities.isCreativeMode) - * { - * Block.blocksList[bID].harvestBlock(world - * , player, xPos, yPos, zPos, meta); - * onBlockDestroyed(stack, world, bID, - * xPos, yPos, zPos, player); } - */ - if (!player.capabilities.isCreativeMode) - { - if (block.removedByPlayer(world, player, xPos, yPos, zPos)) - { - block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, meta); - } - block.harvestBlock(world, player, xPos, yPos, zPos, meta); - block.onBlockHarvested(world, xPos, yPos, zPos, meta, player); - onBlockDestroyed(stack, world, localblock, xPos, yPos, zPos, player); - } - else - { - WorldHelper.setBlockToAir(world, xPos, yPos, zPos); - } - breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player); - } - /* - * else { Block leaves = - * Block.blocksList[localID]; if (leaves != - * null && leaves.isLeaves(world, xPos, - * yPos, zPos)) { - * WorldHelper.setBlockToAir(world, xPos, - * yPos, zPos); if - * (!player.capabilities.isCreativeMode) { - * Block.blocksList[bID].harvestBlock(world, - * player, xPos, yPos, zPos, meta); - * onBlockDestroyed(stack, world, bID, xPos, - * yPos, zPos, player); } } } - */ - } - } - } + if (block.getPlayerRelativeBlockHardness(player, world, x, yPos, z) > 0) + player.theItemInWorldManager.tryHarvestBlock(x, yPos, z); + breakTree(world, xPos, yPos, zPos, stack, tags, bID, meta, player); } } } } } - void destroyWood (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, EntityPlayer player) + void destroyWood (World world, int x, int y, int z, ItemStack stack, NBTTagCompound tags, EntityPlayerMP player) { for (int xPos = x - 1; xPos <= x + 1; xPos++) { @@ -286,36 +218,10 @@ public class LumberAxe extends HarvestTool { for (int zPos = z - 1; zPos <= z + 1; zPos++) { - if (!(tags.getBoolean("Broken"))) - { - Block block = world.getBlock(xPos, yPos, zPos); - int meta = world.getBlockMetadata(xPos, yPos, zPos); - int hlvl = block.getHarvestLevel(meta); - - if (block != null && block.getMaterial() == Material.wood) - { - if (hlvl <= tags.getInteger("HarvestLevel")) - { - boolean cancelHarvest = false; - for (ActiveToolMod mod : TConstructRegistry.activeModifiers) - { - if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player)) - cancelHarvest = true; - } - - if (!cancelHarvest) - { - WorldHelper.setBlockToAir(world, xPos, yPos, zPos); - if (!player.capabilities.isCreativeMode) - { - // TODO harvestBlock - block.harvestBlock(world, player, xPos, yPos, zPos, meta); - onBlockDestroyed(stack, world, block, xPos, yPos, zPos, player); - } - } - } - } - } + Block block = world.getBlock(xPos, yPos, zPos); + if (block != null && block.getMaterial() == Material.wood + && block.getPlayerRelativeBlockHardness(player, world, xPos, yPos, zPos) > 0) + player.theItemInWorldManager.tryHarvestBlock(xPos, yPos, zPos); } } } diff --git a/src/main/java/tconstruct/items/tools/Scythe.java b/src/main/java/tconstruct/items/tools/Scythe.java index 171520a6..fd8a235e 100644 --- a/src/main/java/tconstruct/items/tools/Scythe.java +++ b/src/main/java/tconstruct/items/tools/Scythe.java @@ -12,6 +12,7 @@ import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -162,97 +163,40 @@ public class Scythe extends Weapon if (!stack.hasTagCompound()) return false; - World world = player.worldObj; - final Block blockB = world.getBlock(x, y, z); - final int meta = world.getBlockMetadata(x, y, z); - if (!stack.hasTagCompound()) - return false; - NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); - boolean butter = EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0; - for (int xPos = x - 1; xPos <= x + 1; xPos++) + if (player instanceof EntityPlayerMP) { - for (int yPos = y - 1; yPos <= y + 1; yPos++) + EntityPlayerMP mplayer = (EntityPlayerMP) player; + World world = player.worldObj; + NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); + if (!tags.hasKey("AOEBreaking") || !tags.getBoolean("AOEBreaking")) { - for (int zPos = z - 1; zPos <= z + 1; zPos++) + tags.setBoolean("AOEBreaking", true); + for (int xPos = x - 1; xPos <= x + 1; xPos++) { - if (!(tags.getBoolean("Broken"))) + for (int yPos = y - 1; yPos <= y + 1; yPos++) { - boolean cancelHarvest = false; - for (ActiveToolMod mod : TConstructRegistry.activeModifiers) + for (int zPos = z - 1; zPos <= z + 1; zPos++) { - if (mod.beforeBlockBreak(this, stack, xPos, yPos, zPos, player)) - cancelHarvest = true; - } - - if (!cancelHarvest) - { - Block localBlock = world.getBlock(xPos, yPos, zPos); - int localMeta = world.getBlockMetadata(xPos, yPos, zPos); - float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, xPos, yPos, zPos); - if (localBlock != null)// && (block.blockMaterial == Material.leaves || block.isLeaves(world, xPos, yPos, zPos))) + Block block = world.getBlock(xPos, yPos, zPos); + for (Material mat : this.materials) { - for (int iter = 0; iter < materials.length; iter++) - { - if (materials[iter] == localBlock.getMaterial()) - { - if (!player.capabilities.isCreativeMode) - { - if (butter && localBlock instanceof IShearable && ((IShearable) localBlock).isShearable(stack, player.worldObj, x, y, z)) - { - ArrayList drops = ((IShearable) localBlock).onSheared(stack, player.worldObj, x, y, z, - EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack)); - Random rand = new Random(); - - if (!world.isRemote) - for (ItemStack dropStack : drops) - { - float f = 0.7F; - double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(player.worldObj, (double) xPos + d, (double) yPos + d1, (double) zPos + d2, dropStack); - entityitem.delayBeforeCanPickup = 10; - player.worldObj.spawnEntityInWorld(entityitem); - } - - if (localHardness > 0f) - onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player); - player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(localBlock)], 1); - world.setBlockToAir(xPos, yPos, zPos); - } - else - { - if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos)) - { - localBlock.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta); - } - localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta); - localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player); - if (localHardness > 0f) - onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player); - } - } - else - { - world.setBlockToAir(xPos, yPos, zPos); - } - } - } + if (block != null && mat == block.getMaterial() + && block.getPlayerRelativeBlockHardness(mplayer, world, x, yPos, z) > 0) + mplayer.theItemInWorldManager.tryHarvestBlock(xPos, yPos, zPos); } } } } + tags.setBoolean("AOEBreaking", false); } } - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(blockB) + (meta << 12)); return super.onBlockStartBreak(stack, x, y, z, player); } @Override public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity) { - AxisAlignedBB box = AxisAlignedBB.getAABBPool().getAABB(entity.posX, entity.posY, entity.posZ, entity.posX + 1.0D, entity.posY + 1.0D, entity.posZ + 1.0D).expand(1.0D, 1.0D, 1.0D); + AxisAlignedBB box = AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.posX + 1.0D, entity.posY + 1.0D, entity.posZ + 1.0D).expand(1.0D, 1.0D, 1.0D); List list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, box); for (Object o : list) { diff --git a/src/main/java/tconstruct/library/armor/BehaviorDispenseArmorCopy.java b/src/main/java/tconstruct/library/armor/BehaviorDispenseArmorCopy.java index ca4f1167..1ffe5045 100644 --- a/src/main/java/tconstruct/library/armor/BehaviorDispenseArmorCopy.java +++ b/src/main/java/tconstruct/library/armor/BehaviorDispenseArmorCopy.java @@ -26,7 +26,7 @@ final class BehaviorDispenseArmorCopy extends BehaviorDefaultDispenseItem int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX(); int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY(); int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ(); - AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1)); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1)); List list = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, new IEntitySelector.ArmoredMob(par2ItemStack)); if (list.size() > 0) diff --git a/src/main/java/tconstruct/library/tools/AbilityHelper.java b/src/main/java/tconstruct/library/tools/AbilityHelper.java index ee6c2e57..ea69abca 100644 --- a/src/main/java/tconstruct/library/tools/AbilityHelper.java +++ b/src/main/java/tconstruct/library/tools/AbilityHelper.java @@ -300,7 +300,7 @@ public class AbilityHelper { EntityWolf var3 = (EntityWolf) living; - if (var3.isTamed() && player.getDisplayName().equals(var3.getOwnerName())) + if (var3.isTamed() && player.getDisplayName().equals(var3.func_152113_b())) { return; } @@ -309,14 +309,14 @@ public class AbilityHelper if (!(living instanceof EntityPlayer) || player.canAttackPlayer((EntityPlayer) living)) { List var6 = player.worldObj.getEntitiesWithinAABB(EntityWolf.class, - AxisAlignedBB.getAABBPool().getAABB(player.posX, player.posY, player.posZ, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D)); + AxisAlignedBB.getBoundingBox(player.posX, player.posY, player.posZ, player.posX + 1.0D, player.posY + 1.0D, player.posZ + 1.0D).expand(16.0D, 4.0D, 16.0D)); Iterator var4 = var6.iterator(); while (var4.hasNext()) { EntityWolf var5 = (EntityWolf) var4.next(); - if (var5.isTamed() && var5.getEntityToAttack() == null && player.getDisplayName().equals(var5.getOwnerName()) && (!par2 || !var5.isSitting())) + if (var5.isTamed() && var5.getEntityToAttack() == null && player.getDisplayName().equals(var5.func_152113_b()) && (!par2 || !var5.isSitting())) { var5.setSitting(false); var5.setTarget(living); @@ -621,7 +621,7 @@ public class AbilityHelper if (!world.isRemote && player instanceof EntityPlayer) d1 += 1.62D; double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; - Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2); + Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); float f5 = -MathHelper.cos(-f1 * 0.017453292F); diff --git a/src/main/java/tconstruct/library/tools/DualHarvestTool.java b/src/main/java/tconstruct/library/tools/DualHarvestTool.java index f6c291ed..ff15a871 100644 --- a/src/main/java/tconstruct/library/tools/DualHarvestTool.java +++ b/src/main/java/tconstruct/library/tools/DualHarvestTool.java @@ -20,44 +20,6 @@ public abstract class DualHarvestTool extends HarvestTool super(baseDamage); } - @Override - public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player) - { - NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); - World world = player.worldObj; - int meta = world.getBlockMetadata(x, y, z); - Block block = player.worldObj.getBlock(x, y, z); - if (block == null || block == Blocks.air) - return false; - int hlvl = -1; - int shlvl = -1; - if (block.getHarvestTool(meta) == null || block.getHarvestTool(meta).equals(getHarvestType())) - hlvl = block.getHarvestLevel(meta); - if (block.getHarvestTool(meta) == null || block.getHarvestTool(meta).equals(getSecondHarvestType())) - shlvl = block.getHarvestLevel(meta); - - if (hlvl <= tags.getInteger("HarvestLevel") && shlvl <= tags.getInteger("HarvestLevel2")) - { - boolean cancelHarvest = false; - for (ActiveToolMod mod : TConstructRegistry.activeModifiers) - { - if (mod.beforeBlockBreak(this, stack, x, y, z, player)) - cancelHarvest = true; - } - - return cancelHarvest; - } - else - { - if (!player.capabilities.isCreativeMode) - onBlockDestroyed(stack, world, block, x, y, z, player); - WorldHelper.setBlockToAir(world, x, y, z); - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); - return true; - } - } - @Override public float getDigSpeed (ItemStack stack, Block block, int meta) { diff --git a/src/main/java/tconstruct/library/tools/HarvestTool.java b/src/main/java/tconstruct/library/tools/HarvestTool.java index 6b265ef3..3efb07ee 100644 --- a/src/main/java/tconstruct/library/tools/HarvestTool.java +++ b/src/main/java/tconstruct/library/tools/HarvestTool.java @@ -22,96 +22,6 @@ public abstract class HarvestTool extends ToolCore super(baseDamage); } - @Override - public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player) - { - if (!stack.hasTagCompound()) - return false; - - NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); - World world = player.worldObj; - Block block = player.worldObj.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - // Block block = Block.blocksList[bID]; - if (block == null || block == Blocks.air) - return false; - int hlvl = -1; - if (!(tags.getBoolean("Broken"))) - { - Block localBlock = world.getBlock(x, y, z); - int localMeta = world.getBlockMetadata(x, y, z); - if (block.getHarvestTool(meta) != null && block.getHarvestTool(meta).equals(this.getHarvestType())) - hlvl = block.getHarvestLevel(meta); - int toolLevel = tags.getInteger("HarvestLevel"); - float blockHardness = block.getBlockHardness(world, x, y, z); - float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z); - - if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness) - { - boolean cancelHarvest = false; - for (ActiveToolMod mod : TConstructRegistry.activeModifiers) - { - if (mod.beforeBlockBreak(this, stack, x, y, z, player)) - cancelHarvest = true; - } - - if (!cancelHarvest) - { - if (localBlock != null && !(localHardness < 0)) - { - - boolean isEffective = false; - - for (int iter = 0; iter < getEffectiveMaterials().length; iter++) - { - if (getEffectiveMaterials()[iter] == localBlock.getMaterial() || localBlock == Blocks.monster_egg) - { - isEffective = true; - break; - } - } - - if (localBlock.getMaterial().isToolNotRequired()) - { - isEffective = true; - } - - if (!player.capabilities.isCreativeMode) - { - if (isEffective) - { - if (localBlock.removedByPlayer(world, player, x, y, z)) - { - localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta); - } - localBlock.harvestBlock(world, player, x, y, z, localMeta); - localBlock.onBlockHarvested(world, x, y, z, localMeta, player); - if (blockHardness > 0f) - onBlockDestroyed(stack, world, localBlock, x, y, z, player); - world.func_147479_m(x, y, z); - } - else - { - WorldHelper.setBlockToAir(world, x, y, z); - world.func_147479_m(x, y, z); - } - - } - else - { - WorldHelper.setBlockToAir(world, x, y, z); - world.func_147479_m(x, y, z); - } - } - } - } - } - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); - return true; - - } - @Override public float getDigSpeed (ItemStack stack, Block block, int meta) { diff --git a/src/main/java/tconstruct/library/tools/ToolCore.java b/src/main/java/tconstruct/library/tools/ToolCore.java index 208334de..8650d5a7 100644 --- a/src/main/java/tconstruct/library/tools/ToolCore.java +++ b/src/main/java/tconstruct/library/tools/ToolCore.java @@ -606,14 +606,28 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem @Override public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player) { - boolean cancelHarvest = false; - for (ActiveToolMod mod : TConstructRegistry.activeModifiers) - { - if (mod.beforeBlockBreak(this, stack, x, y, z, player)) - cancelHarvest = true; - } + World world = player.worldObj; + if (stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Lava") && world.isRemote) + for (int i = 0; i < 5; i++) + { + float f = (float) x + random.nextFloat(); + float f1 = (float) y + random.nextFloat(); + float f2 = (float) z + random.nextFloat(); + float f3 = 0.52F; + float f4 = random.nextFloat() * 0.6F - 0.3F; + world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); - return cancelHarvest; + world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); + + world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); + + world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); + } + return false; } @Override diff --git a/src/main/java/tconstruct/mechworks/blocks/BlockLandmine.java b/src/main/java/tconstruct/mechworks/blocks/BlockLandmine.java index 775a1783..8193391f 100644 --- a/src/main/java/tconstruct/mechworks/blocks/BlockLandmine.java +++ b/src/main/java/tconstruct/mechworks/blocks/BlockLandmine.java @@ -532,7 +532,7 @@ public class BlockLandmine extends BlockContainer protected AxisAlignedBB getSensitiveAABB (World par1World, int par2, int par3, int par4) { float f = 0.125F; - // return AxisAlignedBB.getAABBPool().getAABB((double)((float)par1 + f), + // return AxisAlignedBB.getBoundingBox((double)((float)par1 + f), // (double)par2, (double)((float)par3 + f), (double)((float)(par1 + 1) - // f), (double)par2 + 0.25D, (double)((float)(par3 + 1) - f)); @@ -559,7 +559,7 @@ public class BlockLandmine extends BlockContainer maxY = par3 + 1; maxZ = par4 + 1; } - return AxisAlignedBB.getAABBPool().getAABB(minX, minY, minZ, maxX, maxY, maxZ); + return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); } public Entity getMineTriggerer (World par1World, int par2, int par3, int par4) @@ -597,17 +597,17 @@ public class BlockLandmine extends BlockContainer if (triggerType == Sensitivity.everything) { - list = par1World.getEntitiesWithinAABBExcludingEntity((Entity) null, AxisAlignedBB.getAABBPool().getAABB(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D)); + list = par1World.getEntitiesWithinAABBExcludingEntity((Entity) null, AxisAlignedBB.getBoundingBox(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D)); } if (triggerType == Sensitivity.mobs) { - list = par1World.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getAABBPool().getAABB(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D)); + list = par1World.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D)); } if (triggerType == Sensitivity.players) { - list = par1World.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getAABBPool().getAABB(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D)); + list = par1World.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(par2 + 0D, par3 + 0D, par4 + 0D, par2 + 1D, par3 + 1D, par4 + 1D)); } if (list != null && !list.isEmpty()) diff --git a/src/main/java/tconstruct/mechworks/landmine/behavior/BehaviorShears.java b/src/main/java/tconstruct/mechworks/landmine/behavior/BehaviorShears.java index c9cef1a5..43db64dd 100644 --- a/src/main/java/tconstruct/mechworks/landmine/behavior/BehaviorShears.java +++ b/src/main/java/tconstruct/mechworks/landmine/behavior/BehaviorShears.java @@ -31,7 +31,7 @@ public class BehaviorShears extends Behavior { Random rand = ItemBlockLandmine.getRandom(); - List sheeps = par1World.getEntitiesWithinAABB(IShearable.class, AxisAlignedBB.getAABBPool().getAABB(par2 - 2, par3 - 2, par4 - 2, par2 + 2, par3 + 2, par4 + 2)); + List sheeps = par1World.getEntitiesWithinAABB(IShearable.class, AxisAlignedBB.getBoundingBox(par2 - 2, par3 - 2, par4 - 2, par2 + 2, par3 + 2, par4 + 2)); if (sheeps != null && !sheeps.isEmpty()) { diff --git a/src/main/java/tconstruct/smeltery/blocks/GlassBlockConnected.java b/src/main/java/tconstruct/smeltery/blocks/GlassBlockConnected.java index 35352802..d4ec2b7a 100644 --- a/src/main/java/tconstruct/smeltery/blocks/GlassBlockConnected.java +++ b/src/main/java/tconstruct/smeltery/blocks/GlassBlockConnected.java @@ -61,18 +61,11 @@ public class GlassBlockConnected extends MantleBlock /** * This is checked to see if the texture should connect to this block - * - * @param par2 - * x - * @param par3 - * y - * @param par4 - * z - * @param par5 - * ID this block is asking to connect to (may be 0 if there is no - * block) - * @param par6 - * Metadata of the block this block is trying to connect to + * @param par2 x + * @param par3 y + * @param par4 z + * @param par5 ID this block is asking to connect to (may be 0 if there is no block) + * @param par6 Metadata of the block this block is trying to connect to * @return true if should connect */ public boolean shouldConnectToBlock (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, Block par5, int par6) @@ -371,11 +364,11 @@ public class GlassBlockConnected extends MantleBlock } else if (isOpenUp && isOpenDown && isOpenLeft) { - return icons[13]; + return icons[14]; } else if (isOpenUp && isOpenDown && isOpenRight) { - return icons[14]; + return icons[13]; } else if (isOpenUp && isOpenLeft && isOpenRight) { @@ -395,19 +388,19 @@ public class GlassBlockConnected extends MantleBlock } else if (isOpenDown && isOpenLeft) { - return icons[9]; + return icons[10]; } else if (isOpenDown && isOpenRight) { - return icons[10]; + return icons[9]; } else if (isOpenUp && isOpenLeft) { - return icons[7]; + return icons[8]; } else if (isOpenUp && isOpenRight) { - return icons[8]; + return icons[7]; } else if (isOpenDown) { @@ -419,11 +412,11 @@ public class GlassBlockConnected extends MantleBlock } else if (isOpenLeft) { - return icons[4]; + return icons[3]; } else if (isOpenRight) { - return icons[3]; + return icons[4]; } break; case 4: @@ -535,11 +528,11 @@ public class GlassBlockConnected extends MantleBlock } else if (isOpenUp && isOpenDown && isOpenLeft) { - return icons[14]; + return icons[13]; } else if (isOpenUp && isOpenDown && isOpenRight) { - return icons[13]; + return icons[14]; } else if (isOpenUp && isOpenLeft && isOpenRight) { @@ -559,19 +552,19 @@ public class GlassBlockConnected extends MantleBlock } else if (isOpenDown && isOpenLeft) { - return icons[10]; + return icons[9]; } else if (isOpenDown && isOpenRight) { - return icons[9]; + return icons[10]; } else if (isOpenUp && isOpenLeft) { - return icons[8]; + return icons[7]; } else if (isOpenUp && isOpenRight) { - return icons[7]; + return icons[8]; } else if (isOpenDown) { @@ -583,11 +576,11 @@ public class GlassBlockConnected extends MantleBlock } else if (isOpenLeft) { - return icons[3]; + return icons[4]; } else if (isOpenRight) { - return icons[4]; + return icons[3]; } break; } @@ -618,7 +611,7 @@ public class GlassBlockConnected extends MantleBlock } else { - return AxisAlignedBB.getAABBPool().getAABB(0D, 0D, 0D, 0D, 0D, 0D); + return AxisAlignedBB.getBoundingBox(0D, 0D, 0D, 0D, 0D, 0D); } } diff --git a/src/main/java/tconstruct/smeltery/blocks/GlassPaneConnected.java b/src/main/java/tconstruct/smeltery/blocks/GlassPaneConnected.java index 05301f02..5c225538 100644 --- a/src/main/java/tconstruct/smeltery/blocks/GlassPaneConnected.java +++ b/src/main/java/tconstruct/smeltery/blocks/GlassPaneConnected.java @@ -338,11 +338,11 @@ public class GlassPaneConnected extends GlassBlockConnected } else if (isOpenUp && isOpenDown && isOpenLeft) { - return icons[13]; + return icons[14]; } else if (isOpenUp && isOpenDown && isOpenRight) { - return icons[14]; + return icons[13]; } else if (isOpenUp && isOpenLeft && isOpenRight) { @@ -362,19 +362,19 @@ public class GlassPaneConnected extends GlassBlockConnected } else if (isOpenDown && isOpenLeft) { - return icons[9]; + return icons[10]; } else if (isOpenDown && isOpenRight) { - return icons[10]; + return icons[9]; } else if (isOpenUp && isOpenLeft) { - return icons[7]; + return icons[8]; } else if (isOpenUp && isOpenRight) { - return icons[8]; + return icons[7]; } else if (isOpenDown) { @@ -386,11 +386,11 @@ public class GlassPaneConnected extends GlassBlockConnected } else if (isOpenLeft) { - return icons[4]; + return icons[3]; } else if (isOpenRight) { - return icons[3]; + return icons[4]; } break; case 4: @@ -526,19 +526,19 @@ public class GlassPaneConnected extends GlassBlockConnected } else if (isOpenDown && isOpenLeft) { - return icons[10]; + return icons[9]; } else if (isOpenDown && isOpenRight) { - return icons[9]; + return icons[10]; } else if (isOpenUp && isOpenLeft) { - return icons[8]; + return icons[7]; } else if (isOpenUp && isOpenRight) { - return icons[7]; + return icons[8]; } else if (isOpenDown) { @@ -550,11 +550,11 @@ public class GlassPaneConnected extends GlassBlockConnected } else if (isOpenLeft) { - return icons[3]; + return icons[4]; } else if (isOpenRight) { - return icons[4]; + return icons[3]; } break; } @@ -690,11 +690,6 @@ public class GlassPaneConnected extends GlassBlockConnected @Override public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { - // if(par5 == 0 || par5 == 1){ - // return par1IBlockAccess.getBlock(par2, par3, par4) != this.blockID; - // }else{ - // return true; - // } return true; } } diff --git a/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java b/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java index d044f7b8..7de39cd0 100644 --- a/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java +++ b/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java @@ -316,7 +316,7 @@ public class SearedBlock extends InventoryBlock int meta = world.getBlockMetadata(x, y, z); if (meta != 1) { - return AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 1, z + 1); + return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1); } else { @@ -348,7 +348,7 @@ public class SearedBlock extends InventoryBlock break; } - return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + xMin), (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x + xMax), (double) y + 0.625, + return AxisAlignedBB.getBoundingBox((double) ((float) x + xMin), (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x + xMax), (double) y + 0.625, (double) ((float) z + zMax)); } } diff --git a/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java b/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java index f00324ef..9eecc1f0 100644 --- a/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java @@ -308,7 +308,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci void detectEntities () { - AxisAlignedBB box = AxisAlignedBB.getAABBPool().getAABB(centerPos.x, centerPos.y, centerPos.z, centerPos.x + 1.0D, centerPos.y + 1.0D, centerPos.z + 1.0D).expand(1.0D, 0.0D, 1.0D); + AxisAlignedBB box = AxisAlignedBB.getBoundingBox(centerPos.x, centerPos.y, centerPos.z, centerPos.x + 1.0D, centerPos.y + 1.0D, centerPos.z + 1.0D).expand(1.0D, 0.0D, 1.0D); List list = worldObj.getEntitiesWithinAABB(Entity.class, box); for (Object o : list) diff --git a/src/main/java/tconstruct/tools/blocks/CraftingSlab.java b/src/main/java/tconstruct/tools/blocks/CraftingSlab.java index e30f8496..c598224e 100644 --- a/src/main/java/tconstruct/tools/blocks/CraftingSlab.java +++ b/src/main/java/tconstruct/tools/blocks/CraftingSlab.java @@ -77,9 +77,9 @@ public class CraftingSlab extends InventorySlab { int metadata = world.getBlockMetadata(x, y, z); if (metadata == 5) - return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125, + return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125, (double) z + this.maxZ); - return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ); + return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ); } @Override diff --git a/src/main/java/tconstruct/tools/blocks/ToolStationBlock.java b/src/main/java/tconstruct/tools/blocks/ToolStationBlock.java index a1167944..defb23cc 100644 --- a/src/main/java/tconstruct/tools/blocks/ToolStationBlock.java +++ b/src/main/java/tconstruct/tools/blocks/ToolStationBlock.java @@ -116,9 +116,9 @@ public class ToolStationBlock extends InventoryBlock { int metadata = world.getBlockMetadata(x, y, z); if (metadata == 5) - return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125, + return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY - 0.125, (double) z + this.maxZ); - return AxisAlignedBB.getAABBPool().getAABB((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ); + return AxisAlignedBB.getBoundingBox((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ); } @Override diff --git a/src/main/java/tconstruct/tools/entity/ArrowEntity.java b/src/main/java/tconstruct/tools/entity/ArrowEntity.java index 8e43627b..6a5ef8ab 100644 --- a/src/main/java/tconstruct/tools/entity/ArrowEntity.java +++ b/src/main/java/tconstruct/tools/entity/ArrowEntity.java @@ -103,7 +103,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa i.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); AxisAlignedBB axisalignedbb = i.getCollisionBoundingBoxFromPool(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f); - if (axisalignedbb != null && axisalignedbb.isVecInside(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ))) + if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { this.inGround = true; } @@ -143,15 +143,15 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa else { ++this.ticksInAir; - Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec31, false, true, false); - vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); + vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { - vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } Entity entity = null; diff --git a/src/main/java/tconstruct/tools/items/MaterialItem.java b/src/main/java/tconstruct/tools/items/MaterialItem.java index 0cc748bd..0b676c5f 100644 --- a/src/main/java/tconstruct/tools/items/MaterialItem.java +++ b/src/main/java/tconstruct/tools/items/MaterialItem.java @@ -32,6 +32,6 @@ public class MaterialItem extends CraftingItem static String[] craftingTextures = new String[] { "paperstack", "slimecrystal", "searedbrick", "cobaltingot", "arditeingot", "manyullyningot", "mossball", "lavacrystal", "necroticbone", "copperingot", "tiningot", "aluminumingot", "aluminumraw", "bronzeingot", "alubrassingot", "alumiteingot", "steelingot", "blueslimecrystal", "obsidianingot", "nugget_iron", "nugget_copper", "nugget_tin", "nugget_aluminum", "", "nugget_alubrass", "silkycloth", "silkyjewel", "nugget_obsidian", "nugget_cobalt", "nugget_ardite", "nugget_manyullyn", - "nugget_bronze", "nugget_alumite", "nugget_steel", "pigironingot", "nugget_pigiron", "glueball", "searedbrick_nether", "ardite_dust", "cobalt_dust", "aluminium_dust", "manyullyn_dust", + "nugget_bronze", "nugget_alumite", "nugget_steel", "pigironingot", "nugget_pigiron", "glueball", "searedbrick_nether", "ardite_dust", "cobalt_dust", "aluminum_dust", "manyullyn_dust", "alubrass_dust" }; } diff --git a/src/main/java/tconstruct/tools/modifiers/TActiveOmniMod.java b/src/main/java/tconstruct/tools/modifiers/TActiveOmniMod.java index 952a5ab3..915de89d 100644 --- a/src/main/java/tconstruct/tools/modifiers/TActiveOmniMod.java +++ b/src/main/java/tconstruct/tools/modifiers/TActiveOmniMod.java @@ -59,91 +59,6 @@ public class TActiveOmniMod extends ActiveToolMod return false; TinkerTools.modLapis.midStreamModify(stack, tool); - World world = entity.worldObj; - Block block = entity.worldObj.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - // TODO do we need the next to lines???????? - if (block == null) - return false; - - if (tags.getBoolean("Lava") && block.quantityDropped(meta, 0, random) != 0) - { - ItemStack smeltStack = new ItemStack(block.getItemDropped(meta, random, 0), block.quantityDropped(meta, 0, random), block.damageDropped(meta)); - if (smeltStack.getItem() == null) - return false; - ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(smeltStack); - if (result != null) - { - WorldHelper.setBlockToAir(world, x, y, z); - if (entity instanceof EntityPlayer && !((EntityPlayer) entity).capabilities.isCreativeMode) - tool.onBlockDestroyed(stack, world, block, x, y, z, entity); - if (!world.isRemote) - { - ItemStack spawnme = result.copy(); - if (!(result.getItem() instanceof ItemBlock) && PHConstruct.lavaFortuneInteraction) - { - int loot = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack); - if (loot > 0) - { - spawnme.stackSize *= (random.nextInt(loot + 1) + 1); - } - } - EntityItem entityitem = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, spawnme); - - entityitem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(entityitem); - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); - - int i = spawnme.stackSize; - float f = FurnaceRecipes.smelting().func_151398_b(spawnme); - int j; - - if (f == 0.0F) - { - i = 0; - } - else if (f < 1.0F) - { - j = MathHelper.floor_float((float) i * f); - - if (j < MathHelper.ceiling_float_int((float) i * f) && (float) Math.random() < (float) i * f - (float) j) - { - ++j; - } - - i = j; - } - - while (i > 0) - { - j = EntityXPOrb.getXPSplit(i); - i -= j; - entity.worldObj.spawnEntityInWorld(new EntityXPOrb(world, x, y + 0.5, z, j)); - } - } - for (int i = 0; i < 5; i++) - { - float f = (float) x + random.nextFloat(); - float f1 = (float) y + random.nextFloat(); - float f2 = (float) z + random.nextFloat(); - float f3 = 0.52F; - float f4 = random.nextFloat() * 0.6F - 0.3F; - world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); - - world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); - - world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); - - world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); - } - return true; - } - } - return false; } diff --git a/src/main/java/tconstruct/util/EnvironmentChecks.java b/src/main/java/tconstruct/util/EnvironmentChecks.java index c950f98f..96b185c6 100644 --- a/src/main/java/tconstruct/util/EnvironmentChecks.java +++ b/src/main/java/tconstruct/util/EnvironmentChecks.java @@ -31,11 +31,11 @@ public class EnvironmentChecks { List modIds = new ArrayList(); - if (Loader.isModLoaded("gregtech_addon")) + if (Loader.isModLoaded("gregtech")) { TConstruct.logger.error("Tinkers' Construct and GregTech are incompatible for the following reasons:"); TConstruct.logger.error(modCompatDetails("GregTech", true)); - modIds.add("gregtech_addon"); + modIds.add("gregtech"); incompatibilities.add("GregTech"); } diff --git a/src/main/java/tconstruct/util/TEventHandler.java b/src/main/java/tconstruct/util/TEventHandler.java new file mode 100644 index 00000000..80e468df --- /dev/null +++ b/src/main/java/tconstruct/util/TEventHandler.java @@ -0,0 +1,785 @@ +package tconstruct.util; + +import java.util.Random; + +import mantle.blocks.BlockUtils; +import mantle.world.WorldHelper; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.IBossDisplayData; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.passive.EntityCow; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSourceIndirect; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; +import net.minecraftforge.event.entity.living.LivingAttackEvent; +import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.event.entity.living.LivingDropsEvent; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.event.entity.living.LivingSpawnEvent; +import net.minecraftforge.event.entity.player.BonemealEvent; +import net.minecraftforge.event.entity.player.FillBucketEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; +import net.minecraftforge.event.world.BlockEvent.BreakEvent; +import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; +import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; +import tconstruct.common.TRepo; +import tconstruct.items.tools.FryingPan; +import tconstruct.library.ActiveToolMod; +import tconstruct.library.TConstructRegistry; +import tconstruct.library.event.PartBuilderEvent; +import tconstruct.library.event.ToolCraftEvent; +import tconstruct.library.tools.ArrowMaterial; +import tconstruct.library.tools.BowMaterial; +import tconstruct.library.tools.BowstringMaterial; +import tconstruct.library.tools.FletchingMaterial; +import tconstruct.library.tools.ToolCore; +import tconstruct.library.tools.Weapon; +import tconstruct.smeltery.blocks.LiquidMetalFinite; +import tconstruct.smeltery.blocks.TankAirBlock; +import tconstruct.util.config.PHConstruct; +import tconstruct.util.player.ArmorExtended; +import tconstruct.util.player.TPlayerStats; +import tconstruct.world.entity.BlueSlime; +import cpw.mods.fml.common.eventhandler.Event; +import cpw.mods.fml.common.eventhandler.Event.Result; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +public class TEventHandler +{ + Random random = new Random(); + + /* Crafting */ + @SubscribeEvent + public void craftTool (ToolCraftEvent.NormalTool event) + { + NBTTagCompound toolTag = event.toolTag.getCompoundTag("InfiTool"); + if (PHConstruct.denyMattock && event.tool == TRepo.mattock) + { + int head = toolTag.getInteger("Head"); + int handle = toolTag.getInteger("Handle"); + int accessory = toolTag.getInteger("Accessory"); + + if (!allowCrafting(head, handle, accessory)) + { + event.setResult(Result.DENY); + return; + } + } + + int thaum = 0; + if (toolTag.getInteger("Head") == 31) + thaum++; + if (toolTag.getInteger("Handle") == 31) + thaum++; + if (toolTag.getInteger("Accessory") == 31) + thaum++; + if (toolTag.getInteger("Extra") == 31) + thaum++; + + if ((thaum >= 3) || (!toolTag.hasKey("Accessory") && thaum >= 2)) + { + int modifiers = toolTag.getInteger("Modifiers"); + modifiers += 2; + toolTag.setInteger("Modifiers", modifiers); + } + else if (thaum >= 1) + { + int modifiers = toolTag.getInteger("Modifiers"); + modifiers += 1; + toolTag.setInteger("Modifiers", modifiers); + } + + if (event.tool == TRepo.shortbow) + { + BowMaterial top = TConstructRegistry.getBowMaterial(toolTag.getInteger("Head")); + BowMaterial bottom = TConstructRegistry.getBowMaterial(toolTag.getInteger("Accessory")); + BowstringMaterial string = (BowstringMaterial) TConstructRegistry.getCustomMaterial(toolTag.getInteger("Handle"), BowstringMaterial.class); + + if (top != null && bottom != null && string != null) + { + if (toolTag.getInteger("Handle") == 1) + { + int modifiers = toolTag.getInteger("Modifiers"); + modifiers += 1; + toolTag.setInteger("Modifiers", modifiers); + } + + int durability = (int) ((top.durability + bottom.durability) / 2 * string.durabilityModifier); + toolTag.setInteger("TotalDurability", durability); + toolTag.setInteger("BaseDurability", durability); + + int drawSpeed = (int) ((top.drawspeed + bottom.drawspeed) / 2 * string.drawspeedModifier); + toolTag.setInteger("DrawSpeed", drawSpeed); + toolTag.setInteger("BaseDrawSpeed", drawSpeed); + + float flightSpeed = (top.flightSpeedMax + bottom.flightSpeedMax) / 2f * string.flightSpeedModifier; + toolTag.setFloat("FlightSpeed", flightSpeed); + } + } + + if (event.tool == TRepo.arrow) + { + ArrowMaterial head = TConstructRegistry.getArrowMaterial(toolTag.getInteger("Head")); + ArrowMaterial shaft = TConstructRegistry.getArrowMaterial(toolTag.getInteger("Handle")); + FletchingMaterial fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(toolTag.getInteger("Accessory"), FletchingMaterial.class); + + if (head != null && shaft != null && fletching != null) + { + float mass = head.mass / 5f + shaft.mass + fletching.mass; + float shatter = (head.breakChance + shaft.breakChance + fletching.breakChance) / 4f; + float accuracy = (head.accuracy + shaft.accuracy + fletching.accuracy) / 3; + + ItemStack arrow = new ItemStack(event.tool, 4); + toolTag.setInteger("TotalDurability", 0); + toolTag.setFloat("Mass", mass); + toolTag.setFloat("BreakChance", shatter); + toolTag.setFloat("Accuracy", accuracy); + toolTag.setInteger("Unbreaking", 10); + arrow.setTagCompound(event.toolTag); + event.overrideResult(arrow); + } + } + + if (event.tool == TRepo.battlesign) + { + int modifiers = toolTag.getInteger("Modifiers"); + modifiers += 1; + toolTag.setInteger("Modifiers", modifiers); + } + } + + private boolean allowCrafting (int head, int handle, int accessory) + { + int[] nonMetals = { 0, 1, 3, 4, 5, 6, 7, 8, 9, 17 }; + for (int i = 0; i < nonMetals.length; i++) + { + if (head == nonMetals[i] || handle == nonMetals[i] || accessory == nonMetals[i]) + return false; + } + return true; + } + + @SubscribeEvent + public void craftPart (PartBuilderEvent.NormalPart event) + { + if (event.pattern.getItem() == TRepo.woodPattern && event.pattern.getItemDamage() == 23) + { + ItemStack result = craftBowString(event.material); + if (result != null) + { + event.overrideResult(new ItemStack[] { result, null }); + } + } + + if (event.pattern.getItem() == TRepo.woodPattern && event.pattern.getItemDamage() == 24) + { + ItemStack result = craftFletching(event.material); + if (result != null) + { + event.overrideResult(new ItemStack[] { result, null }); + } + } + } + + public static ItemStack craftBowString (ItemStack stack) + { + if (stack.stackSize < 3) + return null; + + BowstringMaterial mat = (BowstringMaterial) TConstructRegistry.getCustomMaterial(stack, BowstringMaterial.class); + if (mat != null) + return mat.craftingItem.copy(); + return null; + } + + public static ItemStack craftFletching (ItemStack stack) + { + if (matchesLeaves(stack)) + { + FletchingMaterial leaves = (FletchingMaterial) TConstructRegistry.getCustomMaterial(new ItemStack(Blocks.leaves), FletchingMaterial.class); + return leaves.craftingItem.copy(); + } + + FletchingMaterial mat = (FletchingMaterial) TConstructRegistry.getCustomMaterial(stack, FletchingMaterial.class); + if (mat != null) + return mat.craftingItem.copy(); + return null; + } + + public static boolean matchesLeaves (ItemStack stack) + { + if (stack != null) + { + Block block = BlockUtils.getBlockFromItemStack(stack); + if (block != null) + { + if (block.isLeaves(null, 0, 0, 0)) + return true; + } + } + return false; + } + + /* Damage */ + @SubscribeEvent + public void onHurt (LivingHurtEvent event) + { + EntityLivingBase reciever = event.entityLiving; + if (reciever instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.entityLiving; + // Cutlass + ItemStack stack = player.getCurrentEquippedItem(); + if (stack != null && player.isUsingItem()) + { + Item item = stack.getItem(); + if (item == TRepo.cutlass) + { + player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 3 * 20, 1)); + } + else if (item == TRepo.battlesign) + { + event.ammount *= 1.5; //Puts battlesign blocking at 3/4 instead of 1/2 + } + } + } + else if (reciever instanceof EntityCreeper) + { + Entity attacker = event.source.getEntity(); + if (attacker instanceof EntityLivingBase) + { + Entity target = ((EntityCreeper) reciever).getAttackTarget(); + if (target != null) + { + float d1 = reciever.getDistanceToEntity(((EntityCreeper) reciever).getAttackTarget()); + float d2 = reciever.getDistanceToEntity(attacker); + if (d2 < d1) + { + ((EntityCreeper) event.entityLiving).setAttackTarget((EntityLivingBase) event.source.getEntity()); + } + } + } + } + } + + @SubscribeEvent + public void onAttack (LivingAttackEvent event) + { + //System.out.println("Damage: "+event.ammount); + if (event.entityLiving instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.entityLiving; + //Cutlass + ItemStack stack = player.getCurrentEquippedItem(); + if (stack != null && stack.getItem() == TRepo.battlesign && player.isUsingItem()) + { + DamageSource source = event.source; + if (!source.isUnblockable() && !source.isMagicDamage() && !source.isExplosion()) + { + if (source instanceof EntityDamageSourceIndirect) + { + if (random.nextInt(3) == 0) + { + Entity attacker = source.getEntity(); + Entity projectile = ((EntityDamageSourceIndirect) source).getSourceOfDamage(); + projectile.motionX *= -1; + projectile.motionZ *= -1; + projectile.setDead(); + event.setCanceled(true); + + if (projectile.getClass() == EntityArrow.class && !player.worldObj.isRemote) + { + EntityArrow reflection = null; + if (attacker instanceof EntityLivingBase) + reflection = new EntityArrow(player.worldObj, (EntityLivingBase) attacker, 0); + else + reflection = new EntityArrow(player.worldObj, player, 0); + + Vec3 look = player.getLookVec(); + reflection.posX = projectile.posX; + reflection.posY = projectile.posY; + reflection.posZ = projectile.posZ; + reflection.motionX = (projectile.motionX + (look.xCoord * 8)) / 6; + reflection.motionY = (projectile.motionY + (look.yCoord * 8)) / 6; + reflection.motionZ = (projectile.motionZ + (look.zCoord * 8)) / 6; + reflection.damage = ((EntityArrow) projectile).damage; + player.worldObj.spawnEntityInWorld(reflection); + } + } + } + else + { + Entity attacker = source.getEntity(); + if(attacker != null) + { + attacker.attackEntityFrom(DamageSource.causeThornsDamage(player), event.ammount); + } + } + } + } + } + } + + /* Drops */ + @SubscribeEvent + public void onLivingDrop (LivingDropsEvent event) + { + if (event.entityLiving == null) + return; + + if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.source.getEntity(); + if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof FryingPan) + { + for (int i = 0; i < event.drops.size(); i++) + { + ItemStack is = event.drops.get(i).getEntityItem(); + if (FurnaceRecipes.smelting().getSmeltingResult(is) != null && FurnaceRecipes.smelting().getSmeltingResult(is).getItem() instanceof ItemFood) + { + NBTTagCompound stackCompound = is.getTagCompound(); + if (stackCompound == null) + { + stackCompound = new NBTTagCompound(); + } + stackCompound.setBoolean("frypanKill", true); + is.setTagCompound(stackCompound); + } + } + } + } + + if (random.nextInt(200) == 0 && event.entityLiving instanceof IMob && event.source.damageType.equals("player")) + { + if (event.entityLiving instanceof BlueSlime) + { + BlueSlime slime = (BlueSlime) event.entityLiving; + if (slime.getSlimeSize() < 8) + return; + } + int count = event.entityLiving instanceof EntityDragon ? 5 : 1; + for (int i = 0; i < count; i++) + { + ItemStack dropStack = new ItemStack(TRepo.heartCanister, 1, 1); + EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); + entityitem.delayBeforeCanPickup = 10; + event.drops.add(entityitem); + } + } + + if (event.entityLiving instanceof IBossDisplayData) + { + ItemStack dropStack = new ItemStack(TRepo.heartCanister, 1, 3); + EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); + entityitem.delayBeforeCanPickup = 10; + event.drops.add(entityitem); + } + + if (!event.entityLiving.isChild() && event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + + if (event.entityLiving.getClass() == EntityCow.class) + { + int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1; + + for (int iter = 0; iter < amount; ++iter) + { + addDrops(event, new ItemStack(Items.leather, 1)); + } + } + + if (event.entityLiving.getClass() == EntityChicken.class) + { + int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1; + + for (int iter = 0; iter < amount; ++iter) + { + addDrops(event, new ItemStack(Items.feather, 1)); + } + } + } + + if (event.recentlyHit) + { + if (event.entityLiving.getClass() == EntitySkeleton.class) + { + EntitySkeleton enemy = (EntitySkeleton) event.entityLiving; + + if (event.source.damageType.equals("player")) + { + EntityPlayer player = (EntityPlayer) event.source.getEntity(); + ItemStack stack = player.getCurrentEquippedItem(); + if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore) + { + int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading"); + if (stack.getItem() == TRepo.cleaver) + beheading += 2; + if (beheading > 0 && random.nextInt(100) < beheading * 10) + { + addDrops(event, new ItemStack(Items.skull, 1, enemy.getSkeletonType())); + } + } + } + if (enemy.getSkeletonType() == 1 && random.nextInt(Math.max(1, 5 - event.lootingLevel)) == 0) + { + addDrops(event, new ItemStack(TRepo.materials, 1, 8)); + } + } + + if (event.entityLiving.getClass() == EntityZombie.class) + { + EntityZombie enemy = (EntityZombie) event.entityLiving; + + if (event.source.damageType.equals("player")) + { + EntityPlayer player = (EntityPlayer) event.source.getEntity(); + ItemStack stack = player.getCurrentEquippedItem(); + + if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore) + { + int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading"); + if (stack != null && stack.hasTagCompound() && stack.getItem() == TRepo.cleaver) + beheading += 2; + if (beheading > 0 && random.nextInt(100) < beheading * 10) + { + addDrops(event, new ItemStack(Items.skull, 1, 2)); + } + } + + if (stack != null && stack.hasTagCompound() && stack.getItem() == TRepo.cleaver && random.nextInt(100) < 10) //Swap out for real beheading + { + addDrops(event, new ItemStack(Items.skull, 1, 2)); + } + + } + } + + if (event.entityLiving.getClass() == EntityCreeper.class) + { + EntityCreeper enemy = (EntityCreeper) event.entityLiving; + + if (event.source.damageType.equals("player")) + { + EntityPlayer player = (EntityPlayer) event.source.getEntity(); + ItemStack stack = player.getCurrentEquippedItem(); + if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore) + { + int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading"); + if (stack.getItem() == TRepo.cleaver) + beheading += 2; + if (beheading > 0 && random.nextInt(100) < beheading * 5) + { + addDrops(event, new ItemStack(Items.skull, 1, 4)); + } + } + } + } + } + + if (event.entityLiving.getClass() == EntityGhast.class) + { + if (PHConstruct.uhcGhastDrops) + { + for (EntityItem o : event.drops) + { + if (o.getEntityItem().getItem() == Items.ghast_tear) + { + o.setEntityItemStack(new ItemStack(Items.gold_ingot, 1)); + } + } + } + else + { + addDrops(event, new ItemStack(Items.ghast_tear, 1)); + } + } + // } + + if (event.entityLiving instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.entityLiving; + + if (PHConstruct.dropPlayerHeads) + { + ItemStack dropStack = new ItemStack(Items.skull, 1, 3); + NBTTagCompound nametag = new NBTTagCompound(); + nametag.setString("SkullOwner", player.getDisplayName()); + dropStack.setTagCompound(nametag); + addDrops(event, dropStack); + } + + else if (event.source.damageType.equals("player")) + { + EntityPlayer source = (EntityPlayer) event.source.getEntity(); + ItemStack stack = source.getCurrentEquippedItem(); + if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore) + { + int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading"); + if (stack.getItem() == TRepo.cleaver) + beheading += 2; + if (beheading > 0 && random.nextInt(100) < beheading * 50) + { + ItemStack dropStack = new ItemStack(Items.skull, 1, 3); + NBTTagCompound nametag = new NBTTagCompound(); + nametag.setString("SkullOwner", player.getDisplayName()); + dropStack.setTagCompound(nametag); + addDrops(event, dropStack); + } + } + } + } + } + + /*@SubscribeEvent + public void onLivingDeath (LivingDeathEvent event) + { + Entity cause = event.source.getSourceOfDamage(); + if (cause != null && cause instanceof EntityPlayer) + { + EntityPlayer murderer = (EntityPlayer) cause; + ItemStack stack = murderer.getHeldItem(); + if (stack != null && stack.getItem() instanceof Weapon) + { + murderer.addStat(TAchievements.achievements.get("tconstruct:enemySlayer"), 1); + } + } + }*/ + + void addDrops (LivingDropsEvent event, ItemStack dropStack) + { + EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); + entityitem.delayBeforeCanPickup = 10; + event.drops.add(entityitem); + } + + /* + * @ForgeSubscribe public void onLivingSpawn (EntityJoinWorldEvent event) { + * if (event.entity instanceof EntityXPOrb) { + * TConstruct.logger.info("Entity: " + event.entity); } } + */ + + @SubscribeEvent + public void onLivingSpawn (LivingSpawnEvent.SpecialSpawn event) + { + EntityLivingBase living = event.entityLiving; + if (living.getClass() == EntitySpider.class && random.nextInt(100) == 0) + { + EntityCreeper creeper = new EntityCreeper(living.worldObj); + spawnEntityLiving(living.posX, living.posY + 1, living.posZ, creeper, living.worldObj); + if (living.riddenByEntity != null) + creeper.mountEntity(living.riddenByEntity); + else + creeper.mountEntity(living); + + EntityXPOrb orb = new EntityXPOrb(living.worldObj, living.posX, living.posY, living.posZ, random.nextInt(20) + 20); + orb.mountEntity(creeper); + } + } + + public static void spawnEntityLiving (double x, double y, double z, EntityLiving entity, World world) + { + if (!world.isRemote) + { + entity.setPosition(x, y, z); + entity.onSpawnWithEgg((IEntityLivingData) null); + world.spawnEntityInWorld(entity); + } + } + + /* Bonemeal */ + + @SubscribeEvent + public void bonemealEvent (BonemealEvent event) + { + if (!event.world.isRemote) + { + if (event.block == TRepo.slimeSapling) + { + if (TRepo.slimeSapling.boneFertilize(event.world, event.x, event.y, event.z, event.world.rand, event.entityPlayer)) + event.setResult(Event.Result.ALLOW); + } + } + } + + /* Ore Dictionary */ + @SubscribeEvent + public void registerOre (OreRegisterEvent evt) + { + + if (evt.Name == "crystalQuartz") + { + TRepo.modAttack.addStackToMatchList(evt.Ore, 2); + } + + else if (evt.Name == "crystalCerusQuartz") + { + TRepo.modAttack.addStackToMatchList(evt.Ore, 24); + } + } + + @SubscribeEvent + public void bucketFill (FillBucketEvent evt) + { + if (evt.current.getItem() == Items.bucket && evt.target.typeOfHit == MovingObjectType.ENTITY) + { + int hitX = evt.target.blockX; + int hitY = evt.target.blockY; + int hitZ = evt.target.blockZ; + + if (evt.entityPlayer != null && !evt.entityPlayer.canPlayerEdit(hitX, hitY, hitZ, evt.target.sideHit, evt.current)) + { + return; + } + + Block bID = evt.world.getBlock(hitX, hitY, hitZ); + for (int id = 0; id < TRepo.fluidBlocks.length; id++) + { + if (bID == TRepo.fluidBlocks[id]) + { + if (evt.entityPlayer.capabilities.isCreativeMode) + { + WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ); + } + else + { + if (TRepo.fluidBlocks[id] instanceof LiquidMetalFinite) + { + WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ); + /* + * int quanta = 0; for (int posX = -1; posX <= 1; + * posX++) { for (int posZ = -1; posZ <= 1; posZ++) + * { int localID = evt.world.getBlockId(hitX + posX, + * hitY, hitZ + posZ); if (localID == bID) { quanta + * += evt.world.getBlockMetadata(hitX + posX, hitY, + * hitZ + posZ) + 1; } } } + * + * if (quanta >= 8) { while (quanta > 0) { for (int + * posX = -1; posX <= 1; posX++) { for (int posZ = + * -1; posZ <= 1; posZ++) { int localID = + * evt.world.getBlockId(hitX + posX, hitY, hitZ + + * posZ); if (localID == bID) { quanta -= 1; int + * meta = evt.world.getBlockMetadata(hitX + posX, + * hitY, hitZ + posZ); if (meta > 0) + * evt.world.setBlockMetadataWithNotify(hitX + posX, + * hitY, hitZ + posZ, meta - 1, 3); else + * evt.world.setBlockToAir(hitX + posX, hitY, hitZ + + * posZ); } } } } } + */ + } + else + { + WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ); + } + + evt.setResult(Result.ALLOW); + evt.result = new ItemStack(TRepo.buckets, 1, id); + } + } + } + } + } + + // TODO 1.7 Fix this -- for ticking stuffs in extra armor slots + + @SubscribeEvent + public void livingUpdate (LivingUpdateEvent event) + { + if (event.entityLiving instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) event.entityLiving; + TPlayerStats stats = TPlayerStats.get(player); + + if (stats != null && stats.armor != null) + { + ArmorExtended armor = stats.armor; + for (int i = 0; i < armor.getSizeInventory(); i++) + { + if (armor.getStackInSlot(i) != null) + { + armor.getStackInSlot(i).getItem().onUpdate(armor.getStackInSlot(i), player.worldObj, player, i, false); + armor.getStackInSlot(i).getItem().onArmorTick(player.worldObj, player, armor.getStackInSlot(i)); + } + } + } + } + } + + // Player interact event - prevent breaking of tank air blocks in creative + @SubscribeEvent + public void playerInteract (PlayerInteractEvent event) + { + if (event.action == Action.LEFT_CLICK_BLOCK) + { + Block block = event.entity.worldObj.getBlock(event.x, event.y, event.z); + if (block instanceof TankAirBlock) + { + event.setCanceled(true); + } + } + } + + @SubscribeEvent + public void harvestBlock (HarvestDropsEvent event) + { + if (event.harvester == null) + return; + ItemStack stack = event.harvester.getCurrentEquippedItem(); + if (stack == null || stack.getItem() == null || !(stack.getItem() instanceof ToolCore)) + return; + if (stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Lava")) + { + for (int i = 0; i < event.drops.size(); i++) + { + ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(event.drops.get(i)); + if (result != null) + event.drops.set(i, result.copy()); + } + } + } + + @SubscribeEvent + public void breakBlock (BreakEvent event) + { + ItemStack stack = event.getPlayer().getCurrentEquippedItem(); + if (stack == null || stack.getItem() == null || !(stack.getItem() instanceof ToolCore)) + return; + if (stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Broken")) + { + event.setCanceled(true); + } + else + { + for (ActiveToolMod mod : TConstructRegistry.activeModifiers) + if (mod.beforeBlockBreak((ToolCore)stack.getItem(), stack, event.x, event.y, event.z, event.getPlayer())) + event.setCanceled(true); + } + } +} diff --git a/src/main/java/tconstruct/world/MiningExplosion.java b/src/main/java/tconstruct/world/MiningExplosion.java index 62be5ab7..0632c9d8 100644 --- a/src/main/java/tconstruct/world/MiningExplosion.java +++ b/src/main/java/tconstruct/world/MiningExplosion.java @@ -103,8 +103,8 @@ public class MiningExplosion extends Explosion int l1 = MathHelper.floor_double(this.explosionY + (double) this.explosionSize + 1.0D); int i2 = MathHelper.floor_double(this.explosionZ - (double) this.explosionSize - 1.0D); int j2 = MathHelper.floor_double(this.explosionZ + (double) this.explosionSize + 1.0D); - List list = this.world.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getAABBPool().getAABB((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2)); - Vec3 vec3 = this.world.getWorldVec3Pool().getVecFromPool(this.explosionX, this.explosionY, this.explosionZ); + List list = this.world.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getBoundingBox((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2)); + Vec3 vec3 = Vec3.createVectorHelper(this.explosionX, this.explosionY, this.explosionZ); for (int k2 = 0; k2 < list.size(); ++k2) { @@ -134,7 +134,7 @@ public class MiningExplosion extends Explosion if (entity instanceof EntityPlayer) { - this.field_77288_k.put((EntityPlayer) entity, this.world.getWorldVec3Pool().getVecFromPool(d0 * d10, d1 * d10, d2 * d10)); + this.field_77288_k.put((EntityPlayer) entity, Vec3.createVectorHelper(d0 * d10, d1 * d10, d2 * d10)); } } } diff --git a/src/main/java/tconstruct/world/entity/CartEntity.java b/src/main/java/tconstruct/world/entity/CartEntity.java index f0cbfb3d..db114e3e 100644 --- a/src/main/java/tconstruct/world/entity/CartEntity.java +++ b/src/main/java/tconstruct/world/entity/CartEntity.java @@ -632,7 +632,7 @@ public class CartEntity extends Entity implements IInventory, IEntityAdditionalS par3 += 0.5D; } - return this.worldObj.getWorldVec3Pool().getVecFromPool(par1, par3, par5); + return Vec3.createVectorHelper(par1, par3, par5); } else { @@ -767,9 +767,9 @@ public class CartEntity extends Entity implements IInventory, IEntityAdditionalS { double var10 = par1Entity.posX - this.posX; double var12 = par1Entity.posZ - this.posZ; - Vec3 var14 = this.worldObj.getWorldVec3Pool().getVecFromPool(var10, 0.0D, var12).normalize(); - Vec3 var15 = this.worldObj.getWorldVec3Pool() - .getVecFromPool((double) MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F), 0.0D, (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F)) + Vec3 var14 = Vec3.createVectorHelper(var10, 0.0D, var12).normalize(); + Vec3 var15 = Vec3.createVectorHelper + ((double) MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F), 0.0D, (double) MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F)) .normalize(); double var16 = Math.abs(var14.dotProduct(var15));