Fix leaves and saplings, Fix #1157 Exception loading model for Saplings and Leaves, Fix #1167 Broken natural leaves, Fix #1164 Leaves breaking instantly

This commit is contained in:
Nedelosk committed 2016-05-16 01:09:51 +02:00
1 parent ba5a2529df
commit 23b5126d51
3 files changed
+9 -3

No files matched your search

@@ -164,12 +164,12 @@ public class BlockRegistryArboriculture extends BlockRegistry {
// Saplings
TreeDefinition.preInit();
saplingGE = new BlockSapling();
registerBlock(new BlockSapling(), new ItemBlockForestry(saplingGE), "saplingGE");
registerBlock(saplingGE, new ItemBlockForestry(saplingGE), "saplingGE");
registerOreDictWildcard("treeSapling", saplingGE);
// Leaves
leaves = new BlockForestryLeaves();
registerBlock(new BlockForestryLeaves(), new ItemBlockLeaves(leaves), "leaves");
registerBlock(leaves, new ItemBlockLeaves(leaves), "leaves");
registerOreDictWildcard("treeLeaves", leaves);
leavesDecorative = BlockDecorativeLeaves.create();
@@ -19,9 +19,10 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.property.IExtendedBlockState;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.core.IModelBaker;
import forestry.arboriculture.blocks.BlockForestryLeaves;
import forestry.arboriculture.genetics.TreeDefinition;
import forestry.arboriculture.genetics.TreeRoot;
import forestry.arboriculture.items.ItemBlockLeaves;
import forestry.arboriculture.tiles.TileLeaves;
@@ -71,6 +72,8 @@ public class ModelLeaves extends ModelBlockDefault<BlockForestryLeaves> {
public void bakeWorldBlock(@Nonnull BlockForestryLeaves block, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IExtendedBlockState stateExtended, @Nonnull IModelBaker baker) {
TileLeaves tile = TileUtil.getTile(world, pos, TileLeaves.class);
if (tile == null) {
IAlleleTreeSpecies oakSpecies = TreeDefinition.Oak.getIndividual().getGenome().getPrimary();
baker.setParticleSprite(oakSpecies.getLeafSpriteProvider().getSprite(false, Proxies.render.fancyGraphicsEnabled()));
return;
}
@@ -48,6 +48,9 @@ public abstract class TileUtil {
}
public static <T extends TileEntity> T getTile(IBlockAccess world, BlockPos pos, Class<T> tileClass) {
if(pos == null){
return null;
}
TileEntity tileEntity = world.getTileEntity(pos);
if (tileClass.isInstance(tileEntity)) {
return tileClass.cast(tileEntity);