aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/block/NyliumBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/NyliumBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/block/NyliumBlock.java.patch119
1 files changed, 119 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/NyliumBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/NyliumBlock.java.patch
new file mode 100644
index 0000000000..84056ed9d8
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/NyliumBlock.java.patch
@@ -0,0 +1,119 @@
+--- a/net/minecraft/world/level/block/NyliumBlock.java
++++ b/net/minecraft/world/level/block/NyliumBlock.java
+@@ -3,7 +3,6 @@
+ import com.mojang.serialization.MapCodec;
+ import net.minecraft.core.BlockPos;
+ import net.minecraft.core.Direction;
+-import net.minecraft.core.Holder;
+ import net.minecraft.core.Registry;
+ import net.minecraft.core.registries.Registries;
+ import net.minecraft.data.worldgen.features.NetherFeatures;
+@@ -13,72 +12,77 @@
+ 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.chunk.ChunkGenerator;
+ import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
+ import net.minecraft.world.level.lighting.LightEngine;
+
+ public class NyliumBlock extends Block implements BonemealableBlock {
++
+ public static final MapCodec<NyliumBlock> CODEC = simpleCodec(NyliumBlock::new);
+
+ @Override
+ public MapCodec<NyliumBlock> codec() {
+- return CODEC;
++ return NyliumBlock.CODEC;
+ }
+
+ protected NyliumBlock(BlockBehaviour.Properties properties) {
+ super(properties);
+ }
+
+- private static boolean canBeNylium(BlockState state, LevelReader reader, BlockPos pos) {
+- BlockPos blockPos = pos.above();
+- BlockState blockState = reader.getBlockState(blockPos);
+- int lightBlockInto = LightEngine.getLightBlockInto(reader, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(reader, blockPos));
+- return lightBlockInto < reader.getMaxLightLevel();
++ private static boolean canBeNylium(IBlockData state, LevelReader reader, BlockPos pos) {
++ BlockPos blockposition1 = pos.above();
++ IBlockData iblockdata1 = reader.getBlockState(blockposition1);
++ int i = LightEngine.getLightBlockInto(reader, state, pos, iblockdata1, blockposition1, Direction.UP, iblockdata1.getLightBlock(reader, blockposition1));
++
++ return i < reader.getMaxLightLevel();
+ }
+
+ @Override
+- public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
+ if (!canBeNylium(state, level, pos)) {
++ // CraftBukkit start
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(level, pos, Blocks.NETHERRACK.defaultBlockState()).isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
+ level.setBlockAndUpdate(pos, Blocks.NETHERRACK.defaultBlockState());
+ }
++
+ }
+
+ @Override
+- public boolean isValidBonemealTarget(LevelReader levelReader, BlockPos blockPos, BlockState blockState) {
+- return levelReader.getBlockState(blockPos.above()).isAir();
++ public boolean isValidBonemealTarget(LevelReader iworldreader, BlockPos blockposition, IBlockData iblockdata) {
++ return iworldreader.getBlockState(blockposition.above()).isAir();
+ }
+
+ @Override
+- public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
++ public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, IBlockData state) {
+ return true;
+ }
+
+ @Override
+- public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
+- BlockState blockState = level.getBlockState(pos);
+- BlockPos blockPos = pos.above();
+- ChunkGenerator generator = level.getChunkSource().getGenerator();
+- Registry<ConfiguredFeature<?, ?>> registry = level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE);
+- if (blockState.is(Blocks.CRIMSON_NYLIUM)) {
+- this.place(registry, NetherFeatures.CRIMSON_FOREST_VEGETATION_BONEMEAL, level, generator, random, blockPos);
+- } else if (blockState.is(Blocks.WARPED_NYLIUM)) {
+- this.place(registry, NetherFeatures.WARPED_FOREST_VEGETATION_BONEMEAL, level, generator, random, blockPos);
+- this.place(registry, NetherFeatures.NETHER_SPROUTS_BONEMEAL, level, generator, random, blockPos);
++ public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, IBlockData state) {
++ IBlockData iblockdata1 = level.getBlockState(pos);
++ BlockPos blockposition1 = pos.above();
++ ChunkGenerator chunkgenerator = level.getChunkSource().getGenerator();
++ Registry<ConfiguredFeature<?, ?>> iregistry = level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE);
++
++ if (iblockdata1.is(Blocks.CRIMSON_NYLIUM)) {
++ this.place(iregistry, NetherFeatures.CRIMSON_FOREST_VEGETATION_BONEMEAL, level, chunkgenerator, random, blockposition1);
++ } else if (iblockdata1.is(Blocks.WARPED_NYLIUM)) {
++ this.place(iregistry, NetherFeatures.WARPED_FOREST_VEGETATION_BONEMEAL, level, chunkgenerator, random, blockposition1);
++ this.place(iregistry, NetherFeatures.NETHER_SPROUTS_BONEMEAL, level, chunkgenerator, random, blockposition1);
+ if (random.nextInt(8) == 0) {
+- this.place(registry, NetherFeatures.TWISTING_VINES_BONEMEAL, level, generator, random, blockPos);
++ this.place(iregistry, NetherFeatures.TWISTING_VINES_BONEMEAL, level, chunkgenerator, random, blockposition1);
+ }
+ }
++
+ }
+
+- private void place(
+- Registry<ConfiguredFeature<?, ?>> featureRegistry,
+- ResourceKey<ConfiguredFeature<?, ?>> featureKey,
+- ServerLevel level,
+- ChunkGenerator chunkGenerator,
+- RandomSource random,
+- BlockPos pos
+- ) {
+- featureRegistry.getHolder(featureKey).ifPresent(configuredFeature -> configuredFeature.value().place(level, chunkGenerator, random, pos));
++ private void place(Registry<ConfiguredFeature<?, ?>> featureRegistry, ResourceKey<ConfiguredFeature<?, ?>> featureKey, ServerLevel level, ChunkGenerator chunkGenerator, RandomSource random, BlockPos pos) {
++ featureRegistry.getHolder(featureKey).ifPresent((holder_c) -> {
++ ((ConfiguredFeature) holder_c.value()).place(level, chunkGenerator, random, pos);
++ });
+ }
+ }