aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/bop/blocks
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/bop/blocks')
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java198
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java109
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java86
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java198
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java36
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java24
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java55
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java26
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LogRainforestTree.java24
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/SaplingRainforestTree.java66
10 files changed, 822 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java
new file mode 100644
index 0000000000..3716359d7a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java
@@ -0,0 +1,198 @@
+package gtPlusPlus.xmod.bop.blocks;
+
+import gregtech.GT_Mod;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.helpers.MaterialHelper;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.core.util.minecraft.RecipeUtils;
+import gtPlusPlus.xmod.bop.blocks.pine.LeavesPineTree;
+import gtPlusPlus.xmod.bop.blocks.pine.LogPineTree;
+import gtPlusPlus.xmod.bop.blocks.pine.SaplingPineTree;
+import gtPlusPlus.xmod.bop.blocks.rainforest.LeavesRainforestTree;
+import gtPlusPlus.xmod.bop.blocks.rainforest.LogRainforestTree;
+import gtPlusPlus.xmod.bop.blocks.rainforest.SaplingRainforestTree;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class BOP_Block_Registrator {
+
+ public static Block log_Rainforest;
+ public static Block leaves_Rainforest;
+ public static Block sapling_Rainforest;
+ public static Block log_Pine;
+ public static Block leaves_Pine;
+ public static Block sapling_Pine;
+
+ //Runs Each tree Type separately
+ public static final void run(){
+ registerTree_Rainforest();
+ registerTree_Pine();
+ }
+
+
+ private static final boolean registerTree_Rainforest(){
+ log_Rainforest = new LogRainforestTree();
+ leaves_Rainforest = new LeavesRainforestTree();
+ sapling_Rainforest = new SaplingRainforestTree();
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(log_Rainforest), "logWood", true);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(leaves_Rainforest), "treeLeaves", true);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(sapling_Rainforest), "treeSapling", true);
+ return true;
+ }
+
+ private static final boolean registerTree_Pine(){
+ log_Pine = new LogPineTree();
+ leaves_Pine = new LeavesPineTree();
+ sapling_Pine = new SaplingPineTree();
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(log_Pine), "logWood", true);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(leaves_Pine), "treeLeaves", true);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(sapling_Pine), "treeSapling", true);
+ return true;
+ }
+
+ public static final void recipes() {
+ // Rainforest Oak
+ addLogRecipes(ItemUtils.getSimpleStack(log_Rainforest));
+ addSaplingRecipes(ItemUtils.getSimpleStack(sapling_Rainforest));
+ // Pine
+ addLogRecipes(ItemUtils.getSimpleStack(log_Pine));
+ addSaplingRecipes(ItemUtils.getSimpleStack(sapling_Pine));
+
+ }
+
+ public static final void addLogRecipes(final ItemStack aStack) {
+ RecipeUtils.addShapelessGregtechRecipe(new ItemStack[] {aStack}, ItemUtils.getSimpleStack(Item.getItemFromBlock(Blocks.planks), GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 4));
+ RecipeUtils.recipeBuilder(
+ CI.craftingToolSaw, null, null,
+ aStack, null, null,
+ null, null, null,
+ ItemUtils.getSimpleStack(Item.getItemFromBlock(Blocks.planks), 4));
+ GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 6L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), 80, false);
+ GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Wood, 2L), GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, new Object[] { "sLf", 'L', GT_Utility.copyAmount(1L, aStack) });
+ GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.Wood, 4L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L), 160, 8);
+
+ if (!CORE.GTNH) {
+ GT_Values.RA.addAssemblerRecipe(GT_Utility.copyAmount(1L, aStack), ItemList.Circuit_Integrated.getWithDamage(0L, 2L, new Object[0]), Materials.SeedOil.getFluid(50L), ItemList.FR_Stick.get(1L, new Object[0]), 16, 8);
+ GT_Values.RA.addAssemblerRecipe(GT_Utility.copyAmount(8L, aStack), ItemList.Circuit_Integrated.getWithDamage(0L, 8L, new Object[0]), Materials.SeedOil.getFluid(250L), ItemList.FR_Casing_Impregnated.get(1L, new Object[0]), 64, 16);
+ GT_Values.RA.addChemicalBathRecipe(GT_Utility.copyAmount(1L, aStack), Materials.Creosote.getFluid(1000L), GT_ModHandler.getModItem("Railcraft", "tile.railcraft.cube", 1L, 8), null, null, null, 16, 16);
+ }
+
+ final short aMeta = (short)aStack.getItemDamage();
+ if (aMeta == 32767) {
+ if (GT_Utility.areStacksEqual(GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(1L, aStack), false, null), new ItemStack(Items.coal, 1, 1))) {
+ addPyrolyeOvenRecipes(aStack);
+ if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) {
+ GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, aStack));
+ }
+ }
+ for (int i = 0; i < 32767; ++i) {
+ if (GT_Utility.areStacksEqual(GT_ModHandler.getSmeltingOutput(new ItemStack(aStack.getItem(), 1, i), false, null), new ItemStack(Items.coal, 1, 1))) {
+ addPyrolyeOvenRecipes(aStack);
+ if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) {
+ GT_ModHandler.removeFurnaceSmelting(new ItemStack(aStack.getItem(), 1, i));
+ }
+ }
+ final ItemStack tStack = GT_ModHandler.getRecipeOutput(new ItemStack(aStack.getItem(), 1, i));
+ if (tStack == null) {
+ if (i >= 16) {
+ break;
+ }
+ }
+ else {
+ final ItemStack tPlanks = GT_Utility.copy(tStack);
+ tPlanks.stackSize = tPlanks.stackSize * 3 / 2;
+ GT_Values.RA.addCutterRecipe(new ItemStack(aStack.getItem(), 1, i), Materials.Lubricant.getFluid(1L), GT_Utility.copy(tPlanks), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), 200, 8);
+ GT_Values.RA.addCutterRecipe(new ItemStack(aStack.getItem(), 1, i), GT_Utility.copyAmount(GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long)tStack.stackSize) : ((long)(tStack.stackSize * 5 / 4)), tStack), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L), 200, 8);
+ GT_ModHandler.addSawmillRecipe(new ItemStack(aStack.getItem(), 1, i), tPlanks, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L));
+ GT_ModHandler.removeRecipe(new ItemStack(aStack.getItem(), 1, i));
+ GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long)tStack.stackSize) : ((long)(tStack.stackSize * 5 / 4)), tStack), new Object[] { "s", "L", 'L', new ItemStack(aStack.getItem(), 1, i) });
+ GT_ModHandler.addShapelessCraftingRecipe(GT_Utility.copyAmount(tStack.stackSize / (GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 1), tStack), new Object[] { new ItemStack(aStack.getItem(), 1, i) });
+ }
+ }
+ }
+ else {
+ if (GT_Utility.areStacksEqual(GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(1L, aStack), false, null), new ItemStack(Items.coal, 1, 1))) {
+ addPyrolyeOvenRecipes(aStack);
+ if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) {
+ GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, aStack));
+ }
+ }
+ final ItemStack tStack2 = GT_ModHandler.getRecipeOutput(GT_Utility.copyAmount(1L, aStack));
+ if (tStack2 != null) {
+ final ItemStack tPlanks2 = GT_Utility.copy(tStack2);
+ tPlanks2.stackSize = tPlanks2.stackSize * 3 / 2;
+ GT_Values.RA.addCutterRecipe(GT_Utility.copyAmount(1L, aStack), Materials.Lubricant.getFluid(1L), GT_Utility.copy(tPlanks2), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L), 200, 8);
+ GT_Values.RA.addCutterRecipe(GT_Utility.copyAmount(1L, aStack), GT_Utility.copyAmount(GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long)tStack2.stackSize) : ((long)(tStack2.stackSize * 5 / 4)), tStack2), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 2L), 200, 8);
+ GT_ModHandler.addSawmillRecipe(GT_Utility.copyAmount(1L, aStack), tPlanks2, GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 1L));
+ GT_ModHandler.removeRecipe(GT_Utility.copyAmount(1L, aStack));
+ GT_ModHandler.addCraftingRecipe(GT_Utility.copyAmount(GT_Mod.gregtechproxy.mNerfedWoodPlank ? ((long)tStack2.stackSize) : ((long)(tStack2.stackSize * 5 / 4)), tStack2), new Object[] { "s", "L", 'L', GT_Utility.copyAmount(1L, aStack) });
+ GT_ModHandler.addShapelessCraftingRecipe(GT_Utility.copyAmount(tStack2.stackSize / (GT_Mod.gregtechproxy.mNerfedWoodPlank ? 2 : 1), tStack2), new Object[] { GT_Utility.copyAmount(1L, aStack) });
+ }
+ }
+ if (GT_Utility.areStacksEqual(GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(1L, aStack), false, null), new ItemStack(Items.coal, 1, 1))) {
+ addPyrolyeOvenRecipes(aStack);
+ if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.disabledrecipes, "wood2charcoalsmelting", true)) {
+ GT_ModHandler.removeFurnaceSmelting(GT_Utility.copyAmount(1L, aStack));
+ }
+ }
+ }
+
+ public static void addSaplingRecipes(final ItemStack aStack) {
+ GT_ModHandler.addPulverisationRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Wood, 2L), null, 0, false);
+ GT_ModHandler.addCompressionRecipe(GT_Utility.copyAmount(8L, aStack), ItemList.IC2_Plantball.get(1L, new Object[0]));
+ GT_Values.RA.addLatheRecipe(GT_Utility.copyAmount(1L, aStack), GT_OreDictUnificator.get(OrePrefixes.stick, Materials.Wood, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.Wood, 1L), 16, 8);
+ }
+
+ public static void addPyrolyeOvenRecipes(final ItemStack logStack) {
+
+ Materials aOilHeavy = MaterialUtils.getMaterial("OilHeavy");
+ Materials aCharcoalByproducts = MaterialUtils.getMaterial("CharcoalByproducts");
+ Materials aWoodGas = MaterialUtils.getMaterial("WoodGas");
+ Materials aWoodVinegar = MaterialUtils.getMaterial("WoodVinegar");
+ Materials aWoodTar = MaterialUtils.getMaterial("WoodTar");
+
+
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 1, MaterialHelper.getGems(Materials.Charcoal, 20), Materials.Creosote.getFluid(4000L), 640, 64);
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 2, MaterialHelper.getGems(Materials.Charcoal, 20), Materials.Creosote.getFluid(4000L), 320, 96);
+
+ if (aOilHeavy != null) {
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 3, MaterialHelper.getDust(Materials.Ash, 4), aOilHeavy.getFluid(200L), 320, 192);
+
+ }
+ if (aCharcoalByproducts != null) {
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 3, MaterialHelper.getGems(Materials.Charcoal, 20), aCharcoalByproducts.getGas(4000L), 640, 64);
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 4, MaterialHelper.getGems(Materials.Charcoal, 20), aCharcoalByproducts.getGas(4000L), 320, 96);
+
+ }
+ if (aWoodGas != null) {
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 5, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodGas.getGas(1500L), 640, 64);
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 6, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodGas.getGas(1500L), 320, 96);
+
+ }
+ if (aWoodVinegar != null) {
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 7, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodVinegar.getFluid(3000L), 640, 64);
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 8, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodVinegar.getFluid(3000L), 320, 96);
+
+ }
+ if (aWoodTar != null) {
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), GT_Values.NF, 9, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodTar.getFluid(1500L), 640, 64);
+ CORE.RA.addPyrolyseRecipe(GT_Utility.copyAmount(16L, logStack), Materials.Nitrogen.getGas(1000L), 10, MaterialHelper.getGems(Materials.Charcoal, 20), aWoodTar.getFluid(1500L), 320, 96);
+
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java
new file mode 100644
index 0000000000..5c86c45591
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java
@@ -0,0 +1,109 @@
+package gtPlusPlus.xmod.bop.blocks.base;
+
+import java.util.List;
+import java.util.Random;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.block.BlockLeaves;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class LeavesBase extends BlockLeaves {
+
+ protected IIcon[][] leafTextures = new IIcon[2][];
+ protected String[][] leafType = new String[][] {{}, {}};
+ protected String[] treeType = new String[] {};
+ protected ItemStack[] bonusDrops;
+
+ @SuppressWarnings("deprecation")
+ public LeavesBase(String blockNameLocalized, String blockNameUnlocalized, ItemStack[] bonusDrops){
+ this.bonusDrops = bonusDrops;
+ String blockName = "block"+Utils.sanitizeString(blockNameLocalized)+"Leaves";
+ GameRegistry.registerBlock(this, ItemBlock.class, blockName);
+ this.setBlockName(blockName);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeLeaves", true);
+ this.setCreativeTab(AddToCreativeTab.tabBOP);
+ LanguageRegistry.addName(this, blockNameLocalized+" Leaves");
+ Blocks.fire.setFireInfo(this, 80, 150);
+ }
+
+ private final void setVanillaVariable(Object toSet, Object value){
+ toSet = value;
+ }
+
+ @Override
+ public int quantityDropped(Random p_149745_1_){
+ return p_149745_1_.nextInt(20) == 0 ? 1 : 0;
+ }
+
+
+ @Override//Drops when Leaf is broken
+ protected void func_150124_c(World world, int x, int y, int z, int meta, int randomChance){
+ Logger.INFO("Dropping Bonus Drops");
+ for (int i = 0; i < this.bonusDrops.length; ++i){
+ if (this.bonusDrops[i] != null && world.rand.nextInt(randomChance) == 0){
+ this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(this.bonusDrops[i], 1));
+ }
+ }
+ }
+
+ /**
+ * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, @SuppressWarnings("rawtypes") List metaList){
+ for (int i = 0; i < this.treeType.length; ++i){
+ metaList.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int p_149691_1_, int metaID){
+ return (metaID & 3) == 1 ? this.leafTextures[this.field_150127_b][1] : this.leafTextures[this.field_150127_b][0];
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister iIcon){
+ for (int i = 0; i < leafType.length; ++i){
+ this.leafTextures[i] = new IIcon[leafType[i].length];
+ for (int j = 0; j < leafType[i].length; ++j){
+ this.leafTextures[i][j] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "leaves/" + "leaves_" + leafType[i][j]);
+ }
+ }
+ setVanillaVariable(this.field_150129_M, this.leafTextures);
+ }
+
+ @Override
+ public String[] func_150125_e()
+ {
+ return treeType;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java
new file mode 100644
index 0000000000..8e8ca0ed0a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java
@@ -0,0 +1,86 @@
+package gtPlusPlus.xmod.bop.blocks.base;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.block.BlockLog;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public abstract class LogBase extends BlockLog
+{
+ public String[] treeType = new String[] {};
+ protected IIcon[] textureSide;
+ protected IIcon[] textureTop;
+
+ @SuppressWarnings("deprecation")
+ public LogBase(String blockNameLocalized, String blockNameUnlocalized, String[] treeTypes){
+ this.treeType = treeTypes;
+ String blockName = "block"+Utils.sanitizeString(blockNameLocalized)+"Log";
+ GameRegistry.registerBlock(this, ItemBlock.class, blockName);
+ this.setBlockName(blockName);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "log"+Utils.sanitizeString(blockNameLocalized), true);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "logWood", true);
+ this.setCreativeTab(AddToCreativeTab.tabBOP);
+ LanguageRegistry.addName(this, blockNameLocalized);
+ Blocks.fire.setFireInfo(this, 20, 100);
+ }
+
+ private final void setVanillaVariable(Object toSet, Object value){
+ toSet = value;
+ }
+
+ /**
+ * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, List metaList){
+ for (int i = 0; i < this.textureSide.length; ++i){
+ metaList.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ protected IIcon getTopIcon(int meta){
+ return this.textureTop[meta % this.textureTop.length];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ protected IIcon getSideIcon(int metaID){
+ return this.textureSide[metaID % this.textureSide.length];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister iIcon)
+ {
+ this.textureSide = new IIcon[treeType.length];
+ this.textureTop = new IIcon[treeType.length];
+
+ for (int i = 0; i < this.textureSide.length; ++i){
+ this.textureSide[i] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "logs/" + "log_" + treeType[i]);
+ this.textureTop[i] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "logs/" + "log_" + treeType[i] + "_top");
+ }
+
+ setVanillaVariable(this.field_150167_a, this.textureSide);
+ setVanillaVariable(this.field_150166_b, this.textureTop);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java
new file mode 100644
index 0000000000..c039e1ebac
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java
@@ -0,0 +1,198 @@
+package gtPlusPlus.xmod.bop.blocks.base;
+
+import java.util.List;
+import java.util.Random;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockSapling;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.feature.WorldGenBigTree;
+import net.minecraft.world.gen.feature.WorldGenTrees;
+import net.minecraft.world.gen.feature.WorldGenerator;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class SaplingBase extends BlockSapling
+{
+ protected String[] saplingTypes = new String[] {};
+ protected IIcon[] saplingTextures = new IIcon[] {};
+
+ //Sapling types - field_149882_a
+ //Iicons - field_149881_b
+
+ protected SaplingBase(String blockNameLocalized, String blockNameUnlocalized, String[] saplingTypes){
+ float f = 0.4F;
+ this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
+ this.saplingTypes = saplingTypes;
+ this.saplingTextures = new IIcon[saplingTypes.length];
+ String blockName = "block"+Utils.sanitizeString(blockNameLocalized);
+ GameRegistry.registerBlock(this, ItemBlock.class, blockName);
+ this.setBlockName(blockName);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeSapling", true);
+ this.setCreativeTab(AddToCreativeTab.tabBOP);
+ LanguageRegistry.addName(this, blockNameLocalized);
+ }
+
+ private final void setVanillaVariable(Object toSet, Object value){
+ toSet = value;
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int someInt, int meta){
+ /* p_149691_2_ &= 7;
+ return saplingTextures[MathHelper.clamp_int(p_149691_2_, 0, 5)];*/
+ //return this.saplingTextures[meta % this.saplingTextures.length];
+ try {
+ return this.saplingTextures[meta];
+ }catch(Throwable T){
+ Logger.WARNING("Invalid Sapling meta is "+meta);
+ return this.saplingTextures[0];
+ }
+ }
+
+ /**
+ * Ticks the block if it's been scheduled
+ */
+ @Override
+ public void updateTick(World world, int x, int y, int z, Random rand){
+ if (!world.isRemote){
+ super.updateTick(world, x, y, z, rand);
+ if (world.getBlockLightValue(x, y + 1, z) >= 9 && rand.nextInt(7) == 0){
+ Logger.WARNING("Update Tick");
+ this.updateMeta(world, x, y, z, rand);
+ }
+ else {
+ Logger.WARNING("Tried to Tick.");
+ }
+ }
+ }
+
+ //Dunno - Think it is doGrow || doGrowthTick
+ @Override
+ public void func_149853_b(World world, Random rand, int x, int y, int z){
+ Logger.WARNING("Please find what calls me - func_149853_b");
+ this.updateMeta(world, x, y, z, rand);
+ }
+
+ public void updateMeta(World world, int x, int y, int z, Random rand){
+ func_149879_c(world, x, y, z, rand);
+ }
+
+ @Override
+ public void func_149879_c(World world, int x, int y, int z, Random rand){
+ Logger.WARNING("func_149879_c - 1");
+ int l = world.getBlockMetadata(x, y, z);
+
+ if ((l & 8) == 0){
+ Logger.WARNING("func_149879_c - 2");
+ world.setBlockMetadataWithNotify(x, y, z, l | 8, 4);
+ }
+ else{
+ Logger.WARNING("func_149879_c - 3");
+ this.func_149878_d(world, x, y, z, rand);
+ }
+ }
+
+ @Override
+ public void func_149878_d(World world, int x, int y, int z, Random rand){
+ Logger.WARNING("func_149878_d - 1");
+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return;
+ int l = world.getBlockMetadata(x, y, z) & 7;
+ Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
+ int i1 = 0;
+ int j1 = 0;
+ boolean flag = false;
+
+ switch (l)
+ {
+ case 0:
+ default:
+ Logger.WARNING("Case 0 - Grow Tree");
+ break;
+
+ }
+
+ Block block = Blocks.air;
+
+ if (flag)
+ {
+ world.setBlock(x + i1, y, z + j1, block, 0, 4);
+ world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4);
+ world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4);
+ world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4);
+ }
+ else
+ {
+ world.setBlock(x, y, z, block, 0, 4);
+ }
+
+ if (!((WorldGenerator)object).generate(world, rand, x + i1, y, z + j1))
+ {
+ if (flag)
+ {
+ world.setBlock(x + i1, y, z + j1, this, l, 4);
+ world.setBlock(x + i1 + 1, y, z + j1, this, l, 4);
+ world.setBlock(x + i1, y, z + j1 + 1, this, l, 4);
+ world.setBlock(x + i1 + 1, y, z + j1 + 1, this, l, 4);
+ }
+ else
+ {
+ world.setBlock(x, y, z, this, l, 4);
+ }
+ }
+ }
+
+ @Override
+ public boolean func_149880_a(World world, int p_149880_2_, int p_149880_3_, int p_149880_4_, int p_149880_5_){
+ return world.getBlock(p_149880_2_, p_149880_3_, p_149880_4_) == this && (world.getBlockMetadata(p_149880_2_, p_149880_3_, p_149880_4_) & 7) == p_149880_5_;
+ }
+
+ /**
+ * Determines the damage on the item the block drops. Used in cloth and wood.
+ */
+ @Override
+ public int damageDropped(int meta){
+ return MathHelper.clamp_int(meta & 7, 0, 5);
+ }
+
+ /**
+ * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, List metaList){
+ for (int i = 0; i < this.saplingTextures.length; ++i){
+ metaList.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister iIcon){
+ for (int i = 0; i < saplingTextures.length; ++i){
+ saplingTextures[i] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "saplings/" + "sapling_" + saplingTypes[i]);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java
new file mode 100644
index 0000000000..c942db14cf
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java
@@ -0,0 +1,36 @@
+package gtPlusPlus.xmod.bop.blocks.pine;
+
+import java.util.Random;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.item.chemistry.AgriculturalChem;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator;
+import gtPlusPlus.xmod.bop.blocks.base.LeavesBase;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class LeavesPineTree extends LeavesBase {
+
+ public LeavesPineTree(){
+ super("Pine", "pine", new ItemStack[]{});
+ this.treeType = new String[] {"pine"};
+ this.leafType = new String[][] {{"pine"},{"pine_opaque"}};
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_){
+ return Item.getItemFromBlock(BOP_Block_Registrator.sapling_Pine);
+ }
+
+ @Override//Drops when Leaf is broken
+ protected void func_150124_c(World world, int x, int y, int z, int meta, int randomChance){
+ Logger.INFO("Dropping Bonus Drops");
+ if (MathUtils.randInt(0, 10) >= 9) {
+ this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(AgriculturalChem.mPinecone, MathUtils.randInt(1, 4)));
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java
new file mode 100644
index 0000000000..dee5bf02fd
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java
@@ -0,0 +1,24 @@
+package gtPlusPlus.xmod.bop.blocks.pine;
+
+import gtPlusPlus.xmod.bop.blocks.base.LogBase;
+
+public class LogPineTree extends LogBase {
+
+ public LogPineTree(){
+ super("Pine Log", "pine", new String[]{"pine"});
+ this.treeType = new String[] {"pine"};
+ }
+
+ /*@Override
+ @SideOnly(Side.CLIENT)
+ protected IIcon getSideIcon(int metaID){
+ return this.textureSide[metaID % this.textureSide.length];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ protected IIcon getTopIcon(int metaID){
+ return this.textureTop[metaID % this.textureTop.length];
+ }*/
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java
new file mode 100644
index 0000000000..0ee04de899
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java
@@ -0,0 +1,55 @@
+package gtPlusPlus.xmod.bop.blocks.pine;
+
+import java.util.Random;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.bop.blocks.base.SaplingBase;
+import gtPlusPlus.xmod.bop.world.features.trees.WorldGenPineTree;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.feature.WorldGenBigTree;
+import net.minecraft.world.gen.feature.WorldGenTrees;
+import net.minecraft.world.gen.feature.WorldGenerator;
+
+public class SaplingPineTree extends SaplingBase {
+
+ public SaplingPineTree(){
+ super("Pine Sapling", "pine", new String[]{"pine"});
+ }
+
+ @Override
+ public void func_149878_d(World world, int x, int y, int z, Random rand){
+ Logger.WARNING("func_149878_d - 1");
+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return;
+ rand.nextInt(10);
+ new WorldGenBigTree(true);
+ new WorldGenTrees(true);
+ int i1 = 0;
+ int j1 = 0;
+ boolean flag = false;
+
+ Block block = Blocks.air;
+
+ if (flag)
+ {
+ world.setBlock(x + i1, y, z + j1, block, 0, 4);
+ world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4);
+ world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4);
+ world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4);
+ }
+ else
+ {
+ world.setBlock(x, y, z, block, 0, 4);
+ }
+ Object obj = new WorldGenPineTree();
+ if (obj != null) {
+ world.setBlockToAir(x, y, z);
+ if (!((WorldGenerator) obj).generate(world, CORE.RANDOM, x, y, z)) {
+ world.setBlock(x, y, z, this, 0, 2);
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java
new file mode 100644
index 0000000000..39e434243a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java
@@ -0,0 +1,26 @@
+package gtPlusPlus.xmod.bop.blocks.rainforest;
+
+import java.util.Random;
+
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator;
+import gtPlusPlus.xmod.bop.blocks.base.LeavesBase;
+
+public class LeavesRainforestTree extends LeavesBase {
+
+ public LeavesRainforestTree(){
+ super("Rainforest Oak", "rainforestoak", new ItemStack[]{ItemUtils.getSimpleStack(Items.apple)});
+ this.treeType = new String[] {"rainforest"};
+ this.leafType = new String[][] {{"rainforest"},{"rainforest_opaque"}};
+ }
+
+ @Override
+ public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_){
+ return Item.getItemFromBlock(BOP_Block_Registrator.sapling_Rainforest);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LogRainforestTree.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LogRainforestTree.java
new file mode 100644
index 0000000000..6d30caafb7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/LogRainforestTree.java
@@ -0,0 +1,24 @@
+package gtPlusPlus.xmod.bop.blocks.rainforest;
+
+import gtPlusPlus.xmod.bop.blocks.base.LogBase;
+
+public class LogRainforestTree extends LogBase {
+
+ public LogRainforestTree(){
+ super("Rainforest Oak", "rainforestoak", new String[]{"rainforest"});
+ this.treeType = new String[] {"rainforest"};
+ }
+
+ /*@Override
+ @SideOnly(Side.CLIENT)
+ protected IIcon getSideIcon(int metaID){
+ return this.textureSide[metaID % this.textureSide.length];
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ protected IIcon getTopIcon(int metaID){
+ return this.textureTop[metaID % this.textureTop.length];
+ }*/
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/SaplingRainforestTree.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/SaplingRainforestTree.java
new file mode 100644
index 0000000000..73b916d383
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/rainforest/SaplingRainforestTree.java
@@ -0,0 +1,66 @@
+package gtPlusPlus.xmod.bop.blocks.rainforest;
+
+import java.util.Random;
+
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.world.World;
+import net.minecraft.world.gen.feature.WorldGenBigTree;
+import net.minecraft.world.gen.feature.WorldGenTrees;
+import net.minecraft.world.gen.feature.WorldGenerator;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator;
+import gtPlusPlus.xmod.bop.blocks.base.SaplingBase;
+import gtPlusPlus.xmod.bop.world.features.trees.WorldGenRainForestTree_Ex;
+
+public class SaplingRainforestTree extends SaplingBase {
+
+ public SaplingRainforestTree(){
+ super("Rainforest Oak Sapling", "rainforestoak", new String[]{"rainforest"});
+ }
+
+ @Override
+ public void func_149878_d(World world, int x, int y, int z, Random rand){
+ Logger.WARNING("func_149878_d - 1");
+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return;
+ int l = world.getBlockMetadata(x, y, z) & 7;
+ rand.nextInt(10);
+ new WorldGenBigTree(true);
+ new WorldGenTrees(true);
+ int i1 = 0;
+ int j1 = 0;
+ boolean flag = false;
+
+ Block block = Blocks.air;
+
+ if (flag)
+ {
+ world.setBlock(x + i1, y, z + j1, block, 0, 4);
+ world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4);
+ world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4);
+ world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4);
+ }
+ else
+ {
+ world.setBlock(x, y, z, block, 0, 4);
+ }
+ Object o = new WorldGenRainForestTree_Ex(BOP_Block_Registrator.log_Rainforest, BOP_Block_Registrator.leaves_Rainforest, 0, 0, true, 50, 75);
+
+ if (!((WorldGenerator)o).generate(world, rand, x + i1, y, z + j1))
+ {
+ if (flag)
+ {
+ world.setBlock(x + i1, y, z + j1, this, l, 4);
+ world.setBlock(x + i1 + 1, y, z + j1, this, l, 4);
+ world.setBlock(x + i1, y, z + j1 + 1, this, l, 4);
+ world.setBlock(x + i1 + 1, y, z + j1 + 1, this, l, 4);
+ }
+ else
+ {
+ world.setBlock(x, y, z, this, l, 4);
+ }
+ }
+ }
+
+} \ No newline at end of file