mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 19:49:54 +00:00
Move tree blocks to PluginArboriculture.blocks
This commit is contained in:
1 parent
ade9bb6940
commit
358522b2af
10 files changed
+184
-128
No files matched your search
@@ -0,0 +1,32 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockArboriculture extends BlockBase {
|
||||
public enum Type {
|
||||
ARBCHEST;
|
||||
}
|
||||
|
||||
public BlockArboriculture() {
|
||||
super(Material.iron, true);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
}
|
||||
|
||||
public ItemStack get(Type type, int amount) {
|
||||
return new ItemStack(this, amount, type.ordinal());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.blocks;
|
||||
|
||||
import forestry.arboriculture.items.ItemBlockLeaves;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
public class BlockRegistryArboriculture extends BlockRegistry {
|
||||
public final BlockLog logs;
|
||||
public final BlockPlanks planks;
|
||||
public final BlockSlab slabs;
|
||||
public final BlockArbFence fences;
|
||||
public final BlockArbStairs stairs;
|
||||
public final BlockLog logsFireproof;
|
||||
public final BlockPlanks planksFireproof;
|
||||
public final BlockSlab slabsFireproof;
|
||||
public final BlockArbFence fencesFireproof;
|
||||
public final BlockArbStairs stairsFireproof;
|
||||
|
||||
public final BlockSapling saplingGE;
|
||||
public final BlockForestryLeaves leaves;
|
||||
public final BlockFruitPod pods;
|
||||
|
||||
public final BlockArboriculture arboriculture;
|
||||
|
||||
public BlockRegistryArboriculture() {
|
||||
// Wood blocks
|
||||
logs = registerBlock(new BlockLog(false), ItemBlockWood.class, "logs");
|
||||
registerOreDictWildcard("logWood", logs);
|
||||
|
||||
planks = registerBlock(new BlockPlanks(false), ItemBlockWood.class, "planks");
|
||||
registerOreDictWildcard("plankWood", planks);
|
||||
|
||||
slabs = registerBlock(new BlockSlab(false), ItemBlockWood.class, "slabs");
|
||||
registerOreDictWildcard("slabWood", slabs);
|
||||
|
||||
fences = registerBlock(new BlockArbFence(false), ItemBlockWood.class, "fences");
|
||||
registerOreDictWildcard("fenceWood", fences);
|
||||
|
||||
stairs = registerBlock(new BlockArbStairs(planks, false), ItemBlockWood.class, "stairs");
|
||||
registerOreDictWildcard("stairWood", stairs);
|
||||
|
||||
logsFireproof = registerBlock(new BlockLog(true), ItemBlockWood.class, "logsFireproof");
|
||||
registerOreDictWildcard("logWood", logsFireproof);
|
||||
|
||||
planksFireproof = registerBlock(new BlockPlanks(true), ItemBlockWood.class, "planksFireproof");
|
||||
registerOreDictWildcard("plankWood", planksFireproof);
|
||||
|
||||
slabsFireproof = registerBlock(new BlockSlab(true), ItemBlockWood.class, "slabsFireproof");
|
||||
registerOreDictWildcard("slabWood", slabsFireproof);
|
||||
|
||||
fencesFireproof = registerBlock(new BlockArbFence(true), ItemBlockWood.class, "fencesFireproof");
|
||||
registerOreDictWildcard("fenceWood", fencesFireproof);
|
||||
|
||||
stairsFireproof = registerBlock(new BlockArbStairs(planksFireproof, true), ItemBlockWood.class, "stairsFireproof");
|
||||
registerOreDictWildcard("stairWood", stairsFireproof);
|
||||
|
||||
// Saplings
|
||||
saplingGE = registerBlock(new BlockSapling(), ItemBlockForestry.class, "saplingGE");
|
||||
registerOreDictWildcard("treeSapling", saplingGE);
|
||||
|
||||
// Leaves
|
||||
leaves = registerBlock(new BlockForestryLeaves(), ItemBlockLeaves.class, "leaves");
|
||||
registerOreDictWildcard("treeLeaves", leaves);
|
||||
|
||||
// Pods
|
||||
pods = registerBlock(new BlockFruitPod(), ItemBlockForestry.class, "pods");
|
||||
|
||||
// Machines
|
||||
arboriculture = registerBlock(new BlockArboriculture(), ItemBlockForestry.class, "arboriculture");
|
||||
}
|
||||
}
|
||||
@@ -84,11 +84,11 @@ import forestry.arboriculture.worldgen.WorldGenWenge;
|
||||
import forestry.arboriculture.worldgen.WorldGenWillow;
|
||||
import forestry.arboriculture.worldgen.WorldGenZebrawood;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.genetics.alleles.AlleleBoolean;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.AllelePlantType;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
Oak(TreeBranchDefinition.QUERCUS, "appleOak", "robur", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), 0, new ItemStack(Blocks.log, 1, 0)) {
|
||||
@@ -957,8 +957,8 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
|
||||
// vanilla tree constructor
|
||||
TreeDefinition(TreeBranchDefinition branch, String speciesName, String binomial, boolean dominant, EnumLeafType leafType, Color primary, Color secondary, int vanillaMeta, ItemStack vanillaWood) {
|
||||
String uid = "forestry.tree" + this.toString();
|
||||
String unlocalizedDescription = "for.description.tree" + this.toString();
|
||||
String uid = "forestry.tree" + this;
|
||||
String unlocalizedDescription = "for.description.tree" + this;
|
||||
String unlocalizedName = "for.trees.species." + speciesName;
|
||||
|
||||
this.branch = branch;
|
||||
@@ -973,8 +973,8 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
|
||||
// forestry tree constructor
|
||||
TreeDefinition(TreeBranchDefinition branch, String speciesName, String binomial, boolean dominant, EnumLeafType leafType, Color primary, Color secondary, EnumWoodType woodType) {
|
||||
String uid = "forestry.tree" + this.toString();
|
||||
String unlocalizedDescription = "for.description.tree" + this.toString();
|
||||
String uid = "forestry.tree" + this;
|
||||
String unlocalizedDescription = "for.description.tree" + this;
|
||||
String unlocalizedName = "for.trees.species." + speciesName;
|
||||
|
||||
this.branch = branch;
|
||||
@@ -1023,12 +1023,13 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
|
||||
@Override
|
||||
public void setLeaves(World world, GameProfile owner, int x, int y, int z, boolean decorative) {
|
||||
boolean placed = ForestryBlock.leaves.setBlock(world, x, y, z, 0);
|
||||
boolean placed = world.setBlock(x, y, z, PluginArboriculture.blocks.leaves, 0, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
if (!placed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ForestryBlock.leaves.isBlockEqual(world, x, y, z)) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (PluginArboriculture.blocks.leaves != block) {
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -52,7 +53,6 @@ import forestry.arboriculture.blocks.BlockFruitPod;
|
||||
import forestry.arboriculture.tiles.TileFruitPod;
|
||||
import forestry.arboriculture.tiles.TileSapling;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
@@ -192,12 +192,13 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
|
||||
@Override
|
||||
public boolean plantSapling(World world, ITree tree, GameProfile owner, int x, int y, int z) {
|
||||
|
||||
boolean placed = world.setBlock(x, y, z, ForestryBlock.saplingGE.block(), 0, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
boolean placed = world.setBlock(x, y, z, PluginArboriculture.blocks.saplingGE, 0, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
if (!placed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ForestryBlock.saplingGE.isBlockEqual(world, x, y, z)) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (PluginArboriculture.blocks.saplingGE != block) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -221,12 +222,14 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
|
||||
if (direction < 0) {
|
||||
return false;
|
||||
}
|
||||
boolean placed = ForestryBlock.pods.setBlock(world, x, y, z, direction);
|
||||
|
||||
boolean placed = world.setBlock(x, y, z, PluginArboriculture.blocks.pods, direction, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
if (!placed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ForestryBlock.pods.isBlockEqual(world, x, y, z)) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (PluginArboriculture.blocks.pods != block) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.proxy;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.ColorizerFoliage;
|
||||
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@@ -25,7 +28,6 @@ import forestry.arboriculture.render.RenderPlankItem;
|
||||
import forestry.arboriculture.render.RenderSaplingBlock;
|
||||
import forestry.arboriculture.render.RenderSlabItem;
|
||||
import forestry.arboriculture.render.RenderStairItem;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class ProxyArboricultureClient extends ProxyArboriculture {
|
||||
@@ -39,22 +41,27 @@ public class ProxyArboricultureClient extends ProxyArboriculture {
|
||||
RenderingRegistry.registerBlockHandler(new RenderLeavesBlock());
|
||||
RenderingRegistry.registerBlockHandler(new RenderFruitPodBlock());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.logs.item(), new RenderLogItem());
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.logsFireproof.item(), new RenderLogItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.logs, new RenderLogItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.logsFireproof, new RenderLogItem());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.stairs.item(), new RenderStairItem());
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.stairsFireproof.item(), new RenderStairItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.stairs, new RenderStairItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.stairsFireproof, new RenderStairItem());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.planks.item(), new RenderPlankItem());
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.planksFireproof.item(), new RenderPlankItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.planks, new RenderPlankItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.planksFireproof, new RenderPlankItem());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.slabs.item(), new RenderSlabItem());
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.slabsFireproof.item(), new RenderSlabItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.slabs, new RenderSlabItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.slabsFireproof, new RenderSlabItem());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.fences.item(), new RenderFenceItem());
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.fencesFireproof.item(), new RenderFenceItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.fences, new RenderFenceItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.fencesFireproof, new RenderFenceItem());
|
||||
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.leaves.item(), new RenderLeavesItem());
|
||||
registerItemRenderer(PluginArboriculture.blocks.leaves, new RenderLeavesItem());
|
||||
}
|
||||
|
||||
private static void registerItemRenderer(Block block, IItemRenderer renderer) {
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
MinecraftForgeClient.registerItemRenderer(item, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,9 @@ package forestry.core.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@@ -19,7 +22,7 @@ import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public abstract class BlockRegistry {
|
||||
public static <T extends Block> T registerBlock(T block, Class<? extends ItemBlock> itemClass, String name) {
|
||||
protected static <T extends Block> T registerBlock(T block, Class<? extends ItemBlock> itemClass, String name) {
|
||||
if (PluginManager.getStage() != PluginManager.Stage.SETUP) {
|
||||
throw new RuntimeException("Tried to register Block outside of Setup");
|
||||
}
|
||||
@@ -27,4 +30,8 @@ public abstract class BlockRegistry {
|
||||
GameRegistry.registerBlock(block, itemClass, StringUtil.cleanBlockName(block));
|
||||
return block;
|
||||
}
|
||||
|
||||
protected static void registerOreDictWildcard(String oreDictName, Block block) {
|
||||
OreDictionary.registerOre(oreDictName, new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -34,7 +35,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.CreativeTabForestry;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.plugins.PluginCore;
|
||||
|
||||
@@ -115,14 +115,11 @@ public class BlockSoil extends Block implements IItemTyped {
|
||||
}
|
||||
|
||||
private static boolean isEnrooted(World world, int x, int y, int z) {
|
||||
|
||||
for (int i = -1; i < 2; i++) {
|
||||
for (int j = -1; j < 2; j++) {
|
||||
Block block = world.getBlock(x + i, y + 1, z + j);
|
||||
if (block == Blocks.log || block == Blocks.sapling || block == ForestryBlock.saplingGE.block())
|
||||
// We are not returning true if we are the base of a
|
||||
// sapling.
|
||||
{
|
||||
if (block == Blocks.log || block == Blocks.sapling || block instanceof IGrowable) {
|
||||
// We are not returning true if we are the base of a sapling.
|
||||
return !(i == 0 && j == 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,22 +41,6 @@ public enum ForestryBlock {
|
||||
mushroom,
|
||||
candle,
|
||||
stump,
|
||||
// wood items
|
||||
planks,
|
||||
slabs,
|
||||
logs,
|
||||
fences,
|
||||
stairs,
|
||||
planksFireproof,
|
||||
slabsFireproof,
|
||||
logsFireproof,
|
||||
fencesFireproof,
|
||||
stairsFireproof,
|
||||
// trees
|
||||
saplingGE,
|
||||
leaves,
|
||||
pods,
|
||||
arboriculture,
|
||||
alveary,
|
||||
farm,
|
||||
apiculture,
|
||||
|
||||
@@ -19,8 +19,8 @@ import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.arboriculture.genetics.TreeGenome;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
public class FarmableGE implements IFarmable {
|
||||
|
||||
@@ -31,7 +31,8 @@ public class FarmableGE implements IFarmable {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ForestryBlock.saplingGE.isBlockEqual(world, x, y, z);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return PluginArboriculture.blocks.saplingGE == block;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -35,7 +34,6 @@ import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.EnumWoodType;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.ICrateRegistry;
|
||||
@@ -43,14 +41,8 @@ import forestry.api.storage.StorageManager;
|
||||
import forestry.arboriculture.GuiHandlerArboriculture;
|
||||
import forestry.arboriculture.VillageHandlerArboriculture;
|
||||
import forestry.arboriculture.WoodItemAccess;
|
||||
import forestry.arboriculture.blocks.BlockArbFence;
|
||||
import forestry.arboriculture.blocks.BlockArbStairs;
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.blocks.BlockFruitPod;
|
||||
import forestry.arboriculture.blocks.BlockLog;
|
||||
import forestry.arboriculture.blocks.BlockPlanks;
|
||||
import forestry.arboriculture.blocks.BlockSapling;
|
||||
import forestry.arboriculture.blocks.BlockSlab;
|
||||
import forestry.arboriculture.blocks.BlockArboriculture;
|
||||
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
|
||||
import forestry.arboriculture.commands.CommandTree;
|
||||
import forestry.arboriculture.genetics.TreeBranchDefinition;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
@@ -61,8 +53,6 @@ import forestry.arboriculture.genetics.TreekeepingMode;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleFruit;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleGrowth;
|
||||
import forestry.arboriculture.genetics.alleles.AlleleLeafEffect;
|
||||
import forestry.arboriculture.items.ItemBlockLeaves;
|
||||
import forestry.arboriculture.items.ItemBlockWood;
|
||||
import forestry.arboriculture.items.ItemRegistryArboriculture;
|
||||
import forestry.arboriculture.network.PacketRegistryArboriculture;
|
||||
import forestry.arboriculture.proxy.ProxyArboriculture;
|
||||
@@ -72,14 +62,11 @@ import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.arboriculture.tiles.TileSapling;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
import forestry.core.blocks.BlockCore;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.genetics.alleles.AllelePlantType;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
import forestry.core.items.ItemFruit.EnumFruit;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -104,6 +91,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
public static final List<Block> validFences = new ArrayList<>();
|
||||
|
||||
public static ItemRegistryArboriculture items;
|
||||
public static BlockRegistryArboriculture blocks;
|
||||
|
||||
@Override
|
||||
protected void setupAPI() {
|
||||
@@ -129,52 +117,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
@Override
|
||||
protected void registerItemsAndBlocks() {
|
||||
items = new ItemRegistryArboriculture();
|
||||
|
||||
// Wood blocks
|
||||
ForestryBlock.logs.registerBlock(new BlockLog(false), ItemBlockWood.class, "logs");
|
||||
OreDictionary.registerOre("logWood", ForestryBlock.logs.getWildcard());
|
||||
|
||||
ForestryBlock.planks.registerBlock(new BlockPlanks(false), ItemBlockWood.class, "planks");
|
||||
OreDictionary.registerOre("plankWood", ForestryBlock.planks.getWildcard());
|
||||
|
||||
ForestryBlock.slabs.registerBlock(new BlockSlab(false), ItemBlockWood.class, "slabs");
|
||||
OreDictionary.registerOre("slabWood", ForestryBlock.slabs.getWildcard());
|
||||
|
||||
ForestryBlock.fences.registerBlock(new BlockArbFence(false), ItemBlockWood.class, "fences");
|
||||
OreDictionary.registerOre("fenceWood", ForestryBlock.fences.getWildcard());
|
||||
|
||||
ForestryBlock.stairs.registerBlock(new BlockArbStairs(ForestryBlock.planks.block(), false), ItemBlockWood.class, "stairs");
|
||||
OreDictionary.registerOre("stairWood", ForestryBlock.stairs.getWildcard());
|
||||
|
||||
ForestryBlock.logsFireproof.registerBlock(new BlockLog(true), ItemBlockWood.class, "logsFireproof");
|
||||
OreDictionary.registerOre("logWood", ForestryBlock.logsFireproof.getWildcard());
|
||||
|
||||
ForestryBlock.planksFireproof.registerBlock(new BlockPlanks(true), ItemBlockWood.class, "planksFireproof");
|
||||
OreDictionary.registerOre("plankWood", ForestryBlock.planksFireproof.getWildcard());
|
||||
|
||||
ForestryBlock.slabsFireproof.registerBlock(new BlockSlab(true), ItemBlockWood.class, "slabsFireproof");
|
||||
OreDictionary.registerOre("slabWood", ForestryBlock.slabsFireproof.getWildcard());
|
||||
|
||||
ForestryBlock.fencesFireproof.registerBlock(new BlockArbFence(true), ItemBlockWood.class, "fencesFireproof");
|
||||
OreDictionary.registerOre("fenceWood", ForestryBlock.fencesFireproof.getWildcard());
|
||||
|
||||
ForestryBlock.stairsFireproof.registerBlock(new BlockArbStairs(ForestryBlock.planksFireproof.block(), true), ItemBlockWood.class, "stairsFireproof");
|
||||
OreDictionary.registerOre("stairWood", ForestryBlock.stairsFireproof.getWildcard());
|
||||
|
||||
// Saplings
|
||||
ForestryBlock.saplingGE.registerBlock(new BlockSapling(), ItemBlockForestry.class, "saplingGE");
|
||||
OreDictionary.registerOre("treeSapling", ForestryBlock.saplingGE.getWildcard());
|
||||
|
||||
// Leaves
|
||||
ForestryBlock.leaves.registerBlock(new BlockForestryLeaves(), ItemBlockLeaves.class, "leaves");
|
||||
OreDictionary.registerOre("treeLeaves", ForestryBlock.leaves.getWildcard());
|
||||
|
||||
// Pods
|
||||
ForestryBlock.pods.registerBlock(new BlockFruitPod(), ItemBlockForestry.class, "pods");
|
||||
|
||||
// Machines
|
||||
ForestryBlock.arboriculture.registerBlock(new BlockBase(Material.iron, true), ItemBlockForestry.class, "arboriculture");
|
||||
ForestryBlock.arboriculture.block().setCreativeTab(Tabs.tabArboriculture);
|
||||
blocks = new BlockRegistryArboriculture();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -182,22 +125,22 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
super.preInit();
|
||||
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
WoodItemAccess.registerLog(ForestryBlock.logs.block(), woodType, false);
|
||||
WoodItemAccess.registerPlanks(ForestryBlock.planks.block(), woodType, false);
|
||||
WoodItemAccess.registerSlab(ForestryBlock.slabs.block(), woodType, false);
|
||||
WoodItemAccess.registerFence(ForestryBlock.fences.block(), woodType, false);
|
||||
WoodItemAccess.registerStairs(ForestryBlock.stairs.block(), woodType, false);
|
||||
WoodItemAccess.registerLog(blocks.logs, woodType, false);
|
||||
WoodItemAccess.registerPlanks(blocks.planks, woodType, false);
|
||||
WoodItemAccess.registerSlab(blocks.slabs, woodType, false);
|
||||
WoodItemAccess.registerFence(blocks.fences, woodType, false);
|
||||
WoodItemAccess.registerStairs(blocks.stairs, woodType, false);
|
||||
|
||||
WoodItemAccess.registerLog(ForestryBlock.logsFireproof.block(), woodType, true);
|
||||
WoodItemAccess.registerPlanks(ForestryBlock.planksFireproof.block(), woodType, true);
|
||||
WoodItemAccess.registerSlab(ForestryBlock.slabsFireproof.block(), woodType, true);
|
||||
WoodItemAccess.registerFence(ForestryBlock.fencesFireproof.block(), woodType, true);
|
||||
WoodItemAccess.registerStairs(ForestryBlock.stairsFireproof.block(), woodType, true);
|
||||
WoodItemAccess.registerLog(blocks.logsFireproof, woodType, true);
|
||||
WoodItemAccess.registerPlanks(blocks.planksFireproof, woodType, true);
|
||||
WoodItemAccess.registerSlab(blocks.slabsFireproof, woodType, true);
|
||||
WoodItemAccess.registerFence(blocks.fencesFireproof, woodType, true);
|
||||
WoodItemAccess.registerStairs(blocks.stairsFireproof, woodType, true);
|
||||
}
|
||||
|
||||
definitionChest = ((BlockBase) ForestryBlock.arboriculture.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_ARBCHEST_META,
|
||||
definitionChest = blocks.arboriculture.addDefinition(new MachineDefinition(BlockArboriculture.Type.ARBCHEST.ordinal(),
|
||||
"forestry.ArbChest", TileArboristChest.class, Proxies.render.getRenderChest("arbchest"),
|
||||
ShapedRecipeCustom.createShapedRecipe(ForestryBlock.arboriculture.getItemStack(1, Constants.DEFINITION_ARBCHEST_META),
|
||||
ShapedRecipeCustom.createShapedRecipe(blocks.arboriculture.get(BlockArboriculture.Type.ARBCHEST, 1),
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
@@ -210,8 +153,8 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
proxy.initializeRendering();
|
||||
|
||||
// Register vanilla and forestry fence ids
|
||||
validFences.add(ForestryBlock.fences.block());
|
||||
validFences.add(ForestryBlock.fencesFireproof.block());
|
||||
validFences.add(blocks.fences);
|
||||
validFences.add(blocks.fencesFireproof);
|
||||
validFences.add(Blocks.fence);
|
||||
validFences.add(Blocks.fence_gate);
|
||||
validFences.add(Blocks.nether_brick_fence);
|
||||
@@ -263,10 +206,9 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
|
||||
RecipeUtil.addSmelting(ForestryBlock.logs.getWildcard(), new ItemStack(Items.coal, 1, 1), 0.15F);
|
||||
RecipeUtil.addSmelting(new ItemStack(blocks.logs, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.coal, 1, 1), 0.15F);
|
||||
|
||||
for (EnumWoodType woodType : EnumWoodType.VALUES) {
|
||||
|
||||
ItemStack planks = TreeManager.woodItemAccess.getPlanks(woodType, false);
|
||||
ItemStack logs = TreeManager.woodItemAccess.getLog(woodType, false);
|
||||
ItemStack slabs = TreeManager.woodItemAccess.getSlab(woodType, false);
|
||||
@@ -476,7 +418,7 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
return 100;
|
||||
}
|
||||
|
||||
if (ForestryBlock.slabs.isItemEqual(fuel)) {
|
||||
if (blocks.slabs == Block.getBlockFromItem(item)) {
|
||||
return 150;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user