mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Cat spawning options
This commit is contained in:
committed by
granny
parent
e4247eb565
commit
e7fcac7035
@@ -0,0 +1,39 @@
|
||||
--- a/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
+++ b/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
@@ -27,7 +_,7 @@
|
||||
if (this.nextTick > 0) {
|
||||
return 0;
|
||||
} else {
|
||||
- this.nextTick = 1200;
|
||||
+ this.nextTick = level.purpurConfig.catSpawnDelay; // Purpur - Cat spawning options
|
||||
Player randomPlayer = level.getRandomPlayer();
|
||||
if (randomPlayer == null) {
|
||||
return 0;
|
||||
@@ -61,8 +_,12 @@
|
||||
|
||||
private int spawnInVillage(ServerLevel serverLevel, BlockPos pos) {
|
||||
int i = 48;
|
||||
- if (serverLevel.getPoiManager().getCountInRange(holder -> holder.is(PoiTypes.HOME), pos, 48, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
|
||||
- List<Cat> entitiesOfClass = serverLevel.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(48.0, 8.0, 48.0));
|
||||
+ // Purpur start - Cat spawning options
|
||||
+ int range = serverLevel.purpurConfig.catSpawnVillageScanRange;
|
||||
+ if (range <= 0) return 0;
|
||||
+ if (serverLevel.getPoiManager().getCountInRange(holder -> holder.is(PoiTypes.HOME), pos, range, PoiManager.Occupancy.IS_OCCUPIED) > 4L) {
|
||||
+ List<Cat> entitiesOfClass = serverLevel.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
|
||||
+ // Purpur end - Cat spawning options
|
||||
if (entitiesOfClass.size() < 5) {
|
||||
return this.spawnCat(pos, serverLevel);
|
||||
}
|
||||
@@ -73,7 +_,11 @@
|
||||
|
||||
private int spawnInHut(ServerLevel serverLevel, BlockPos pos) {
|
||||
int i = 16;
|
||||
- List<Cat> entitiesOfClass = serverLevel.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(16.0, 8.0, 16.0));
|
||||
+ // Purpur start - Cat spawning options
|
||||
+ int range = serverLevel.purpurConfig.catSpawnSwampHutScanRange;
|
||||
+ if (range <= 0) return 0;
|
||||
+ List<Cat> entitiesOfClass = serverLevel.getEntitiesOfClass(Cat.class, new AABB(pos).inflate(range, 8.0, range));
|
||||
+ // Purpur end - Cat spawning options
|
||||
return entitiesOfClass.size() < 1 ? this.spawnCat(pos, serverLevel) : 0;
|
||||
}
|
||||
|
||||
@@ -298,6 +298,9 @@ public class PurpurWorldConfig {
|
||||
public boolean catControllable = true;
|
||||
public double catMaxHealth = 10.0D;
|
||||
public double catScale = 1.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);
|
||||
@@ -309,6 +312,9 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
catMaxHealth = getDouble("mobs.cat.attributes.max_health", catMaxHealth);
|
||||
catScale = Mth.clamp(getDouble("mobs.cat.attributes.scale", catScale), 0.0625D, 16.0D);
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user