Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2

This commit is contained in:
Nedelosk committed 2016-11-01 16:48:14 +01:00
commit f288984833
39 files changed
+2277 -1436

No files matched your search

@@ -126,17 +126,7 @@ public class ForestryAllele {
Highest;
public IAllele getAllele() {
String s = this.toString();
if (this == Saplings.Average) {
s = "Default";
}
if (this == Saplings.High) {
s = "Double";
}
if (this == Saplings.Higher) {
s = "Triple";
}
return AlleleManager.alleleRegistry.getAllele("forestry.saplings" + s);
return AlleleManager.alleleRegistry.getAllele("forestry.saplings" + name());
}
}
@@ -257,8 +257,7 @@ public class TreeBreedingSystem extends BreedingSystem {
switch ((EnumTreeChromosome) chromosome) {
case FERTILITY: {
for (final ForestryAllele.Saplings a : ForestryAllele.Saplings.values()) {
//TODO
//alleles.add(a.getAllele());
alleles.add(a.getAllele());
}
break;
}
+14 -17
View File
@@ -19,14 +19,10 @@ import binnie.extratrees.carpentry.ModuleCarpentry;
import binnie.extratrees.config.ConfigurationMain;
import binnie.extratrees.core.ExtraTreesGUID;
import binnie.extratrees.core.ModuleCore;
import binnie.extratrees.genetics.ButterflySpecies;
import binnie.extratrees.genetics.ExtraTreeFruitGene;
import binnie.extratrees.genetics.ExtraTreeSpecies;
import binnie.extratrees.genetics.ModuleGenetics;
import binnie.extratrees.genetics.*;
import binnie.extratrees.item.ModuleItems;
import binnie.extratrees.machines.ModuleMachine;
import binnie.extratrees.proxy.Proxy;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.arboriculture.ITreeRoot;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.AlleleSpeciesRegisterEvent;
@@ -43,7 +39,9 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Mod(modid = Constants.EXTRA_TREES_MOD_ID, name = "Binnie's Extra Trees", useMetadata = true, dependencies = "required-after:" + Constants.CORE_MOD_ID)
@@ -60,7 +58,7 @@ public class ExtraTrees extends AbstractMod {
public static Block blockStairs;
//public static Block blockLog;
public static BlockCarpentry blockCarpentry;
public static Block blockPlanks;
//public static Block blockPlanks;
public static Block blockMachine;
public static Block blockFence;
public static BlockCarpentry blockPanel;
@@ -155,14 +153,12 @@ public class ExtraTrees extends AbstractMod {
for (final ExtraTreeFruitGene fruit : ExtraTreeFruitGene.values()) {
AlleleManager.alleleRegistry.registerAllele(fruit);
}
for (final ExtraTreeSpecies species : ExtraTreeSpecies.values()) {
AlleleManager.alleleRegistry.registerAllele(species, EnumTreeChromosome.SPECIES);
}
}
ExtraTreeSpecies.preInitTrees();
if (BinnieCore.isLepidopteryActive()) {
for (final ButterflySpecies species2 : ButterflySpecies.values()) {
AlleleManager.alleleRegistry.registerAllele(species2);
if (BinnieCore.isLepidopteryActive()) {
for (final ButterflySpecies species2 : ButterflySpecies.values()) {
AlleleManager.alleleRegistry.registerAllele(species2);
}
}
}
}
@@ -180,12 +176,13 @@ public class ExtraTrees extends AbstractMod {
.filter(mrl -> mrl.getResourceDomain().startsWith(Constants.EXTRA_TREES_MOD_ID))
.filter(mrl -> mrl.getResourcePath().startsWith("germlings")).collect(Collectors.toList());
//Replace model
Map<String, ExtraTreeSpecies> map = Arrays.stream(ExtraTreeSpecies.values()).collect(Collectors.toMap(o -> o.name().toLowerCase(), o -> o));
models.forEach(model -> {
String species = model.getVariant().split("=")[1];
ExtraTreeSpecies treeSpecies = ExtraTreeSpecies.names().get(species);
int primaryColor = treeSpecies.getSpriteColour(1);
int secondaryColor = treeSpecies.getSpriteColour(0);
e.getModelRegistry().putObject(model, new DoublePassBakedModel(e.getModelRegistry().getObject(model), primaryColor, secondaryColor));
ExtraTreeSpecies treeSpecies = map.get(species);
int primaryColor = treeSpecies.getLeafColor().getRGB();
int secondaryColor = treeSpecies.getWoodColor().getRGB();
e.getModelRegistry().putObject(model, new DoublePassBakedModel(e.getModelRegistry().getObject(model), primaryColor, secondaryColor));
});
}
@@ -1,96 +1,159 @@
package binnie.extratrees.block;
import binnie.Binnie;
import binnie.core.block.IBlockMetadata;
import binnie.core.block.TileEntityMetadata;
import binnie.extratrees.ExtraTrees;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.Tabs;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class BlockETPlanks extends BlockPlanks implements IBlockMetadata {
public BlockETPlanks() {
this.setRegistryName("planks");
import static net.minecraft.block.BlockFence.*;
public class BlockETPlanks extends Block implements IItemModelRegister {
protected static final int VARIANTS_PER_BLOCK = 16;
protected static final int VARIANTS_META_MASK = VARIANTS_PER_BLOCK - 1;
private final boolean fireproof;
public static final int GROUP_COUNT = (int) Math.ceil(EnumExtraTreeLog.values().length / (float) VARIANTS_PER_BLOCK);
protected int offset = -1;
protected static PropertyEnum<EnumExtraTreeLog>[] plankTypes;
static {
plankTypes = new PropertyEnum[GROUP_COUNT];
for (int i = 0; i < GROUP_COUNT; i++) {
int finalI = i;
List allowed = Arrays.stream(EnumExtraTreeLog.values()).filter(l -> l.getMetadata() >= finalI * VARIANTS_PER_BLOCK && l.getMetadata() < finalI * VARIANTS_PER_BLOCK + VARIANTS_PER_BLOCK).collect(Collectors.toList());
plankTypes[i] = PropertyEnum.create("wood_type", EnumExtraTreeLog.class, allowed);
}
}
public BlockETPlanks(int offset, boolean fireproof) {
super(Material.WOOD);
this.fireproof = fireproof;
this.offset = offset;
this.setRegistryName("plank." + (fireproof ? "fireproof." : "") + offset);
this.setCreativeTab(Tabs.tabArboriculture);
this.setResistance(5.0f);
this.setHardness(2.0f);
this.setHarvestLevel("axe", 0);
this.setSoundType(SoundType.WOOD);
}
@Override
public int getPlacedMeta(ItemStack p0, World p1, BlockPos pos, EnumFacing p5) {
return 0;
public static class PlankItemBlock<V extends BlockETPlanks> extends ItemBlock {
EnumExtraTreeLog[] values;
public PlankItemBlock(V block) {
super(block);
setHasSubtypes(true);
setMaxDamage(0);
setRegistryName(block.getRegistryName());
values = block.getVariant().getAllowedValues().toArray(new EnumExtraTreeLog[]{});
}
@Override
public int getMetadata(int damage) {
return damage;
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return "tile.plank." + values[stack.getMetadata()].getName();
}
}
// @Override
// public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
// return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
// }
//
// @Override
// public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
// return BlockMetadata.breakBlock(this, player, world, x, y, z);
// }
@Override
public TileEntity createNewTileEntity(final World var1, final int i) {
return new TileEntityMetadata();
}
// @Override
// public boolean hasTileEntity(final int meta) {
// return true;
// }
//
// @Override
// public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
// super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
// final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
// return tileentity != null && tileentity.receiveClientEvent(par5, par6);
// }
//
// @Override
// public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
// return TileEntityMetadata.getItemDamage(stack);
// }
@Override
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
return tileMeta;
public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) {
int meta = getMetaFromState(blockState);
EnumExtraTreeLog woodType = getWoodType(meta);
return woodType.getHardness();
}
@Override
public String getBlockName(final ItemStack par1ItemStack) {
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
return Binnie.Language.localise(ExtraTrees.instance, "block.plank.name", PlankType.ExtraTreePlanks.values()[meta].getName());
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
if (fireproof) {
return 0;
}
return 20;
}
@Override
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
if (fireproof) {
return 0;
}
return 5;
}
@Override
public void dropAsStack(World world, BlockPos pos, ItemStack p4) {
//this.dropBlockAsItem(world, pos, drop);
public int getMetaFromState(IBlockState state) {
return damageDropped(state);
}
// @Override
// public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
// this.dropBlockAsItem(world, x, y, z, drop);
// }
@Override
public IBlockState getStateFromMeta(int meta) {
EnumExtraTreeLog woodType = getWoodType(meta);
return getDefaultState().withProperty(getVariant(), woodType);
}
// @Override
// public void getSubBlocks(final Item itemIn, final CreativeTabs par2CreativeTabs, final List<ItemStack> itemList) {
// for (int i = 0; i < PlankType.ExtraTreePlanks.values().length; ++i) {
// itemList.add(TileEntityMetadata.getItemStack(this, i));
// }
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, getVariant());
}
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
list.addAll(getVariant().getAllowedValues().stream().map(woodType -> new ItemStack(this, 1, woodType.getMetadata() % VARIANTS_PER_BLOCK)).collect(Collectors.toList()));
}
@Nonnull
public PropertyEnum<EnumExtraTreeLog> getVariant(){
return plankTypes[offset];
}
@Override
public final int damageDropped(IBlockState state) {
return state.getValue(getVariant()).getMetadata() % VARIANTS_PER_BLOCK;
}
@Override
public final IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
EnumExtraTreeLog woodType = getWoodType(meta);
return getDefaultState().withProperty(getVariant(), woodType);
}
public EnumExtraTreeLog getWoodType(int meta) {
return EnumExtraTreeLog.values()[offset * VARIANTS_PER_BLOCK + (meta & VARIANTS_META_MASK)];
}
@Override
public void registerModel(Item item, IModelManager manager) {
}
// public String getBlockName(final ItemStack par1ItemStack) {
// final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
// return Binnie.Language.localise(ExtraTrees.instance, "block.plank.name", PlankType.ExtraTreePlanks.values()[meta].getName());
// }
// @Override
@@ -115,36 +178,5 @@ public class BlockETPlanks extends BlockPlanks implements IBlockMetadata {
// plank.loadIcon(register);
// }
// }
//
// @Override
// public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
// super.breakBlock(par1World, par2, par3, par4, par5, par6);
// par1World.removeTileEntity(par2, par3, par4);
// }
// @Override
// public boolean isWood(final IBlockAccess world, final int x, final int y, final int z) {
// return true;
// }
//
// @Override
// public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
// return 20;
// }
//
// @Override
// public boolean isFlammable(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
// return true;
// }
//
// @Override
// public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
// return 5;
// }
// @Override
// public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
// return BlockMetadata.getPickBlock(world, x, y, z);
// }
}
@@ -32,7 +32,10 @@ import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe;
import javax.annotation.Nonnull;
import static binnie.extratrees.block.BlockETLog.woodTypes;
import static binnie.extratrees.block.BlockETPlanks.plankTypes;
public class ModuleBlocks implements IInitializable {
// public static int hedgeRenderID;
@@ -40,37 +43,71 @@ public class ModuleBlocks implements IInitializable {
@Override
public void preInit() {
PlankType.setup();
ExtraTrees.blockPlanks = new BlockETPlanks();
//ExtraTrees.blockPlanks = new BlockETPlanks();
ExtraTrees.blockFence = new BlockFence("fence");
for (int i = 0; i < BlockETPlanks.GROUP_COUNT ; i++) {
int finalI = i;
BlockETPlanks blockETPlank = new BlockETPlanks(finalI, false) {
@Override
public PropertyEnum<EnumExtraTreeLog> getVariant() {return plankTypes[finalI];}
};
GameRegistry.register(blockETPlank);
Item plank = GameRegistry.register(new BlockETPlanks.PlankItemBlock<>(blockETPlank));
WoodAccess.getInstance().registerWithVariants(blockETPlank, WoodBlockKind.PLANKS, plankTypes[finalI], false);
ExtraTrees.proxy.setCustomStateMapper("plank", blockETPlank);
//fireproof
BlockETPlanks blockETPlankFireproof = new BlockETPlanks(finalI, true) {
@Override
public PropertyEnum<EnumExtraTreeLog> getVariant() {
return plankTypes[finalI];
}
};
GameRegistry.register(blockETPlankFireproof);
ExtraTrees.proxy.setCustomStateMapper("plank", blockETPlankFireproof);
Item plankFireproof = GameRegistry.register(new BlockETPlanks.PlankItemBlock<>(blockETPlankFireproof));
WoodAccess.getInstance().registerWithVariants(blockETPlankFireproof, WoodBlockKind.PLANKS, plankTypes[finalI], true);
for (EnumExtraTreeLog l : plankTypes[finalI].getAllowedValues()) {
BinnieCore.proxy.registermodel(plank, l.getMetadata() % BlockETPlanks.VARIANTS_PER_BLOCK, new ModelResourceLocation("extratrees:plank", "wood_type=" + l.getName()));
BinnieCore.proxy.registermodel(plankFireproof, l.getMetadata() % BlockETPlanks.VARIANTS_PER_BLOCK, new ModelResourceLocation("extratrees:plank", "wood_type=" + l.getName()));
}
}
for (int i = 0; i < BlockETLog.GROUP_COUNT; i++) {
int finalI = i;
BlockETLog block = new BlockETLog(finalI, false) {
BlockETLog blockETLog = new BlockETLog(finalI, false) {
@Override
public PropertyEnum<EnumExtraTreeLog> getVariant() {
return woodTypes[finalI];
}
};
GameRegistry.register(block);
Item wood = GameRegistry.register(new BlockETLog.LogItemBlock<>(block));
WoodAccess.registerWithVariants(block, WoodBlockKind.LOG, woodTypes[finalI]);
ExtraTrees.proxy.setCustomStateMapper("log", block);
GameRegistry.register(blockETLog);
Item wood = GameRegistry.register(new BlockETLog.LogItemBlock<>(blockETLog));
WoodAccess.getInstance().registerWithVariants(blockETLog, WoodBlockKind.LOG, woodTypes[finalI], false);
ExtraTrees.proxy.setCustomStateMapper("log", blockETLog);
//fireproof
BlockETLog block2 = new BlockETLog(i, true) {
BlockETLog blockETLogFireproof = new BlockETLog(i, true) {
@Override
public PropertyEnum<EnumExtraTreeLog> getVariant() {
return woodTypes[finalI];
}
};
GameRegistry.register(block2);
ExtraTrees.proxy.setCustomStateMapper("log", block2);
Item woodFireproof = GameRegistry.register(new BlockETLog.LogItemBlock<>(block2));
GameRegistry.register(blockETLogFireproof);
ExtraTrees.proxy.setCustomStateMapper("log", blockETLogFireproof);
Item woodFireproof = GameRegistry.register(new BlockETLog.LogItemBlock<>(blockETLogFireproof));
for (EnumExtraTreeLog l : woodTypes[finalI].getAllowedValues()) {
BinnieCore.proxy.registermodel(wood, l.getMetadata() % BlockETLog.VARIANTS_PER_BLOCK, new ModelResourceLocation("extratrees:log", "axis=y,wood_type=" + l.getName()));
BinnieCore.proxy.registermodel(woodFireproof, l.getMetadata() % BlockETLog.VARIANTS_PER_BLOCK, new ModelResourceLocation("extratrees:log", "axis=y,wood_type=" + l.getName()));
}
WoodAccess.getInstance().registerWithVariants(blockETLogFireproof, WoodBlockKind.LOG, woodTypes[finalI], true);
}
@@ -79,9 +116,9 @@ public class ModuleBlocks implements IInitializable {
ExtraTrees.blockMultiFence = new BlockMultiFence();
ExtraTrees.blockSlab = new BlockETSlab(false);
ExtraTrees.blockDoubleSlab = new BlockETSlab(true);
ExtraTrees.blockStairs = new BlockETStairs(ExtraTrees.blockPlanks);
GameRegistry.register(ExtraTrees.blockPlanks);
GameRegistry.register(new ItemMetadata(ExtraTrees.blockPlanks).setRegistryName(ExtraTrees.blockPlanks.getRegistryName()));
// ExtraTrees.blockStairs = new BlockETStairs(ExtraTrees.blockPlanks);
// GameRegistry.register(ExtraTrees.blockPlanks);
// GameRegistry.register(new ItemMetadata(ExtraTrees.blockPlanks).setRegistryName(ExtraTrees.blockPlanks.getRegistryName()));
GameRegistry.register(ExtraTrees.blockFence);
GameRegistry.register(new ItemMetadata(ExtraTrees.blockFence).setRegistryName(ExtraTrees.blockFence.getRegistryName()));
GameRegistry.register(ExtraTrees.blockMultiFence);
@@ -96,8 +133,8 @@ public class ModuleBlocks implements IInitializable {
GameRegistry.register(new ItemETSlab(ExtraTrees.blockDoubleSlab).setRegistryName(ExtraTrees.blockDoubleSlab.getRegistryName()));
GameRegistry.register(ExtraTrees.blockDoor);
GameRegistry.register(new ItemETDoor(ExtraTrees.blockDoor).setRegistryName(ExtraTrees.blockDoor.getRegistryName()));
GameRegistry.register(ExtraTrees.blockStairs);
GameRegistry.register(new ItemETStairs(ExtraTrees.blockStairs).setRegistryName(ExtraTrees.blockStairs.getRegistryName()));
// GameRegistry.register(ExtraTrees.blockStairs);
// GameRegistry.register(new ItemETStairs(ExtraTrees.blockStairs).setRegistryName(ExtraTrees.blockStairs.getRegistryName()));
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockStairs), new StairItemRenderer());
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ExtraTrees.blockGate), new GateItemRenderer());
for (final EnumExtraTreeLog plank : EnumExtraTreeLog.values()) {
@@ -123,8 +160,6 @@ public class ModuleBlocks implements IInitializable {
// RenderingRegistry.registerBlockHandler(new StairsRenderer());
// ExtraTrees.doorRenderId = RenderingRegistry.getNextAvailableRenderId();
// RenderingRegistry.registerBlockHandler(new DoorBlockRenderer());
// ExtraTrees.branchRenderId = RenderingRegistry.getNextAvailableRenderId();
// RenderingRegistry.registerBlockHandler(new BranchBlockRenderer());
// RenderingRegistry.registerBlockHandler(new HedgeRenderer());
RecipeSorter.register("extratrees:multifence", MultiFenceRecipeSize.class, RecipeSorter.Category.SHAPED, "");
RecipeSorter.register("extratrees:multifence2", MultiFenceRecipeEmbedded.class, RecipeSorter.Category.SHAPED, "");
@@ -136,11 +171,11 @@ public class ModuleBlocks implements IInitializable {
for (final PlankType.ExtraTreePlanks plank : PlankType.ExtraTreePlanks.values()) {
final ItemStack planks = plank.getStack();
final ItemStack slabs = TileEntityMetadata.getItemStack(ExtraTrees.blockSlab, plank.ordinal());
final ItemStack stairs = TileEntityMetadata.getItemStack(ExtraTrees.blockStairs, plank.ordinal());
stairs.stackSize = 4;
GameRegistry.addRecipe(stairs.copy(), "# ", "## ", "###", '#', planks.copy());
slabs.stackSize = 6;
CraftingManager.getInstance().getRecipeList().add(0, new ShapedOreRecipe(slabs.copy(), "###", '#', planks.copy()));
//final ItemStack stairs = TileEntityMetadata.getItemStack(ExtraTrees.blockStairs, plank.ordinal());
//stairs.stackSize = 4;
//GameRegistry.addRecipe(stairs.copy(), "# ", "## ", "###", '#', planks.copy());
//slabs.stackSize = 6;
//CraftingManager.getInstance().getRecipeList().add(0, new ShapedOreRecipe(slabs.copy(), "###", '#', planks.copy()));
}
GameRegistry.addRecipe(new MultiFenceRecipeSize());
GameRegistry.addRecipe(new MultiFenceRecipeEmbedded());
@@ -11,6 +11,7 @@ import forestry.api.arboriculture.WoodBlockKind;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
public class PlankType {
public static final int MAX_PLANKS = 256;
@@ -30,7 +31,7 @@ public class PlankType {
}
}
public enum ExtraTreePlanks implements IPlankType, IFenceProvider {
public enum ExtraTreePlanks implements IPlankType, IFenceProvider, IStringSerializable {
Fir(12815444),
Cedar(14181940),
Hemlock(13088108),
@@ -91,7 +92,7 @@ public class PlankType {
@Override
public ItemStack getStack() {
return TileEntityMetadata.getItemStack(ExtraTrees.blockPlanks, this.ordinal());
return null; //TileEntityMetadata.getItemStack(ExtraTrees.blockPlanks, this.ordinal());
}
// public IIcon loadIcon(final IIconRegister register) {
@@ -38,8 +38,8 @@ public class ModuleCore implements IInitializable {
final PrintWriter outputFruit = new PrintWriter(new FileWriter("data/fruit.html"));
final PrintWriter outputDesigns = new PrintWriter(new FileWriter("data/designs.html"));
final Queue<IAlleleTreeSpecies> speciesQueue = new LinkedList<>();
for (final IAlleleTreeSpecies s : ExtraTreeSpecies.values()) {
speciesQueue.add(s);
for (final ExtraTreeSpecies s : ExtraTreeSpecies.values()) {
speciesQueue.add(s.getSpecies());
}
final Queue<IWoodType> logQueue = new LinkedList<>();
Collections.addAll(logQueue, EnumExtraTreeLog.values());
@@ -1,10 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenAlder {
public static class CommonAlder extends WorldGenTree {
public CommonAlder(final ITreeGenData tree) {
public CommonAlder(final ITree tree) {
super(tree);
}
@@ -1,11 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenApple {
public static class OrchardApple extends WorldGenTree {
public OrchardApple(final ITreeGenData tree) {
public OrchardApple(final ITree tree) {
super(tree);
}
@@ -1,10 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenAsh {
public static class CommonAsh extends WorldGenTree {
public CommonAsh(final ITreeGenData tree) {
public CommonAsh(final ITree tree) {
super(tree);
}
@@ -1,9 +1,9 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenBanana extends WorldGenTree {
public WorldGenBanana(final ITreeGenData tree) {
public WorldGenBanana(final ITree tree) {
super(tree);
}
@@ -1,9 +1,9 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenCitrus extends WorldGenTree {
public WorldGenCitrus(final ITreeGenData tree) {
public WorldGenCitrus(final ITree tree) {
super(tree);
}
@@ -1,11 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenConifer {
public static class WesternHemlock extends WorldGenTree {
public WesternHemlock(final ITreeGenData tree) {
public WesternHemlock(final ITree tree) {
super(tree);
}
@@ -1,9 +1,9 @@
package binnie.extratrees.gen;
import binnie.extratrees.genetics.ExtraTreeSpecies;
import binnie.extratrees.worldgen.BlockType;
import binnie.extratrees.worldgen.BlockTypeLeaf;
import binnie.extratrees.worldgen.BlockTypeLog;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenDefault extends WorldGenTree {
@@ -34,7 +34,7 @@ public class WorldGenDefault extends WorldGenTree {
@Override
public BlockType getWood() {
return new BlockTypeLog(((ExtraTreeSpecies) this.treeGen.getGenome().getPrimary()).getLog());
return new BlockTypeLog(this.treeGen);
}
}
@@ -1,13 +1,10 @@
package binnie.extratrees.gen;
import binnie.extratrees.block.EnumExtraTreeLog;
import binnie.extratrees.worldgen.BlockTypeLog;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenEucalyptus {
public static class SwampGum extends WorldGenTree {
public SwampGum(final ITreeGenData tree) {
public SwampGum(final ITree tree) {
super(tree);
}
@@ -75,7 +72,8 @@ public class WorldGenEucalyptus {
for (int x = 0; x < this.girth; ++x) {
for (int y = 0; y < this.girth; ++y) {
for (int i = 0; i < 2; ++i) {
this.addBlock(x - offset, i, y - offset, new BlockTypeLog(EnumExtraTreeLog.Eucalyptus2), true);
//TODO Eucalyptus2 log
//this.addBlock(x - offset, i, y - offset, new BlockTypeLog(EnumExtraTreeLog.Eucalyptus2), true);
}
}
}
@@ -1,11 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenFir {
public static class DouglasFir extends WorldGenTree {
public DouglasFir(final ITreeGenData tree) {
public DouglasFir(final ITree tree) {
super(tree);
}
@@ -1,10 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenHolly {
public static class Holly extends WorldGenTree {
public Holly(final ITreeGenData tree) {
public Holly(final ITree tree) {
super(tree);
}
@@ -1,11 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenJungle {
public static class Brazilwood extends WorldGenTree {
public Brazilwood(final ITreeGenData tree) {
public Brazilwood(final ITree tree) {
super(tree);
}
@@ -1,10 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenLazy {
public static class Tree extends WorldGenTree {
public Tree(final ITreeGenData tree) {
public Tree(final ITree tree) {
super(tree);
}
@@ -1,10 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenMaple {
public static class RedMaple extends WorldGenTree {
public RedMaple(final ITreeGenData tree) {
public RedMaple(final ITree tree) {
super(tree);
}
@@ -1,10 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenPalm {
public static class Coconut extends WorldGenTree {
public Coconut(final ITreeGenData tree) {
public Coconut(final ITree tree) {
super(tree);
}
@@ -1,10 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenPoplar {
public static class Aspen extends WorldGenTree {
public Aspen(final ITreeGenData tree) {
public Aspen(final ITree tree) {
super(tree);
}
@@ -1,9 +1,9 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenPrune extends WorldGenTree {
public WorldGenPrune(final ITreeGenData tree) {
public WorldGenPrune(final ITree tree) {
super(tree);
}
@@ -1,11 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenSorbus {
public static class Whitebeam extends WorldGenTree {
public Whitebeam(final ITreeGenData tree) {
public Whitebeam(final ITree tree) {
super(tree);
}
@@ -1,11 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenSpruce {
public static class GiantSpruce extends WorldGenTree {
public GiantSpruce(final ITreeGenData tree) {
public GiantSpruce(final ITree tree) {
super(tree);
}
@@ -1,11 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenTilia {
public static class Basswood extends WorldGenTree {
public Basswood(final ITreeGenData tree) {
public Basswood(final ITree tree) {
super(tree);
}
@@ -1,6 +1,5 @@
package binnie.extratrees.gen;
import binnie.extratrees.genetics.ExtraTreeSpecies;
import binnie.extratrees.worldgen.BlockType;
import binnie.extratrees.worldgen.BlockTypeLeaf;
import binnie.extratrees.worldgen.BlockTypeLog;
@@ -77,7 +76,7 @@ public abstract class WorldGenTree extends WorldGenerator {
}
public BlockType getWood() {
return new BlockTypeLog(((ExtraTreeSpecies) this.treeGen.getGenome().getPrimary()).getLog());
return new BlockTypeLog(treeGen);
}
public WorldGenTree(final ITreeGenData tree) {
@@ -1,11 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenTree2 {
public static class Olive extends WorldGenTree {
public Olive(final ITreeGenData tree) {
public Olive(final ITree tree) {
super(tree);
}
@@ -1,11 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.arboriculture.ITree;
import forestry.api.world.ITreeGenData;
public class WorldGenTree3 {
public static class Hazel extends WorldGenTree {
public Hazel(final ITreeGenData tree) {
public Hazel(final ITree tree) {
super(tree);
}
@@ -1,10 +1,10 @@
package binnie.extratrees.gen;
import forestry.api.world.ITreeGenData;
import forestry.api.arboriculture.ITree;
public class WorldGenTropical {
public static class Mango extends WorldGenTree {
public Mango(final ITreeGenData tree) {
public Mango(final ITree tree) {
super(tree);
}
@@ -0,0 +1,72 @@
package binnie.extratrees.genetics;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.IGermlingModelProvider;
import forestry.api.core.IModelManager;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.awt.*;
public enum EnumSaplingType {
Default,
Jungle,
Conifer,
Fruit,
Poplar,
Palm,
Shrub;
public IGermlingModelProvider getGermlingModelProvider(Color leaf, Color wood){
return new DefaultGermlingModelProvider(this, leaf, wood);
}
private class DefaultGermlingModelProvider implements IGermlingModelProvider {
private ModelResourceLocation germlingModel;
private ModelResourceLocation pollenModel;
private EnumSaplingType saplingType;
private Color leaf;
private Color wood;
public DefaultGermlingModelProvider(EnumSaplingType saplingType, Color leaf, Color wood) {
this.saplingType = saplingType;
this.wood = wood;
this.leaf = leaf;
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels(Item item, IModelManager manager, EnumGermlingType type) {
if (type == EnumGermlingType.SAPLING) {
germlingModel = manager.getModelLocation("extratrees", "saplings/tree" + name());
ModelBakery.registerItemVariants(item, new ResourceLocation("extratrees", "saplings/tree" + name()));
}
if (type == EnumGermlingType.POLLEN) {
pollenModel = manager.getModelLocation("pollen");
ModelBakery.registerItemVariants(item, new ResourceLocation("forestry:pollen"));
}
}
@Nonnull
@Override
public ModelResourceLocation getModel(EnumGermlingType type) {
if (type == EnumGermlingType.SAPLING) {
return germlingModel;
} else if (type == EnumGermlingType.POLLEN) {
return pollenModel;
} else {
return germlingModel;
}
}
@Override
public int getSpriteColor(EnumGermlingType type, int renderPass) {
return type == EnumGermlingType.SAPLING && renderPass==0 ? wood.getRGB() : leaf.getRGB();
}
}
}
@@ -29,103 +29,103 @@ public class ExtraTreeMutation implements ITreeMutation {
public static void init() {
final IAlleleTreeSpecies lemon = (IAlleleTreeSpecies) getVanilla("Lemon");
new ExtraTreeMutation(getVanilla("Cherry"), lemon, ExtraTreeSpecies.KeyLime, 10);
new ExtraTreeMutation(ExtraTreeSpecies.KeyLime, lemon, ExtraTreeSpecies.FingerLime, 10);
new ExtraTreeMutation(getVanilla("Cherry"), lemon, ExtraTreeSpecies.Pomelo, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, getVanilla("Cherry"), ExtraTreeSpecies.Manderin, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, lemon, ExtraTreeSpecies.Citron, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Manderin, getVanilla("Cherry"), ExtraTreeSpecies.Kumquat, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, ExtraTreeSpecies.Manderin, ExtraTreeSpecies.Orange, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Citron, ExtraTreeSpecies.Manderin, ExtraTreeSpecies.BuddhaHand, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Kumquat, ExtraTreeSpecies.Manderin, ExtraTreeSpecies.Tangerine, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Kumquat, ExtraTreeSpecies.Manderin, ExtraTreeSpecies.Satsuma, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, ExtraTreeSpecies.Orange, ExtraTreeSpecies.Grapefruit, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo, ExtraTreeSpecies.KeyLime, ExtraTreeSpecies.Lime, 10);
new ExtraTreeMutation(getVanilla("Oak"), getVanilla("Cherry"), ExtraTreeSpecies.OrchardApple, 10);
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple, getVanilla("Maple"), ExtraTreeSpecies.SweetCrabapple, 10);
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple, ExtraTreeSpecies.SweetCrabapple, ExtraTreeSpecies.FloweringCrabapple, 10);
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple, getVanilla("Birch"), ExtraTreeSpecies.PrairieCrabapple, 10);
new ExtraTreeMutation(getVanilla("Plum"), ExtraTreeSpecies.OrchardApple, ExtraTreeSpecies.Blackthorn, 10);
new ExtraTreeMutation(getVanilla("Plum"), getVanilla("Cherry"), ExtraTreeSpecies.CherryPlum, 10);
new ExtraTreeMutation(getVanilla("Plum"), getVanilla("Chestnut"), ExtraTreeSpecies.Peach, 10);
new ExtraTreeMutation(getVanilla("Plum"), ExtraTreeSpecies.Peach, ExtraTreeSpecies.Nectarine, 10);
new ExtraTreeMutation(getVanilla("Plum"), ExtraTreeSpecies.Peach, ExtraTreeSpecies.Apricot, 10);
new ExtraTreeMutation(getVanilla("Plum"), getVanilla("Walnut"), ExtraTreeSpecies.Almond, 10);
new ExtraTreeMutation(getVanilla("Lime"), getVanilla("Cherry"), ExtraTreeSpecies.WildCherry, 10);
new ExtraTreeMutation(getVanilla("Willow"), getVanilla("Cherry"), ExtraTreeSpecies.SourCherry, 10);
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Cherry"), ExtraTreeSpecies.BlackCherry, 10);
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Jungle"), ExtraTreeSpecies.Banana, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Banana, getVanilla("Kapok"), ExtraTreeSpecies.RedBanana, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Banana, getVanilla("Teak"), ExtraTreeSpecies.Plantain, 10);
new ExtraTreeMutation(getVanilla("Birch"), getVanilla("Oak"), ExtraTreeSpecies.Beech, 10);
new ExtraTreeMutation(getVanilla("Birch"), ExtraTreeSpecies.Beech, ExtraTreeSpecies.Alder, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Alder, ExtraTreeSpecies.Beech, ExtraTreeSpecies.Aspen, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Aspen, ExtraTreeSpecies.Alder, ExtraTreeSpecies.Rowan, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech, ExtraTreeSpecies.Aspen, ExtraTreeSpecies.Hazel, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech, ExtraTreeSpecies.Rowan, ExtraTreeSpecies.Hawthorn, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Alder, ExtraTreeSpecies.Aspen, ExtraTreeSpecies.Elder, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Alder, ExtraTreeSpecies.Rowan, ExtraTreeSpecies.Holly, 10);
new ExtraTreeMutation(getVanilla("Willow"), ExtraTreeSpecies.Aspen, ExtraTreeSpecies.Sallow, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech, getVanilla("Birch"), ExtraTreeSpecies.Pecan, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech, getVanilla("Spruce"), ExtraTreeSpecies.CopperBeech, 10);
new ExtraTreeMutation(getVanilla("Lime"), getVanilla("Spruce"), ExtraTreeSpecies.Ash, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Ash, getVanilla("Birch"), ExtraTreeSpecies.Whitebeam, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Ash, getVanilla("Pine"), ExtraTreeSpecies.Elm, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Ash, getVanilla("Larch"), ExtraTreeSpecies.Hornbeam, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Ash, getVanilla("Maple"), ExtraTreeSpecies.Sycamore, 10);
new ExtraTreeMutation(getVanilla("Larch"), getVanilla("Spruce"), ExtraTreeSpecies.Yew, 10);
new ExtraTreeMutation(getVanilla("Larch"), ExtraTreeSpecies.Alder, ExtraTreeSpecies.BalsamFir, 10);
new ExtraTreeMutation(getVanilla("Pine"), ExtraTreeSpecies.BalsamFir, ExtraTreeSpecies.Fir, 10);
new ExtraTreeMutation(getVanilla("Pine"), ExtraTreeSpecies.Fir, ExtraTreeSpecies.Hemlock, 10).setHeight(80);
new ExtraTreeMutation(ExtraTreeSpecies.Fir, getVanilla("Larch"), ExtraTreeSpecies.Cedar, 10).setHeight(60);
new ExtraTreeMutation(ExtraTreeSpecies.Fir, getVanilla("Spruce"), ExtraTreeSpecies.DouglasFir, 10).setHeight(60);
new ExtraTreeMutation(getVanilla("Pine"), getVanilla("Spruce"), ExtraTreeSpecies.Cypress, 10);
new ExtraTreeMutation(getVanilla("Pine"), getVanilla("Spruce"), ExtraTreeSpecies.LoblollyPine, 10);
new ExtraTreeMutation(getVanilla("Walnut"), getVanilla("Cherry"), ExtraTreeSpecies.Butternut, 10);
new ExtraTreeMutation(getVanilla("Walnut"), getVanilla("Oak"), ExtraTreeSpecies.AcornOak, 10);
new ExtraTreeMutation(getVanilla("Cherry"), ExtraTreeSpecies.Alder, ExtraTreeSpecies.Olive, 10);
new ExtraTreeMutation(getVanilla("Maple"), getVanilla("Lime"), ExtraTreeSpecies.RedMaple, 10);
new ExtraTreeMutation(getVanilla("Maple"), getVanilla("Larch"), ExtraTreeSpecies.Sweetgum, 10);
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Lime"), ExtraTreeSpecies.Locust, 10);
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Teak"), ExtraTreeSpecies.Iroko, 10);
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple, getVanilla("Birch"), ExtraTreeSpecies.Pear, 10);
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Teak"), ExtraTreeSpecies.OldFustic, 10);
new ExtraTreeMutation(ExtraTreeSpecies.OldFustic, getVanilla("Kapok"), ExtraTreeSpecies.OsangeOsange, 10);
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Teak"), ExtraTreeSpecies.Brazilwood, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Brazilwood, getVanilla("Kapok"), ExtraTreeSpecies.Purpleheart, 10);
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Teak"), ExtraTreeSpecies.Rosewood, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Rosewood, getVanilla("Kapok"), ExtraTreeSpecies.Logwood, 10);
new ExtraTreeMutation(getVanilla("Wenge"), getVanilla("Lime"), ExtraTreeSpecies.Gingko, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech, getVanilla("Jungle"), ExtraTreeSpecies.Brazilnut, 10);
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Jungle"), ExtraTreeSpecies.RoseGum, 10);
new ExtraTreeMutation(ExtraTreeSpecies.RoseGum, getVanilla("Mahogony"), ExtraTreeSpecies.SwampGum, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Coffee, getVanilla("Teak"), ExtraTreeSpecies.Clove, 10);
new ExtraTreeMutation(getVanilla("Cherry"), getVanilla("Jungle"), ExtraTreeSpecies.Coffee, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Holly, ExtraTreeSpecies.Alder, ExtraTreeSpecies.Box, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Hemlock, getVanilla("Jungle"), ExtraTreeSpecies.MonkeyPuzzle, 10);
new ExtraTreeMutation(ExtraTreeSpecies.RoseGum, getVanilla("Balsa"), ExtraTreeSpecies.RainbowGum, 10);
new ExtraTreeMutation(ExtraTreeSpecies.RoseGum, ExtraTreeSpecies.Brazilwood, ExtraTreeSpecies.PinkIvory, 10);
new ExtraTreeMutation(getVanilla("Cherry"), ExtraTreeSpecies.Elder, ExtraTreeSpecies.Raspberry, 10);
new ExtraTreeMutation(getVanilla("Cherry"), ExtraTreeSpecies.Elder, ExtraTreeSpecies.Redcurrant, 10);
new ExtraTreeMutation(ExtraTreeSpecies.BlackCherry, ExtraTreeSpecies.Redcurrant, ExtraTreeSpecies.Blackcurrant, 10);
new ExtraTreeMutation(ExtraTreeSpecies.BlackCherry, ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Blackberry, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Blackberry, ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Blueberry, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Blackberry, ExtraTreeSpecies.CherryPlum, ExtraTreeSpecies.Cranberry, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Fir, ExtraTreeSpecies.Juniper, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Lime, ExtraTreeSpecies.Gooseberry, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Raspberry, ExtraTreeSpecies.Orange, ExtraTreeSpecies.GoldenRaspberry, 10);
new ExtraTreeMutation(getVanilla("Teak"), ExtraTreeSpecies.Rosewood, ExtraTreeSpecies.Cinnamon, 10);
new ExtraTreeMutation(getVanilla("Balsa"), ExtraTreeSpecies.Brazilnut, ExtraTreeSpecies.Coconut, 10);
new ExtraTreeMutation(getVanilla("Teak"), getVanilla("Oak"), ExtraTreeSpecies.Cashew, 10);
new ExtraTreeMutation(getVanilla("Wenge"), getVanilla("Oak"), ExtraTreeSpecies.Avacado, 10);
new ExtraTreeMutation(getVanilla("Teak"), ExtraTreeSpecies.Clove, ExtraTreeSpecies.Nutmeg, 10);
new ExtraTreeMutation(getVanilla("Teak"), ExtraTreeSpecies.Clove, ExtraTreeSpecies.Allspice, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Allspice, ExtraTreeSpecies.Clove, ExtraTreeSpecies.StarAnise, 10);
new ExtraTreeMutation(getVanilla("Jungle"), ExtraTreeSpecies.Orange, ExtraTreeSpecies.Mango, 10);
new ExtraTreeMutation(ExtraTreeSpecies.StarAnise, ExtraTreeSpecies.Mango, ExtraTreeSpecies.Starfruit, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Hazel, ExtraTreeSpecies.Gingko, ExtraTreeSpecies.Candlenut, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Hazel, ExtraTreeSpecies.Gingko, ExtraTreeSpecies.Chilli, 10);
new ExtraTreeMutation(ExtraTreeSpecies.Hazel, ExtraTreeSpecies.Alder, ExtraTreeSpecies.DwarfHazel, 10);
new ExtraTreeMutation(getVanilla("Cherry"), lemon, ExtraTreeSpecies.KeyLime.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.KeyLime.getSpecies(), lemon, ExtraTreeSpecies.FingerLime.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Cherry"), lemon, ExtraTreeSpecies.Pomelo.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo.getSpecies(), getVanilla("Cherry"), ExtraTreeSpecies.Manderin.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo.getSpecies(), lemon, ExtraTreeSpecies.Citron.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Manderin.getSpecies(), getVanilla("Cherry"), ExtraTreeSpecies.Kumquat.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo.getSpecies(), ExtraTreeSpecies.Manderin.getSpecies(), ExtraTreeSpecies.Orange.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Citron.getSpecies(), ExtraTreeSpecies.Manderin.getSpecies(), ExtraTreeSpecies.BuddhaHand.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Kumquat.getSpecies(), ExtraTreeSpecies.Manderin.getSpecies(), ExtraTreeSpecies.Tangerine.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Kumquat.getSpecies(), ExtraTreeSpecies.Manderin.getSpecies(), ExtraTreeSpecies.Satsuma.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo.getSpecies(), ExtraTreeSpecies.Orange.getSpecies(), ExtraTreeSpecies.Grapefruit.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Pomelo.getSpecies(), ExtraTreeSpecies.KeyLime.getSpecies(), ExtraTreeSpecies.Lime.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Oak"), getVanilla("Cherry"), ExtraTreeSpecies.OrchardApple.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple.getSpecies(), getVanilla("Maple"), ExtraTreeSpecies.SweetCrabapple.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple.getSpecies(), ExtraTreeSpecies.SweetCrabapple.getSpecies(), ExtraTreeSpecies.FloweringCrabapple.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple.getSpecies(), getVanilla("Birch"), ExtraTreeSpecies.PrairieCrabapple.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Plum"), ExtraTreeSpecies.OrchardApple.getSpecies(), ExtraTreeSpecies.Blackthorn.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Plum"), getVanilla("Cherry"), ExtraTreeSpecies.CherryPlum.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Plum"), getVanilla("Chestnut"), ExtraTreeSpecies.Peach.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Plum"), ExtraTreeSpecies.Peach.getSpecies(), ExtraTreeSpecies.Nectarine.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Plum"), ExtraTreeSpecies.Peach.getSpecies(), ExtraTreeSpecies.Apricot.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Plum"), getVanilla("Walnut"), ExtraTreeSpecies.Almond.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Lime"), getVanilla("Cherry"), ExtraTreeSpecies.WildCherry.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Willow"), getVanilla("Cherry"), ExtraTreeSpecies.SourCherry.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Cherry"), ExtraTreeSpecies.BlackCherry.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Jungle"), ExtraTreeSpecies.Banana.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Banana.getSpecies(), getVanilla("Kapok"), ExtraTreeSpecies.RedBanana.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Banana.getSpecies(), getVanilla("Teak"), ExtraTreeSpecies.Plantain.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Birch"), getVanilla("Oak"), ExtraTreeSpecies.Beech.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Birch"), ExtraTreeSpecies.Beech.getSpecies(), ExtraTreeSpecies.Alder.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Alder.getSpecies(), ExtraTreeSpecies.Beech.getSpecies(), ExtraTreeSpecies.Aspen.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Aspen.getSpecies(), ExtraTreeSpecies.Alder.getSpecies(), ExtraTreeSpecies.Rowan.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech.getSpecies(), ExtraTreeSpecies.Aspen.getSpecies(), ExtraTreeSpecies.Hazel.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech.getSpecies(), ExtraTreeSpecies.Rowan.getSpecies(), ExtraTreeSpecies.Hawthorn.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Alder.getSpecies(), ExtraTreeSpecies.Aspen.getSpecies(), ExtraTreeSpecies.Elder.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Alder.getSpecies(), ExtraTreeSpecies.Rowan.getSpecies(), ExtraTreeSpecies.Holly.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Willow"), ExtraTreeSpecies.Aspen.getSpecies(), ExtraTreeSpecies.Sallow.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech.getSpecies(), getVanilla("Birch"), ExtraTreeSpecies.Pecan.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech.getSpecies(), getVanilla("Spruce"), ExtraTreeSpecies.CopperBeech.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Lime"), getVanilla("Spruce"), ExtraTreeSpecies.Ash.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Ash.getSpecies(), getVanilla("Birch"), ExtraTreeSpecies.Whitebeam.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Ash.getSpecies(), getVanilla("Pine"), ExtraTreeSpecies.Elm.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Ash.getSpecies(), getVanilla("Larch"), ExtraTreeSpecies.Hornbeam.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Ash.getSpecies(), getVanilla("Maple"), ExtraTreeSpecies.Sycamore.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Larch"), getVanilla("Spruce"), ExtraTreeSpecies.Yew.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Larch"), ExtraTreeSpecies.Alder.getSpecies(), ExtraTreeSpecies.BalsamFir.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Pine"), ExtraTreeSpecies.BalsamFir.getSpecies(), ExtraTreeSpecies.Fir.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Pine"), ExtraTreeSpecies.Fir.getSpecies(), ExtraTreeSpecies.Hemlock.getSpecies(), 10).setHeight(80);
new ExtraTreeMutation(ExtraTreeSpecies.Fir.getSpecies(), getVanilla("Larch"), ExtraTreeSpecies.Cedar.getSpecies(), 10).setHeight(60);
new ExtraTreeMutation(ExtraTreeSpecies.Fir.getSpecies(), getVanilla("Spruce"), ExtraTreeSpecies.DouglasFir.getSpecies(), 10).setHeight(60);
new ExtraTreeMutation(getVanilla("Pine"), getVanilla("Spruce"), ExtraTreeSpecies.Cypress.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Pine"), getVanilla("Spruce"), ExtraTreeSpecies.LoblollyPine.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Walnut"), getVanilla("Cherry"), ExtraTreeSpecies.Butternut.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Walnut"), getVanilla("Oak"), ExtraTreeSpecies.AcornOak.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Cherry"), ExtraTreeSpecies.Alder.getSpecies(), ExtraTreeSpecies.Olive.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Maple"), getVanilla("Lime"), ExtraTreeSpecies.RedMaple.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Maple"), getVanilla("Larch"), ExtraTreeSpecies.Sweetgum.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Lime"), ExtraTreeSpecies.Locust.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Teak"), ExtraTreeSpecies.Iroko.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.OrchardApple.getSpecies(), getVanilla("Birch"), ExtraTreeSpecies.Pear.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Teak"), ExtraTreeSpecies.OldFustic.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.OldFustic.getSpecies(), getVanilla("Kapok"), ExtraTreeSpecies.OsangeOsange.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Teak"), ExtraTreeSpecies.Brazilwood.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Brazilwood.getSpecies(), getVanilla("Kapok"), ExtraTreeSpecies.Purpleheart.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Ebony"), getVanilla("Teak"), ExtraTreeSpecies.Rosewood.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Rosewood.getSpecies(), getVanilla("Kapok"), ExtraTreeSpecies.Logwood.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Wenge"), getVanilla("Lime"), ExtraTreeSpecies.Gingko.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Beech.getSpecies(), getVanilla("Jungle"), ExtraTreeSpecies.Brazilnut.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Balsa"), getVanilla("Jungle"), ExtraTreeSpecies.RoseGum.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.RoseGum.getSpecies(), getVanilla("Mahogony"), ExtraTreeSpecies.SwampGum.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Coffee.getSpecies(), getVanilla("Teak"), ExtraTreeSpecies.Clove.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Cherry"), getVanilla("Jungle"), ExtraTreeSpecies.Coffee.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Holly.getSpecies(), ExtraTreeSpecies.Alder.getSpecies(), ExtraTreeSpecies.Box.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Hemlock.getSpecies(), getVanilla("Jungle"), ExtraTreeSpecies.MonkeyPuzzle.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.RoseGum.getSpecies(), getVanilla("Balsa"), ExtraTreeSpecies.RainbowGum.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.RoseGum.getSpecies(), ExtraTreeSpecies.Brazilwood.getSpecies(), ExtraTreeSpecies.PinkIvory.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Cherry"), ExtraTreeSpecies.Elder.getSpecies(), ExtraTreeSpecies.Raspberry.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Cherry"), ExtraTreeSpecies.Elder.getSpecies(), ExtraTreeSpecies.Redcurrant.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.BlackCherry.getSpecies(), ExtraTreeSpecies.Redcurrant.getSpecies(), ExtraTreeSpecies.Blackcurrant.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.BlackCherry.getSpecies(), ExtraTreeSpecies.Raspberry.getSpecies(), ExtraTreeSpecies.Blackberry.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Blackberry.getSpecies(), ExtraTreeSpecies.Raspberry.getSpecies(), ExtraTreeSpecies.Blueberry.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Blackberry.getSpecies(), ExtraTreeSpecies.CherryPlum.getSpecies(), ExtraTreeSpecies.Cranberry.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Raspberry.getSpecies(), ExtraTreeSpecies.Fir.getSpecies(), ExtraTreeSpecies.Juniper.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Raspberry.getSpecies(), ExtraTreeSpecies.Lime.getSpecies(), ExtraTreeSpecies.Gooseberry.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Raspberry.getSpecies(), ExtraTreeSpecies.Orange.getSpecies(), ExtraTreeSpecies.GoldenRaspberry.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Teak"), ExtraTreeSpecies.Rosewood.getSpecies(), ExtraTreeSpecies.Cinnamon.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Balsa"), ExtraTreeSpecies.Brazilnut.getSpecies(), ExtraTreeSpecies.Coconut.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Teak"), getVanilla("Oak"), ExtraTreeSpecies.Cashew.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Wenge"), getVanilla("Oak"), ExtraTreeSpecies.Avacado.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Teak"), ExtraTreeSpecies.Clove.getSpecies(), ExtraTreeSpecies.Nutmeg.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Teak"), ExtraTreeSpecies.Clove.getSpecies(), ExtraTreeSpecies.Allspice.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Allspice.getSpecies(), ExtraTreeSpecies.Clove.getSpecies(), ExtraTreeSpecies.StarAnise.getSpecies(), 10);
new ExtraTreeMutation(getVanilla("Jungle"), ExtraTreeSpecies.Orange.getSpecies(), ExtraTreeSpecies.Mango.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.StarAnise.getSpecies(), ExtraTreeSpecies.Mango.getSpecies(), ExtraTreeSpecies.Starfruit.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Hazel.getSpecies(), ExtraTreeSpecies.Gingko.getSpecies(), ExtraTreeSpecies.Candlenut.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Hazel.getSpecies(), ExtraTreeSpecies.Gingko.getSpecies(), ExtraTreeSpecies.Chilli.getSpecies(), 10);
new ExtraTreeMutation(ExtraTreeSpecies.Hazel.getSpecies(), ExtraTreeSpecies.Alder.getSpecies(), ExtraTreeSpecies.DwarfHazel.getSpecies(), 10);
}
public static IAllele getVanilla(final String uid) {
File diff suppressed because it is too large. Load diff
@@ -8,7 +8,6 @@ import forestry.api.genetics.IClassification;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class ModuleGenetics implements IInitializable {
String[] branches;
@@ -27,12 +26,9 @@ public class ModuleGenetics implements IInitializable {
@Override
public void init() {
ExtraTreeSpecies.init();
ExtraTreeFruitGene.init();
for (final ExtraTreeSpecies species : ExtraTreeSpecies.values()) {
Binnie.Genetics.getTreeRoot().registerTemplate(species.getTemplate());
}
ExtraTreeMutation.init();
ExtraTreeSpecies.initTrees();
ExtraTreeMutation.init();
}
@Override
@@ -52,52 +48,4 @@ public class ModuleGenetics implements IInitializable {
}
}
}
private void generateBranches() {
for (final String hierarchy : this.branches) {
final List<String> set = new ArrayList<>();
for (final String string : hierarchy.split(" ", 0)) {
set.add(string.toLowerCase());
}
this.classifications.add(set);
}
for (final ExtraTreeSpecies species : ExtraTreeSpecies.values()) {
final IClassification branch = this.getOrCreateClassification(IClassification.EnumClassLevel.GENUS, species.getBranchName());
branch.addMemberSpecies(species);
species.setBranch(branch);
IClassification clss = branch;
int currentLevel = IClassification.EnumClassLevel.GENUS.ordinal();
while (clss.getParent() == null) {
for (final List<String> set2 : this.classifications) {
if (set2.contains(clss.getScientific().toLowerCase())) {
String nextLevel = "";
int index = set2.indexOf(clss.getScientific().toLowerCase()) + 1;
while (nextLevel.length() == 0) {
try {
nextLevel = set2.get(index++);
} catch (IndexOutOfBoundsException ex) {
throw new RuntimeException("Reached end point at " + set2.get(index - 2));
}
--currentLevel;
}
final IClassification parent = this.getOrCreateClassification(IClassification.EnumClassLevel.values()[currentLevel], nextLevel);
parent.addMemberGroup(clss);
clss = parent;
break;
}
}
}
}
}
private IClassification getOrCreateClassification(final IClassification.EnumClassLevel level, String name) {
if (level == IClassification.EnumClassLevel.GENUS) {
name = "trees." + name;
}
final String uid = level.name().toLowerCase(Locale.ENGLISH) + "." + name.toLowerCase();
if (AlleleManager.alleleRegistry.getClassification(uid) != null) {
return AlleleManager.alleleRegistry.getClassification(uid);
}
return AlleleManager.alleleRegistry.createAndRegisterClassification(level, name.toLowerCase(), name);
}
}
}
@@ -0,0 +1,75 @@
package binnie.extratrees.genetics;
import binnie.extratrees.gen.WorldGenDefault;
import com.mojang.authlib.GameProfile;
import forestry.api.arboriculture.*;
import forestry.api.world.ITreeGenData;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.genetics.Tree;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.core.genetics.alleles.AlleleBoolean;
import forestry.core.tiles.TileUtil;
import net.minecraft.block.Block;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import javax.annotation.Nullable;
public class TreeGenerator implements ITreeGenerator {
Class<? extends WorldGenerator> generator;
IWoodType woodType;
public TreeGenerator(Class<? extends WorldGenerator> generator, @Nullable IWoodType woodType) {
this.generator = generator;
this.woodType = woodType;
}
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
try {
return generator.getConstructor(ITree.class).newInstance(tree);
} catch (Exception ex) {
ex.printStackTrace();
}
return new WorldGenDefault(tree);
}
@Override
public boolean setLogBlock(ITreeGenome genome, World world, BlockPos pos, EnumFacing facing) {
if (woodType != null) {
AlleleBoolean fireproofAllele = (AlleleBoolean) genome.getActiveAllele(EnumTreeChromosome.FIREPROOF);
boolean fireproof = fireproofAllele.getValue();
return world.setBlockState(pos, WoodAccess.getInstance().getBlock(woodType, WoodBlockKind.LOG, fireproof), 2);
}
return false;
}
@Override
public boolean setLeaves(ITreeGenome genome, World world, GameProfile owner, BlockPos pos) {
boolean placed = world.setBlockState(pos, PluginArboriculture.blocks.leaves.getDefaultState());
if (!placed) {
return false;
}
Block block = world.getBlockState(pos).getBlock();
if (PluginArboriculture.blocks.leaves != block) {
world.setBlockToAir(pos);
return false;
}
TileLeaves tileLeaves = TileUtil.getTile(world, pos, TileLeaves.class);
if (tileLeaves == null) {
world.setBlockToAir(pos);
return false;
}
tileLeaves.getOwnerHandler().setOwner(owner);
tileLeaves.setTree(new Tree(genome));
world.markBlockRangeForRenderUpdate(pos, pos);
return true;
}
}
@@ -2,6 +2,7 @@ package binnie.extratrees.genetics;
import forestry.api.arboriculture.IWoodAccess;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import net.minecraft.block.Block;
import net.minecraft.block.properties.PropertyEnum;
@@ -11,14 +12,26 @@ import org.apache.commons.lang3.NotImplementedException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class WoodAccess implements IWoodAccess {
static HashMap<IWoodType, IBlockState> woodMap = new HashMap<>();
private WoodHolder wood = new WoodHolder();
private WoodHolder woodFireproof= new WoodHolder();
public static <T extends Block, V extends Enum<V> & IWoodType> void registerWithVariants(T woodTyped, WoodBlockKind woodBlockKind, PropertyEnum<V> property) {
private static final WoodAccess instance = new WoodAccess();
public static WoodAccess getInstance() {
return instance;
}
public <T extends Block, V extends Enum<V> & IWoodType> void registerWithVariants(T woodTyped, WoodBlockKind woodBlockKind, PropertyEnum<V> property, boolean fireproof) {
for (V value : property.getAllowedValues()) {
IBlockState blockState = woodTyped.getDefaultState().withProperty(property, value);
woodMap.put(value, blockState);
if(fireproof) {
wood.addWood(value, woodBlockKind, blockState);
}else {
woodFireproof.addWood(value, woodBlockKind, blockState);
}
}
}
@@ -29,11 +42,30 @@ public class WoodAccess implements IWoodAccess {
@Override
public IBlockState getBlock(IWoodType woodType, WoodBlockKind kind, boolean fireproof) {
return woodMap.get(woodType);
IBlockState state = fireproof?woodFireproof.getWood(woodType, kind) : wood.getWood(woodType, kind);
return state==null? TreeManager.woodAccess.getBlock(woodType, kind, fireproof) : state;
}
@Override
public List<IWoodType> getRegisteredWoodTypes() {
throw new NotImplementedException("");
}
private class WoodHolder{
private Map<WoodBlockKind, Map<IWoodType, IBlockState>> woodMap = new HashMap<>();
public void addWood(IWoodType woodType, WoodBlockKind kind, IBlockState state){
Map<IWoodType, IBlockState> woodTypes = woodMap.get(kind);
if (woodTypes == null){
woodTypes = new HashMap<>();
woodMap.put(kind, woodTypes);
}
woodTypes.put(woodType, state);
}
public IBlockState getWood(IWoodType woodType, WoodBlockKind kind){
Map<IWoodType, IBlockState> woodTypes = woodMap.get(kind);
return woodTypes!=null ? woodTypes.get(woodType) : null;
}
}
}
@@ -1,29 +1,20 @@
package binnie.extratrees.worldgen;
import binnie.extratrees.genetics.WoodAccess;
import forestry.api.arboriculture.IWoodType;
import forestry.api.arboriculture.TreeManager;
import forestry.api.arboriculture.WoodBlockKind;
import forestry.api.world.ITreeGenData;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockTypeLog extends BlockType {
IWoodType log;
ITreeGenData treeGenData;
public BlockTypeLog(final IWoodType log) {
public BlockTypeLog(ITreeGenData treeGenData) {
super(null, 0);
this.log = log;
this.treeGenData = treeGenData;
}
@Override
public void setBlock(final World world, final ITreeGenData tree, final BlockPos pos) {
IBlockState blockState = new WoodAccess().getBlock(log, WoodBlockKind.LOG, false);
if (blockState == null)
blockState = TreeManager.woodAccess.getBlock(log, WoodBlockKind.LOG, false);
world.setBlockState(pos, blockState, 2);
//this.log.placeBlock(world, new BlockPos(x, y, z));
treeGenData.setLogBlock(world, pos, EnumFacing.UP);
}
}