Skip to content

Commit

Permalink
Fix crash when using the Blazing Simple Farm Checks due to the regist…
Browse files Browse the repository at this point in the history
…ry not existing
  • Loading branch information
MrPowerGamerBR committed Nov 25, 2024
1 parent 32b3c0c commit 2452050
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions patches/server/0009-Blazingly-Simple-Farm-Checks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,18 @@ index c3dba0c2c94f3804338f86621dc42405e380a6b3..bfa98fe6df8e61512d913f98710d369d
int xOff = pos.getX();
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
index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..4b46fbb7a03de8f2616a398c6fa3794da60a1eea 100644
index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..ad2a81ca11d5e6fcf5899051c5b0af9b5398f1ac 100644
--- a/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
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
if (world.getRawBrightness(pos, 0) >= 9) {
Expand Down Expand Up @@ -144,7 +152,7 @@ index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..4b46fbb7a03de8f2616a398c6fa3794d
+ BlockState iblockdata1 = world.getBlockState(blockposition1.below());
+
+ 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> optional1 = iregistry.getOptional(this.attachedStem);
+
Expand All @@ -169,7 +177,7 @@ index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..4b46fbb7a03de8f2616a398c6fa3794d
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
@@ -102,7 +152,8 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
@@ -102,7 +153,8 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
}
}
}
Expand Down

0 comments on commit 2452050

Please sign in to comment.