mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Cat spawning options
This commit is contained in:
committed by
granny
parent
e4247eb565
commit
e7fcac7035
@@ -1,71 +0,0 @@
|
||||
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/net/minecraft/world/entity/npc/CatSpawner.java b/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
index b0236c7bf9441aa84d3795ffed05dd6099f29636..e9cbbcdcefe9acc24cf7972ae356fd590e128f56 100644
|
||||
--- a/net/minecraft/world/entity/npc/CatSpawner.java
|
||||
+++ b/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 - Cat spawning options
|
||||
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 - Cat spawning options
|
||||
+ 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 - Cat spawning options
|
||||
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 - Cat spawning options
|
||||
+ 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 - Cat spawning options
|
||||
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 149360f01139fa4b14e27e5b34fe3fe7682c7ffc..b3284dfbcdc240919776f47a780a824c406c2781 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -312,6 +312,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);
|
||||
@@ -323,6 +326,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;
|
||||
@@ -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