diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/FungusBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/block/FungusBlock.java.patch | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/FungusBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/FungusBlock.java.patch new file mode 100644 index 0000000000..ca895468af --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/FungusBlock.java.patch @@ -0,0 +1,101 @@ +--- a/net/minecraft/world/level/block/FungusBlock.java ++++ b/net/minecraft/world/level/block/FungusBlock.java +@@ -15,7 +15,7 @@ + import net.minecraft.world.level.Level; + import net.minecraft.world.level.LevelReader; + import net.minecraft.world.level.block.state.BlockBehaviour; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.VoxelShape; +@@ -23,10 +23,10 @@ + public class FungusBlock extends BushBlock implements BonemealableBlock { + + public static final MapCodec<FungusBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> { +- return instance.group(ResourceKey.codec(Registries.CONFIGURED_FEATURE).fieldOf("feature").forGetter((fungusblock) -> { +- return fungusblock.feature; +- }), BuiltInRegistries.BLOCK.byNameCodec().fieldOf("grows_on").forGetter((fungusblock) -> { +- return fungusblock.requiredBlock; ++ return instance.group(ResourceKey.codec(Registries.CONFIGURED_FEATURE).fieldOf("feature").forGetter((blockfungi) -> { ++ return blockfungi.feature; ++ }), BuiltInRegistries.BLOCK.byNameCodec().fieldOf("grows_on").forGetter((blockfungi) -> { ++ return blockfungi.requiredBlock; + }), propertiesCodec()).apply(instance, FungusBlock::new); + }); + protected static final VoxelShape SHAPE = Block.box(4.0D, 0.0D, 4.0D, 12.0D, 9.0D, 12.0D); +@@ -35,52 +35,53 @@ + private final ResourceKey<ConfiguredFeature<?, ?>> feature; + + @Override +- @Override + public MapCodec<FungusBlock> codec() { + return FungusBlock.CODEC; + } + +- protected FungusBlock(ResourceKey<ConfiguredFeature<?, ?>> resourcekey, Block block, BlockBehaviour.Properties blockbehaviour_properties) { +- super(blockbehaviour_properties); ++ protected FungusBlock(ResourceKey<ConfiguredFeature<?, ?>> resourcekey, Block block, BlockBehaviour.Properties blockbase_info) { ++ super(blockbase_info); + this.feature = resourcekey; + this.requiredBlock = block; + } + + @Override +- @Override +- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { ++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { + return FungusBlock.SHAPE; + } + + @Override +- @Override +- protected boolean mayPlaceOn(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos) { +- return blockstate.is(BlockTags.NYLIUM) || blockstate.is(Blocks.MYCELIUM) || blockstate.is(Blocks.SOUL_SOIL) || super.mayPlaceOn(blockstate, blockgetter, blockpos); ++ protected boolean mayPlaceOn(IBlockData state, BlockGetter level, BlockPos pos) { ++ return state.is(BlockTags.NYLIUM) || state.is(Blocks.MYCELIUM) || state.is(Blocks.SOUL_SOIL) || super.mayPlaceOn(state, level, pos); + } + +- private Optional<? extends Holder<ConfiguredFeature<?, ?>>> getFeature(LevelReader levelreader) { +- return levelreader.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(this.feature); ++ private Optional<? extends Holder<ConfiguredFeature<?, ?>>> getFeature(LevelReader level) { ++ return level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(this.feature); + } + + @Override +- @Override +- public boolean isValidBonemealTarget(LevelReader levelreader, BlockPos blockpos, BlockState blockstate) { +- BlockState blockstate1 = levelreader.getBlockState(blockpos.below()); ++ public boolean isValidBonemealTarget(LevelReader iworldreader, BlockPos blockposition, IBlockData iblockdata) { ++ IBlockData iblockdata1 = iworldreader.getBlockState(blockposition.below()); + +- return blockstate1.is(this.requiredBlock); ++ return iblockdata1.is(this.requiredBlock); + } + + @Override +- @Override +- public boolean isBonemealSuccess(Level level, RandomSource randomsource, BlockPos blockpos, BlockState blockstate) { +- return (double) randomsource.nextFloat() < 0.4D; ++ public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, IBlockData state) { ++ return (double) random.nextFloat() < 0.4D; + } + + @Override +- @Override +- public void performBonemeal(ServerLevel serverlevel, RandomSource randomsource, BlockPos blockpos, BlockState blockstate) { +- this.getFeature(serverlevel).ifPresent((holder) -> { +- ((ConfiguredFeature) holder.value()).place(serverlevel, serverlevel.getChunkSource().getGenerator(), randomsource, blockpos); ++ public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, IBlockData state) { ++ this.getFeature(level).ifPresent((holder) -> { ++ // CraftBukkit start ++ if (this == Blocks.WARPED_FUNGUS) { ++ SaplingBlock.treeType = org.bukkit.TreeType.WARPED_FUNGUS; ++ } else if (this == Blocks.CRIMSON_FUNGUS) { ++ SaplingBlock.treeType = org.bukkit.TreeType.CRIMSON_FUNGUS; ++ } ++ // CraftBukkit end ++ ((ConfiguredFeature) holder.value()).place(level, level.getChunkSource().getGenerator(), random, pos); + }); + } + } |