mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
72 lines
3.8 KiB
Diff
72 lines
3.8 KiB
Diff
From 0000000000000000000000000000000000000000 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] Cat spawning options
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
|
index e0e5046c84941a8d17e18c177f3daea9cb631940..d503d7a5837dbeb98e58dbe8f7e5de45f6d88990 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
|
@@ -27,7 +27,7 @@ public class CatSpawner implements CustomSpawner {
|
|
if (this.nextTick > 0) {
|
|
return 0;
|
|
} else {
|
|
- this.nextTick = 1200;
|
|
+ this.nextTick = world.purpurConfig.catSpawnDelay; // Purpur
|
|
Player player = world.getRandomPlayer();
|
|
if (player == null) {
|
|
return 0;
|
|
@@ -61,8 +61,12 @@ public class CatSpawner implements CustomSpawner {
|
|
|
|
private int spawnInVillage(ServerLevel world, BlockPos pos) {
|
|
int i = 48;
|
|
- if (world.getPoiManager().getCountInRange(entry -> entry.is(PoiTypes.HOME), pos, 48, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
|
|
- List<Cat> list = world.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(48.0, 8.0, 48.0));
|
|
+ // Purpur start
|
|
+ int range = world.purpurConfig.catSpawnVillageScanRange;
|
|
+ if (range <= 0) return 0;
|
|
+ if (world.getPoiManager().getCountInRange(entry -> entry.is(PoiTypes.HOME), pos, range, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
|
|
+ List<Cat> list = world.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
|
|
+ // Purpur end
|
|
if (list.size() < 5) {
|
|
return this.spawnCat(pos, world);
|
|
}
|
|
@@ -73,7 +77,11 @@ public class CatSpawner implements CustomSpawner {
|
|
|
|
private int spawnInHut(ServerLevel world, BlockPos pos) {
|
|
int i = 16;
|
|
- List<Cat> list = world.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(16.0, 8.0, 16.0));
|
|
+ // Purpur start
|
|
+ int range = world.purpurConfig.catSpawnSwampHutScanRange;
|
|
+ if (range <= 0) return 0;
|
|
+ List<Cat> list = world.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
|
|
+ // Purpur end
|
|
return list.size() < 1 ? this.spawnCat(pos, world) : 0;
|
|
}
|
|
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
index d5fb5919b0571e4327a9976dda78ef8510fc5d05..73b86b6a367cb37b180b4806671c19dccd90950a 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
@@ -240,6 +240,9 @@ public class PurpurWorldConfig {
|
|
public boolean catRidableInWater = true;
|
|
public boolean catControllable = true;
|
|
public double catMaxHealth = 10.0D;
|
|
+ public int catSpawnDelay = 1200;
|
|
+ public int catSpawnSwampHutScanRange = 16;
|
|
+ public int catSpawnVillageScanRange = 48;
|
|
private void catSettings() {
|
|
catRidable = getBoolean("mobs.cat.ridable", catRidable);
|
|
catRidableInWater = getBoolean("mobs.cat.ridable-in-water", catRidableInWater);
|
|
@@ -250,6 +253,9 @@ public class PurpurWorldConfig {
|
|
set("mobs.cat.attributes.max_health", oldValue);
|
|
}
|
|
catMaxHealth = getDouble("mobs.cat.attributes.max_health", catMaxHealth);
|
|
+ catSpawnDelay = getInt("mobs.cat.spawn-delay", catSpawnDelay);
|
|
+ catSpawnSwampHutScanRange = getInt("mobs.cat.scan-range-for-other-cats.swamp-hut", catSpawnSwampHutScanRange);
|
|
+ catSpawnVillageScanRange = getInt("mobs.cat.scan-range-for-other-cats.village", catSpawnVillageScanRange);
|
|
}
|
|
|
|
public boolean caveSpiderRidable = false;
|