mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 12dec20 Bump paerweight to 1.1.7 e33ed89 Get short commit ref using a more proper method 7d6147d Remove now unneeded patch due to paperweight 1.1.7 e72fa41 Update task dependency for includeMappings so the new task isn't skipped 0ad5526 Trim whitspace off of git hash (oops) Tuinity Changes: e878ba9 Update paper 2bd2849 Bring back fix codec spam patch
75 lines
3.8 KiB
Diff
75 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 4cab98b5e441a174482893d3d289bbafa1f7a5fc..fa3cdff99a16b67ed86c8f7940ffa139930c3448 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java
|
|
@@ -30,7 +30,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;
|
|
@@ -63,9 +63,13 @@ public class CatSpawner implements CustomSpawner {
|
|
}
|
|
|
|
private int spawnInVillage(ServerLevel world, BlockPos pos) {
|
|
- int i = 48;
|
|
- if (world.getPoiManager().getCountInRange(PoiType.HOME.getPredicate(), pos, 48, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
|
|
- List<Cat> list = world.getEntitiesOfClass(Cat.class, (new AABB(pos)).inflate(48.0D, 8.0D, 48.0D));
|
|
+ // Purpur start
|
|
+ int range = world.purpurConfig.catSpawnVillageScanRange;
|
|
+ if (range <= 0) return 0;
|
|
+
|
|
+ if (world.getPoiManager().getCountInRange(PoiType.HOME.getPredicate(), pos, range, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
|
|
+ List<Cat> list = world.getEntitiesOfClass(Cat.class, (new AABB(pos)).inflate(range, 8.0D, range));
|
|
+ // Purpur end
|
|
if (list.size() < 5) {
|
|
return this.spawnCat(pos, world);
|
|
}
|
|
@@ -75,8 +79,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.0D, 8.0D, 16.0D));
|
|
+ // 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.0D, range));
|
|
+ // Purpur end
|
|
return list.size() < 1 ? this.spawnCat(pos, world) : 0;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 41e3342f37c2b55655b01281c6411ec6dc94f336..eb3d47f97c1dddd809f79cd98017edd810f1671d 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -200,6 +200,9 @@ public class PurpurWorldConfig {
|
|
public boolean catRidable = false;
|
|
public boolean catRidableInWater = false;
|
|
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);
|
|
@@ -209,6 +212,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;
|