Files
MinecraftForge/patches/minecraft/net/minecraft/block/BushBlock.java.patch
T
embeddedt ed3ac8a122 [1.16.5] Update more parts of the toolchain (#9825)
* ForgeGradle 6, Gradle 8.4, ASM 9.6
* Apply official mappings to patches (still using MCP classnames)
* Remove reference to SpecialSource in reobfJar-like tasks
* Backport modern MDK
* Rename TransformationMatrix methods to prevent reobf, add back vanilla name via coremod
2023-12-20 10:49:06 -08:00

34 lines
1.5 KiB
Diff

--- a/net/minecraft/block/BushBlock.java
+++ b/net/minecraft/block/BushBlock.java
@@ -7,7 +_,7 @@
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
-public class BushBlock extends Block {
+public class BushBlock extends Block implements net.minecraftforge.common.IPlantable {
public BushBlock(AbstractBlock.Properties p_i48437_1_) {
super(p_i48437_1_);
}
@@ -22,6 +_,8 @@
public boolean canSurvive(BlockState p_196260_1_, IWorldReader p_196260_2_, BlockPos p_196260_3_) {
BlockPos blockpos = p_196260_3_.below();
+ if (p_196260_1_.getBlock() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
+ return p_196260_2_.getBlockState(blockpos).canSustainPlant(p_196260_2_, blockpos, Direction.UP, this);
return this.mayPlaceOn(p_196260_2_.getBlockState(blockpos), p_196260_2_, blockpos);
}
@@ -31,5 +_,12 @@
public boolean isPathfindable(BlockState p_196266_1_, IBlockReader p_196266_2_, BlockPos p_196266_3_, PathType p_196266_4_) {
return p_196266_4_ == PathType.AIR && !this.hasCollision ? true : super.isPathfindable(p_196266_1_, p_196266_2_, p_196266_3_, p_196266_4_);
+ }
+
+ @Override
+ public BlockState getPlant(IBlockReader world, BlockPos pos) {
+ BlockState state = world.getBlockState(pos);
+ if (state.getBlock() != this) return defaultBlockState();
+ return state;
}
}