mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
--- a/net/minecraft/world/entity/monster/Ghast.java
|
||||||
|
+++ b/net/minecraft/world/entity/monster/Ghast.java
|
||||||
|
@@ -155,6 +_,11 @@
|
||||||
|
public static boolean checkGhastSpawnRules(
|
||||||
|
EntityType<Ghast> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||||
|
) {
|
||||||
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
|
+ if (net.minecraft.world.entity.monster.Monster.canSpawnInBlueAndPackedIce(level, pos)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
|
return level.getDifficulty() != Difficulty.PEACEFUL && random.nextInt(20) == 0 && checkMobSpawnRules(entityType, level, spawnReason, pos, random);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
--- a/net/minecraft/world/entity/monster/Guardian.java
|
||||||
|
+++ b/net/minecraft/world/entity/monster/Guardian.java
|
||||||
|
@@ -314,6 +_,11 @@
|
||||||
|
public static boolean checkGuardianSpawnRules(
|
||||||
|
EntityType<? extends Guardian> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||||
|
) {
|
||||||
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
|
+ if (canSpawnInBlueAndPackedIce(level, pos)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
|
return (random.nextInt(20) == 0 || !level.canSeeSkyFromBelowWater(pos))
|
||||||
|
&& level.getDifficulty() != Difficulty.PEACEFUL
|
||||||
|
&& (EntitySpawnReason.isSpawner(spawnReason) || level.getFluidState(pos).is(FluidTags.WATER))
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
--- a/net/minecraft/world/entity/monster/MagmaCube.java
|
||||||
|
+++ b/net/minecraft/world/entity/monster/MagmaCube.java
|
||||||
|
@@ -31,6 +_,11 @@
|
||||||
|
public static boolean checkMagmaCubeSpawnRules(
|
||||||
|
EntityType<MagmaCube> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||||
|
) {
|
||||||
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
|
+ if (net.minecraft.world.entity.monster.Monster.canSpawnInBlueAndPackedIce(level, pos)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
|
return level.getDifficulty() != Difficulty.PEACEFUL;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,17 +1,39 @@
|
|||||||
--- a/net/minecraft/world/entity/monster/Monster.java
|
--- a/net/minecraft/world/entity/monster/Monster.java
|
||||||
+++ b/net/minecraft/world/entity/monster/Monster.java
|
+++ b/net/minecraft/world/entity/monster/Monster.java
|
||||||
@@ -84,6 +_,14 @@
|
@@ -84,6 +_,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDarkEnoughToSpawn(ServerLevelAccessor level, BlockPos pos, RandomSource random) {
|
public static boolean isDarkEnoughToSpawn(ServerLevelAccessor level, BlockPos pos, RandomSource random) {
|
||||||
+ // Purpur start - Config to disable hostile mob spawn on ice
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
+ if (!level.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce || !level.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce) {
|
+ if (canSpawnInBlueAndPackedIce(level, pos)) {
|
||||||
+ net.minecraft.world.level.block.state.BlockState spawnBlock = level.getBlockState(pos.below());
|
|
||||||
+ if ((!level.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.PACKED_ICE)) || (!level.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.BLUE_ICE))) {
|
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
|
||||||
+ // Purpur end - Config to disable hostile mob spawn on ice
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
if (level.getBrightness(LightLayer.SKY, pos) > random.nextInt(32)) {
|
if (level.getBrightness(LightLayer.SKY, pos) > random.nextInt(32)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -109,6 +_,11 @@
|
||||||
|
public static boolean checkAnyLightMonsterSpawnRules(
|
||||||
|
EntityType<? extends Monster> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||||
|
) {
|
||||||
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
|
+ if (canSpawnInBlueAndPackedIce(level, pos)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
|
return level.getDifficulty() != Difficulty.PEACEFUL && checkMobSpawnRules(entityType, level, spawnReason, pos, random);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -140,4 +_,12 @@
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
|
+ public static boolean canSpawnInBlueAndPackedIce(LevelAccessor level, BlockPos pos) {
|
||||||
|
+ net.minecraft.world.level.block.state.BlockState spawnBlock = level.getBlockState(pos.below());
|
||||||
|
+
|
||||||
|
+ return (!level.getMinecraftWorld().purpurConfig.mobsSpawnOnPackedIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.PACKED_ICE)) || (!level.getMinecraftWorld().purpurConfig.mobsSpawnOnBlueIce && spawnBlock.is(net.minecraft.world.level.block.Blocks.BLUE_ICE));
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
--- a/net/minecraft/world/entity/monster/Slime.java
|
||||||
|
+++ b/net/minecraft/world/entity/monster/Slime.java
|
||||||
|
@@ -301,6 +_,11 @@
|
||||||
|
public static boolean checkSlimeSpawnRules(
|
||||||
|
EntityType<Slime> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||||
|
) {
|
||||||
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
|
+ if (net.minecraft.world.entity.monster.Monster.canSpawnInBlueAndPackedIce(level, pos)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
|
if (level.getDifficulty() != Difficulty.PEACEFUL) {
|
||||||
|
if (EntitySpawnReason.isSpawner(spawnReason)) {
|
||||||
|
return checkMobSpawnRules(entityType, level, spawnReason, pos, random);
|
||||||
@@ -13,16 +13,28 @@
|
|||||||
super.customServerAiStep(level);
|
super.customServerAiStep(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,6 +_,12 @@
|
@@ -160,6 +_,12 @@
|
||||||
this.playFirstAngerSoundIn = FIRST_ANGER_SOUND_DELAY.sample(this.random);
|
|
||||||
this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random);
|
this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random);
|
||||||
}
|
}
|
||||||
+
|
|
||||||
+ // Purpur start - Toggle for Zombified Piglin death always counting as player kill when angry
|
+ // Purpur start - Toggle for Zombified Piglin death always counting as player kill when angry
|
||||||
+ if (target instanceof Player player && this.level().purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) {
|
+ if (target instanceof Player player && this.level().purpurConfig.zombifiedPiglinCountAsPlayerKillWhenAngry) {
|
||||||
+ this.setLastHurtByPlayer(player, this.tickCount);
|
+ this.setLastHurtByPlayer(player, this.tickCount);
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end - Toggle for Zombified Piglin death always counting as player kill when angry
|
+ // Purpur end - Toggle for Zombified Piglin death always counting as player kill when angry
|
||||||
|
+
|
||||||
return super.setTarget(target, reason); // CraftBukkit
|
return super.setTarget(target, reason); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -180,6 +_,11 @@
|
||||||
|
public static boolean checkZombifiedPiglinSpawnRules(
|
||||||
|
EntityType<ZombifiedPiglin> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||||
|
) {
|
||||||
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
|
+ if (canSpawnInBlueAndPackedIce(level, pos)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
|
return level.getDifficulty() != Difficulty.PEACEFUL && !level.getBlockState(pos.below()).is(Blocks.NETHER_WART_BLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||||
|
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
|
||||||
|
@@ -200,6 +_,11 @@
|
||||||
|
public static boolean checkHoglinSpawnRules(
|
||||||
|
EntityType<Hoglin> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||||
|
) {
|
||||||
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
|
+ if (net.minecraft.world.entity.monster.Monster.canSpawnInBlueAndPackedIce(level, pos)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
|
return !level.getBlockState(pos.below()).is(Blocks.NETHER_WART_BLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||||
|
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
|
||||||
|
@@ -203,6 +_,11 @@
|
||||||
|
public static boolean checkPiglinSpawnRules(
|
||||||
|
EntityType<Piglin> entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
|
||||||
|
) {
|
||||||
|
+ // Purpur start - Config to disable hostile mob spawn on ice
|
||||||
|
+ if (canSpawnInBlueAndPackedIce(level, pos)) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Config to disable hostile mob spawn on ice
|
||||||
|
return !level.getBlockState(pos.below()).is(Blocks.NETHER_WART_BLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user