aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/block/FungusBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/FungusBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/block/FungusBlock.java.patch108
1 files changed, 108 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/FungusBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/FungusBlock.java.patch
new file mode 100644
index 0000000000..a870ac1086
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/FungusBlock.java.patch
@@ -0,0 +1,108 @@
+--- a/net/minecraft/world/level/block/FungusBlock.java
++++ b/net/minecraft/world/level/block/FungusBlock.java
+@@ -2,7 +2,6 @@
+
+ import com.mojang.serialization.MapCodec;
+ import com.mojang.serialization.codecs.RecordCodecBuilder;
+-import com.mojang.serialization.codecs.RecordCodecBuilder.Instance;
+ import java.util.Optional;
+ import net.minecraft.core.BlockPos;
+ import net.minecraft.core.Holder;
+@@ -16,43 +15,43 @@
+ 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;
+
+ public class FungusBlock extends BushBlock implements BonemealableBlock {
+- public static final MapCodec<FungusBlock> CODEC = RecordCodecBuilder.mapCodec(
+- instance -> instance.group(
+- ResourceKey.codec(Registries.CONFIGURED_FEATURE).fieldOf("feature").forGetter(fungusBlock -> fungusBlock.feature),
+- BuiltInRegistries.BLOCK.byNameCodec().fieldOf("grows_on").forGetter(fungusBlock -> fungusBlock.requiredBlock),
+- propertiesCodec()
+- )
+- .apply(instance, FungusBlock::new)
+- );
+- protected static final VoxelShape SHAPE = Block.box(4.0, 0.0, 4.0, 12.0, 9.0, 12.0);
+- private static final double BONEMEAL_SUCCESS_PROBABILITY = 0.4;
++
++ public static final MapCodec<FungusBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
++ 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);
++ private static final double BONEMEAL_SUCCESS_PROBABILITY = 0.4D;
+ private final Block requiredBlock;
+ private final ResourceKey<ConfiguredFeature<?, ?>> feature;
+
+ @Override
+ public MapCodec<FungusBlock> codec() {
+- return CODEC;
++ return FungusBlock.CODEC;
+ }
+
+- protected FungusBlock(ResourceKey<ConfiguredFeature<?, ?>> resourceKey, Block block, BlockBehaviour.Properties properties) {
+- super(properties);
+- this.feature = resourceKey;
++ protected FungusBlock(ResourceKey<ConfiguredFeature<?, ?>> resourcekey, Block block, BlockBehaviour.Properties blockbase_info) {
++ super(blockbase_info);
++ this.feature = resourcekey;
+ this.requiredBlock = block;
+ }
+
+ @Override
+- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
+- return SHAPE;
++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
++ return FungusBlock.SHAPE;
+ }
+
+ @Override
+- protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) {
++ 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);
+ }
+
+@@ -61,18 +60,28 @@
+ }
+
+ @Override
+- public boolean isValidBonemealTarget(LevelReader levelReader, BlockPos blockPos, BlockState blockState) {
+- BlockState blockState1 = levelReader.getBlockState(blockPos.below());
+- return blockState1.is(this.requiredBlock);
++ public boolean isValidBonemealTarget(LevelReader iworldreader, BlockPos blockposition, IBlockData iblockdata) {
++ IBlockData iblockdata1 = iworldreader.getBlockState(blockposition.below());
++
++ return iblockdata1.is(this.requiredBlock);
+ }
+
+ @Override
+- public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
+- return (double)random.nextFloat() < 0.4;
++ public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, IBlockData state) {
++ return (double) random.nextFloat() < 0.4D;
+ }
+
+ @Override
+- public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
+- this.getFeature(level).ifPresent(holder -> holder.value().place(level, level.getChunkSource().getGenerator(), random, pos));
++ 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);
++ });
+ }
+ }