9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-19 15:09:27 +00:00

Fix crash when using the Blazing Simple Farm Checks due to the registry not existing

This commit is contained in:
MrPowerGamerBR
2024-11-25 15:44:57 -03:00
parent 32b3c0c570
commit 24520501a5

View File

@@ -109,10 +109,18 @@ index c3dba0c2c94f3804338f86621dc42405e380a6b3..bfa98fe6df8e61512d913f98710d369d
int xOff = pos.getX(); int xOff = pos.getX();
int yOff = pos.getY(); int yOff = pos.getY();
diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java
index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..4b46fbb7a03de8f2616a398c6fa3794da60a1eea 100644 index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..ad2a81ca11d5e6fcf5899051c5b0af9b5398f1ac 100644
--- a/src/main/java/net/minecraft/world/level/block/StemBlock.java --- a/src/main/java/net/minecraft/world/level/block/StemBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java +++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java
@@ -73,6 +73,56 @@ public class StemBlock extends BushBlock implements BonemealableBlock { @@ -7,6 +7,7 @@ import java.util.Optional;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
+import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
@@ -73,6 +74,56 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
@Override @Override
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
if (world.getRawBrightness(pos, 0) >= 9) { if (world.getRawBrightness(pos, 0) >= 9) {
@@ -144,7 +152,7 @@ index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..4b46fbb7a03de8f2616a398c6fa3794d
+ BlockState iblockdata1 = world.getBlockState(blockposition1.below()); + BlockState iblockdata1 = world.getBlockState(blockposition1.below());
+ +
+ if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) { + if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
+ Registry<Block> iregistry = world.registryAccess().get(Registries.BLOCK).get().value(); + Registry<Block> iregistry = BuiltInRegistries.BLOCK;
+ Optional<Block> optional = iregistry.getOptional(this.fruit); + Optional<Block> optional = iregistry.getOptional(this.fruit);
+ Optional<Block> optional1 = iregistry.getOptional(this.attachedStem); + Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
+ +
@@ -169,7 +177,7 @@ index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..4b46fbb7a03de8f2616a398c6fa3794d
float f = CropBlock.getGrowthSpeed(this, world, pos); float f = CropBlock.getGrowthSpeed(this, world, pos);
if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
@@ -102,7 +152,8 @@ public class StemBlock extends BushBlock implements BonemealableBlock { @@ -102,7 +153,8 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
} }
} }
} }