mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 02:17:42 +01:00
Move per-world mob options around in config
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
From 2ce60c74d7a9eb0691d795dfc1ebb034d82e3b4f Mon Sep 17 00:00:00 2001
|
||||
From 5dfba45d55c57a95b360638215c5d8cc3f4070ec Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 26 Dec 2019 18:52:55 -0600
|
||||
Subject: [PATCH] Add natural cat spawning options
|
||||
|
||||
---
|
||||
.../java/net/minecraft/server/MobSpawnerCat.java | 12 +++++++-----
|
||||
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 13 +++++++++++++
|
||||
2 files changed, 20 insertions(+), 5 deletions(-)
|
||||
.../net/minecraft/server/MobSpawnerCat.java | 19 +++++++++++++------
|
||||
.../net/pl3x/purpur/PurpurWorldConfig.java | 9 +++++++++
|
||||
2 files changed, 22 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MobSpawnerCat.java b/src/main/java/net/minecraft/server/MobSpawnerCat.java
|
||||
index 6024478dc0..3da1af0eac 100644
|
||||
index 6024478dc0..034b973365 100644
|
||||
--- a/src/main/java/net/minecraft/server/MobSpawnerCat.java
|
||||
+++ b/src/main/java/net/minecraft/server/MobSpawnerCat.java
|
||||
@@ -15,7 +15,7 @@ public class MobSpawnerCat {
|
||||
@@ -21,67 +21,58 @@ index 6024478dc0..3da1af0eac 100644
|
||||
EntityPlayer entityplayer = worldserver.k();
|
||||
|
||||
if (entityplayer == null) {
|
||||
@@ -31,10 +31,12 @@ public class MobSpawnerCat {
|
||||
} else {
|
||||
if (SpawnerCreature.a(EntityPositionTypes.Surface.ON_GROUND, (IWorldReader) worldserver, blockposition, EntityTypes.CAT)) {
|
||||
if (worldserver.a(blockposition, 2)) {
|
||||
+ if (worldserver.purpurConfig.catSpawnDisableVillage) return 0; // Purpur
|
||||
return this.a(worldserver, blockposition);
|
||||
}
|
||||
|
||||
if (WorldGenerator.SWAMP_HUT.b(worldserver, blockposition)) {
|
||||
+ if (worldserver.purpurConfig.catSpawnDisableSwampHut) return 0; // Purpur
|
||||
return this.a((World) worldserver, blockposition);
|
||||
}
|
||||
}
|
||||
@@ -49,10 +51,10 @@ public class MobSpawnerCat {
|
||||
@@ -49,10 +49,13 @@ public class MobSpawnerCat {
|
||||
}
|
||||
|
||||
private int a(WorldServer worldserver, BlockPosition blockposition) {
|
||||
- boolean flag = true;
|
||||
+ int range = worldserver.purpurConfig.catSpawnVillageScanRange; // Purpur
|
||||
+ // Purpur start
|
||||
+ int range = worldserver.purpurConfig.catSpawnVillageScanRange;
|
||||
+ if (range <= 0) return 0;
|
||||
+ // Purpur end
|
||||
|
||||
if (worldserver.B().a(VillagePlaceType.q.c(), blockposition, 48, VillagePlace.Occupancy.IS_OCCUPIED) > 4L) {
|
||||
- if (worldserver.B().a(VillagePlaceType.q.c(), blockposition, 48, VillagePlace.Occupancy.IS_OCCUPIED) > 4L) {
|
||||
- List<EntityCat> list = worldserver.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(48.0D, 8.0D, 48.0D));
|
||||
+ if (worldserver.B().a(VillagePlaceType.q.c(), blockposition, range, VillagePlace.Occupancy.IS_OCCUPIED) > 4L) {
|
||||
+ List<EntityCat> list = worldserver.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range)); // Purpur
|
||||
|
||||
if (list.size() < 5) {
|
||||
return this.a(blockposition, (World) worldserver);
|
||||
@@ -63,8 +65,8 @@ public class MobSpawnerCat {
|
||||
@@ -63,8 +66,12 @@ public class MobSpawnerCat {
|
||||
}
|
||||
|
||||
private int a(World world, BlockPosition blockposition) {
|
||||
- boolean flag = true;
|
||||
- List<EntityCat> list = world.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(16.0D, 8.0D, 16.0D));
|
||||
+ int range = world.purpurConfig.catSpawnSwampHutScanRange; // Purpur
|
||||
+ // Purpur start
|
||||
+ int range = world.purpurConfig.catSpawnSwampHutScanRange;
|
||||
+ if (range <= 0) return 0;
|
||||
+ // Purpur end
|
||||
+
|
||||
+ List<EntityCat> list = world.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range)); // Purpur
|
||||
|
||||
return list.size() < 1 ? this.a(blockposition, world) : 0;
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 499bbe4ff2..deccd0084a 100644
|
||||
index b4f5599661..0a933e29a4 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -154,6 +154,19 @@ public class PurpurWorldConfig {
|
||||
hayBlockFallDamage = getBoolean("hay-block-fall-damage", hayBlockFallDamage);
|
||||
@@ -189,6 +189,15 @@ public class PurpurWorldConfig {
|
||||
sleepCondition = getString("sleep.condition", sleepCondition);
|
||||
}
|
||||
|
||||
+ public int catSpawnDelay = 1200;
|
||||
+ public boolean catSpawnDisableSwampHut = false;
|
||||
+ public int catSpawnSwampHutScanRange = 16;
|
||||
+ public boolean catSpawnDisableVillage = false;
|
||||
+ public int catSpawnVillageScanRange = 48;
|
||||
+ private void catSettings() {
|
||||
+ catSpawnDelay = getInt("cat-spawns.delay", catSpawnDelay);
|
||||
+ catSpawnDisableSwampHut = getBoolean("cat-spawns.swamp-hut.disable", catSpawnDisableSwampHut);
|
||||
+ catSpawnSwampHutScanRange = getInt("cat-spawns.swamp-hut.scan-range-for-other-cats", catSpawnSwampHutScanRange);
|
||||
+ catSpawnDisableVillage = getBoolean("cat-spawns.village.disable", catSpawnDisableVillage);
|
||||
+ catSpawnVillageScanRange = getInt("cat-spawns.village.scan-range-for-other-cats", catSpawnVillageScanRange);
|
||||
+ catSpawnDelay = getInt("mobs.cat.natural-spawns.delay", catSpawnDelay);
|
||||
+ catSpawnSwampHutScanRange = getInt("mobs.cat.natural-spawns.scan-range-for-other-cats.swamp-hut", catSpawnSwampHutScanRange);
|
||||
+ catSpawnVillageScanRange = getInt("mobs.cat.natural-spawns.scan-range-for-other-cats.village", catSpawnVillageScanRange);
|
||||
+ }
|
||||
+
|
||||
public int limitPillagerOutpostSpawns = 10;
|
||||
private void limitPillagerOutpostSpawns() {
|
||||
limitPillagerOutpostSpawns = getInt("limit-pillager-outpost-spawns", limitPillagerOutpostSpawns);
|
||||
public int chickenEggsHatchWhenDespawnedMax = 0;
|
||||
public int chickenEggsHatchWhenDespawnedRange = 10;
|
||||
private void chickenSettings() {
|
||||
--
|
||||
2.24.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user