mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 12:09:39 +00:00
Fix #1681 Worldgen leaves are not decaying
This commit is contained in:
1 parent
f7cc35d949
commit
828dd63acd
2 files changed
+14
-4
No files matched your search
@@ -2,6 +2,7 @@ package forestry.arboriculture;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.arboriculture.blocks.BlockAbstractLeaves;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -23,12 +24,19 @@ public class LeafDecayHelper {
|
||||
leafDecayValues = new byte[ARRAY_SIZE][ARRAY_SIZE][ARRAY_SIZE];
|
||||
}
|
||||
|
||||
public static void leafDecay(BlockLeaves leaves, World world, BlockPos pos) {
|
||||
public static void leafDecay(BlockAbstractLeaves leaves, World world, BlockPos pos) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
// Fix a bug where Forestry leaves were not decayable.
|
||||
// The non-decayable Forestry leaves are all BlockDecorativeLeaves.
|
||||
if (!state.getValue(BlockLeaves.DECAYABLE)) {
|
||||
state = state.withProperty(BlockLeaves.DECAYABLE, true);
|
||||
world.setBlockState(pos, state);
|
||||
}
|
||||
|
||||
if (state.getValue(BlockLeaves.CHECK_DECAY) && state.getValue(BlockLeaves.DECAYABLE)) {
|
||||
byte radius = 4;
|
||||
int arrayOffset = ARRAY_SIZE / 2;
|
||||
|
||||
@@ -32,6 +32,7 @@ import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
import forestry.core.utils.OreDictUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -246,11 +247,12 @@ public class BlockRegistryArboriculture extends BlockRegistry {
|
||||
registerBlock(leaves, new ItemBlockLeaves(leaves), "leaves.default." + leaves.getBlockNumber());
|
||||
registerOreDictWildcard(OreDictUtil.TREE_LEAVES, leaves);
|
||||
|
||||
for (IBlockState state : leaves.getBlockState().getValidStates()) {
|
||||
TreeDefinition treeDefinition = leaves.getTreeDefinition(state);
|
||||
PropertyTreeType treeType = leaves.getVariant();
|
||||
for (TreeDefinition treeDefinition : treeType.getAllowedValues()) {
|
||||
Preconditions.checkNotNull(treeDefinition);
|
||||
String speciesUid = treeDefinition.getUID();
|
||||
speciesToLeavesDefault.put(speciesUid, state);
|
||||
IBlockState blockState = leaves.getDefaultState().withProperty(treeType, treeDefinition);
|
||||
speciesToLeavesDefault.put(speciesUid, blockState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user