mirror of https://github.com/YatopiaMC/Yatopia.git
117 lines
6.8 KiB
Diff
117 lines
6.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/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java
|
|
index 2e514b8291a544a88667fbca2389bde4c2ecb109..288105ae657ade252032aa0ac9c191a8e8ebf549 100644
|
|
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
|
|
+++ b/src/main/java/net/minecraft/server/IEntityAccess.java
|
|
@@ -47,6 +47,7 @@ public interface IEntityAccess {
|
|
}
|
|
}
|
|
|
|
+ default <T extends Entity> List<T> getEntitiesInAABB(Class<? extends T> oclass, AxisAlignedBB axisalignedbb) { return a(oclass, axisalignedbb); } // Purpur - OBFHELPER
|
|
default <T extends Entity> List<T> a(Class<? extends T> oclass, AxisAlignedBB axisalignedbb) {
|
|
return this.a(oclass, axisalignedbb, IEntitySelector.g);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/MobSpawnerCat.java b/src/main/java/net/minecraft/server/MobSpawnerCat.java
|
|
index 5e17868a76ea8e3f105c11d496d6da12afa0da41..5a0f8779672a9e34f6970045361630ab5af3990b 100644
|
|
--- a/src/main/java/net/minecraft/server/MobSpawnerCat.java
|
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerCat.java
|
|
@@ -16,7 +16,7 @@ public class MobSpawnerCat implements MobSpawner {
|
|
if (this.a > 0) {
|
|
return 0;
|
|
} else {
|
|
- this.a = 1200;
|
|
+ this.a = worldserver.purpurConfig.catSpawnDelay; // Purpur;
|
|
EntityPlayer entityplayer = worldserver.q_();
|
|
|
|
if (entityplayer == null) {
|
|
@@ -50,10 +50,12 @@ public class MobSpawnerCat implements MobSpawner {
|
|
}
|
|
|
|
private int a(WorldServer worldserver, BlockPosition blockposition) {
|
|
- boolean flag = true;
|
|
-
|
|
- if (worldserver.y().a(VillagePlaceType.r.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));
|
|
+ // Purpur start
|
|
+ int range = worldserver.purpurConfig.catSpawnVillageScanRange;
|
|
+ if (range <= 0) return 0;
|
|
+ if (worldserver.getPoiStorage().count(VillagePlaceType.home().predicate(), blockposition, range, VillagePlace.Occupancy.IS_OCCUPIED) > 4L) {
|
|
+ List<EntityCat> list = worldserver.getEntitiesInAABB(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range));
|
|
+ // Purpur end
|
|
|
|
if (list.size() < 5) {
|
|
return this.a(blockposition, worldserver);
|
|
@@ -64,9 +66,11 @@ public class MobSpawnerCat implements MobSpawner {
|
|
}
|
|
|
|
private int b(WorldServer worldserver, BlockPosition blockposition) {
|
|
- boolean flag = true;
|
|
- List<EntityCat> list = worldserver.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(16.0D, 8.0D, 16.0D));
|
|
-
|
|
+ // Purpur start
|
|
+ int range = worldserver.purpurConfig.catSpawnSwampHutScanRange;
|
|
+ if (range <= 0) return 0;
|
|
+ List<EntityCat> list = worldserver.getEntitiesInAABB(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range));
|
|
+ // Purpur end
|
|
return list.size() < 1 ? this.a(blockposition, worldserver) : 0;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java
|
|
index fce9967912628c232fe41ccc17fe2296f001ec61..44063d599e39e087b3eccfe204ef2fd79c3364e5 100644
|
|
--- a/src/main/java/net/minecraft/server/VillagePlace.java
|
|
+++ b/src/main/java/net/minecraft/server/VillagePlace.java
|
|
@@ -178,6 +178,7 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> {
|
|
((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition);
|
|
}
|
|
|
|
+ public long count(Predicate<VillagePlaceType> predicate, BlockPosition blockposition, int i, VillagePlace.Occupancy villageplace_occupancy) { return a(predicate, blockposition, i, villageplace_occupancy); } // Purpur - OBFHELPER
|
|
public long a(Predicate<VillagePlaceType> predicate, BlockPosition blockposition, int i, VillagePlace.Occupancy villageplace_occupancy) {
|
|
return this.c(predicate, blockposition, i, villageplace_occupancy).count();
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/VillagePlaceType.java b/src/main/java/net/minecraft/server/VillagePlaceType.java
|
|
index a5718af9b614ae505067131f04ebb490617d6aa4..b6b4c8c491d692f93d2c38d602ff99b0611b72aa 100644
|
|
--- a/src/main/java/net/minecraft/server/VillagePlaceType.java
|
|
+++ b/src/main/java/net/minecraft/server/VillagePlaceType.java
|
|
@@ -44,7 +44,7 @@ public class VillagePlaceType {
|
|
public static final VillagePlaceType o = a("shepherd", a(Blocks.LOOM), 1, 1);
|
|
public static final VillagePlaceType p = a("toolsmith", a(Blocks.SMITHING_TABLE), 1, 1);
|
|
public static final VillagePlaceType q = a("weaponsmith", a(Blocks.GRINDSTONE), 1, 1);
|
|
- public static final VillagePlaceType r = a("home", VillagePlaceType.z, 1, 1);
|
|
+ public static final VillagePlaceType r = a("home", VillagePlaceType.z, 1, 1); public static VillagePlaceType home() { return r; } // Purpur - OBFHELPER
|
|
public static final VillagePlaceType s = a("meeting", a(Blocks.BELL), 32, 6);
|
|
public static final VillagePlaceType t = a("beehive", a(Blocks.BEEHIVE), 0, 1);
|
|
public static final VillagePlaceType u = a("bee_nest", a(Blocks.BEE_NEST), 0, 1);
|
|
@@ -83,6 +83,7 @@ public class VillagePlaceType {
|
|
return this.D;
|
|
}
|
|
|
|
+ public Predicate<VillagePlaceType> predicate() { return c(); } // Purpur - OBFHELPER
|
|
public Predicate<VillagePlaceType> c() {
|
|
return this.E;
|
|
}
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 0fa01267fa35f1afdc81c2636f9efa8506bcebb6..9c5de125a6ed207f238dff1e17e38a4083c4c251 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -118,6 +118,15 @@ public class PurpurWorldConfig {
|
|
turtleEggsBreakFromMinecarts = getBoolean("blocks.turtle_egg.break-from-minecarts", turtleEggsBreakFromMinecarts);
|
|
}
|
|
|
|
+ public int catSpawnDelay = 1200;
|
|
+ public int catSpawnSwampHutScanRange = 16;
|
|
+ public int catSpawnVillageScanRange = 48;
|
|
+ private void catSettings() {
|
|
+ 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 chickenRetaliate = false;
|
|
private void chickenSettings() {
|
|
chickenRetaliate = getBoolean("mobs.chicken.retaliate", chickenRetaliate);
|