mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 6e7dc3f81 [Auto] Updated Upstream (CraftBukkit) 664ae4554 [Auto] Updated Upstream (CraftBukkit) dafc7b8f8 Fix off by one error for scheduling block ticks (#4014) 5791e512b Fix MaterialTags tests to actually pass 115972651 Expand MaterialTags v2 (#4009) 5aaf1c514 prevent path space splitting in testServer.sh (#4007) a8ef09b82 Tighten logic for handling target tick times in tick scheduler (#4010) d5ccd4139 Remove ability to disable async chunks unless single core cpu 76728529f Fix Light Prioritization Issues 2d66b5be8 [Auto] Updated Upstream (CraftBukkit) 51d10c201 Add missing strikeLighting call to World#spigot()#strikeLightningEffect Tuinity Changes: 416ed5e Fix 3 tick pistons not functioning correctly 489faf0 Fix up lock handling for UserCache
133 lines
7.0 KiB
Diff
133 lines
7.0 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 dfa8f3439b..a3a073f9d2 100644
|
|
--- a/src/main/java/net/minecraft/server/IEntityAccess.java
|
|
+++ b/src/main/java/net/minecraft/server/IEntityAccess.java
|
|
@@ -45,6 +45,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 67c20747a3..68d37121fd 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.h();
|
|
|
|
if (entityplayer == null) {
|
|
@@ -50,10 +50,14 @@ public class MobSpawnerCat implements MobSpawner {
|
|
}
|
|
|
|
private int a(WorldServer worldserver, BlockPosition blockposition) {
|
|
- boolean flag = true;
|
|
-
|
|
- if (worldserver.x().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.getVillagePlace().count(VillagePlaceType.home().predicate(), blockposition, range, VillagePlace.Occupancy.IS_OCCUPIED) > 4L) {
|
|
+ List<EntityCat> list = worldserver.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range));
|
|
+ // Purpur end
|
|
|
|
if (list.size() < 5) {
|
|
return this.a(blockposition, (World) worldserver);
|
|
@@ -64,9 +68,13 @@ public class MobSpawnerCat implements MobSpawner {
|
|
}
|
|
|
|
private int a(World world, BlockPosition blockposition) {
|
|
- boolean flag = true;
|
|
- List<EntityCat> list = world.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(16.0D, 8.0D, 16.0D));
|
|
-
|
|
+ // Purpur start
|
|
+ int range = world.purpurConfig.catSpawnSwampHutScanRange;
|
|
+ if (range <= 0) {
|
|
+ return 0;
|
|
+ }
|
|
+ List<EntityCat> list = world.getEntitiesInAABB(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range));
|
|
+ // Purpur end
|
|
return list.size() < 1 ? this.a(blockposition, world) : 0;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java
|
|
index c1e149f204..acc30cb0d8 100644
|
|
--- a/src/main/java/net/minecraft/server/VillagePlace.java
|
|
+++ b/src/main/java/net/minecraft/server/VillagePlace.java
|
|
@@ -45,6 +45,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 5bd3bcc2b9..5f2bb140ae 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/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index 346cbc3efd..88e807da1e 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -2502,6 +2502,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
}
|
|
}
|
|
|
|
+ public VillagePlace getVillagePlace() { return x(); } // Purpur - OBFHELPER
|
|
public VillagePlace x() {
|
|
return this.getChunkProvider().j();
|
|
}
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index b41d4959c1..55e609cc1c 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -111,6 +111,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);
|