mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Don't get blockstate if not needed
This commit is contained in:
@@ -5,17 +5,19 @@ Subject: [PATCH] Config to disable hostile mob spawn on ice
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java
|
||||
index 1d66588cfe94d190a34dc376b4b5bff9461a3529..d2dbb7a6832ffc0c8759f26f685428ce86d6b7c8 100644
|
||||
index 1d66588cfe94d190a34dc376b4b5bff9461a3529..9459255dd06d71dc1728e440e501cb3c2dde616c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Monster.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java
|
||||
@@ -88,6 +88,12 @@ public abstract class Monster extends PathfinderMob implements Enemy {
|
||||
@@ -88,6 +88,14 @@ public abstract class Monster extends PathfinderMob implements Enemy {
|
||||
}
|
||||
|
||||
public static boolean isDarkEnoughToSpawn(ServerLevelAccessor world, BlockPos pos, Random random) {
|
||||
+ // Purpur start
|
||||
+ net.minecraft.world.level.block.state.BlockState spawnBlock = world.getBlockState(pos.below());
|
||||
+ if ((!world.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.PACKED_ICE)) || (!world.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.BLUE_ICE))) {
|
||||
+ return false;
|
||||
+ if (!world.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce || !world.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce) {
|
||||
+ net.minecraft.world.level.block.state.BlockState spawnBlock = world.getBlockState(pos.below());
|
||||
+ if ((!world.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.PACKED_ICE)) || (!world.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.BLUE_ICE))) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
if (world.getBrightness(LightLayer.SKY, pos) > random.nextInt(32)) {
|
||||
|
||||
Reference in New Issue
Block a user