mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
88 lines
4.5 KiB
Diff
88 lines
4.5 KiB
Diff
From bdbaab8f255dc936c123e9e3bdacc4356efee739 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(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MobSpawnerCat.java b/src/main/java/net/minecraft/server/MobSpawnerCat.java
|
|
index 6024478dc..3da1af0ea 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 {
|
|
if (this.a > 0) {
|
|
return 0;
|
|
} else {
|
|
- this.a = 1200;
|
|
+ this.a = worldserver.purpurConfig.catSpawnDelay; // Purpur
|
|
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 {
|
|
}
|
|
|
|
private int a(WorldServer worldserver, BlockPosition blockposition) {
|
|
- boolean flag = true;
|
|
+ int range = worldserver.purpurConfig.catSpawnVillageScanRange; // Purpur
|
|
|
|
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));
|
|
+ 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 {
|
|
}
|
|
|
|
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
|
|
+ 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 e7b3e66f8..a2c81fad3 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -149,6 +149,19 @@ public class PurpurWorldConfig {
|
|
hayBlockFallDamage = getBoolean("hay-block-fall-damage", hayBlockFallDamage);
|
|
}
|
|
|
|
+ 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);
|
|
+ }
|
|
+
|
|
public int limitPillagerOutpostSpawns = 10;
|
|
private void limitPillagerOutpostSpawns() {
|
|
limitPillagerOutpostSpawns = getInt("limit-pillager-outpost-spawns", limitPillagerOutpostSpawns);
|
|
--
|
|
2.24.0
|
|
|