-
-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca55ab0
commit acfe380
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
patches/server/0091-Add-natural-cat-spawning-options.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
From bdbaab8f255dc936c123e9e3bdacc4356efee739 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] Add natural cat spawning options | ||
|
||
--- | ||
.../java/net/minecraft/server/MobSpawnerCat.java | 12 +++++++----- | ||
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 13 +++++++++++++ | ||
2 files changed, 20 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/src/main/java/net/minecraft/server/MobSpawnerCat.java b/src/main/java/net/minecraft/server/MobSpawnerCat.java | ||
index 6024478dc..3da1af0ea 100644 | ||
--- a/src/main/java/net/minecraft/server/MobSpawnerCat.java | ||
+++ b/src/main/java/net/minecraft/server/MobSpawnerCat.java | ||
@@ -15,7 +15,7 @@ public class MobSpawnerCat { | ||
if (this.a > 0) { | ||
return 0; | ||
} else { | ||
- this.a = 1200; | ||
+ this.a = worldserver.purpurConfig.catSpawnDelay; // Purpur | ||
EntityPlayer entityplayer = worldserver.k(); | ||
|
||
if (entityplayer == null) { | ||
@@ -31,10 +31,12 @@ public class MobSpawnerCat { | ||
} else { | ||
if (SpawnerCreature.a(EntityPositionTypes.Surface.ON_GROUND, (IWorldReader) worldserver, blockposition, EntityTypes.CAT)) { | ||
if (worldserver.a(blockposition, 2)) { | ||
+ if (worldserver.purpurConfig.catSpawnDisableVillage) return 0; // Purpur | ||
return this.a(worldserver, blockposition); | ||
} | ||
|
||
if (WorldGenerator.SWAMP_HUT.b(worldserver, blockposition)) { | ||
+ if (worldserver.purpurConfig.catSpawnDisableSwampHut) return 0; // Purpur | ||
return this.a((World) worldserver, blockposition); | ||
} | ||
} | ||
@@ -49,10 +51,10 @@ public class MobSpawnerCat { | ||
} | ||
|
||
private int a(WorldServer worldserver, BlockPosition blockposition) { | ||
- boolean flag = true; | ||
+ int range = worldserver.purpurConfig.catSpawnVillageScanRange; // Purpur | ||
|
||
if (worldserver.B().a(VillagePlaceType.q.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)); | ||
+ List<EntityCat> list = worldserver.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range)); // Purpur | ||
|
||
if (list.size() < 5) { | ||
return this.a(blockposition, (World) worldserver); | ||
@@ -63,8 +65,8 @@ public class MobSpawnerCat { | ||
} | ||
|
||
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)); | ||
+ int range = world.purpurConfig.catSpawnSwampHutScanRange; // Purpur | ||
+ List<EntityCat> list = world.a(EntityCat.class, (new AxisAlignedBB(blockposition)).grow(range, 8.0D, range)); // Purpur | ||
|
||
return list.size() < 1 ? this.a(blockposition, world) : 0; | ||
} | ||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
index e7b3e66f8..a2c81fad3 100644 | ||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
@@ -149,6 +149,19 @@ public class PurpurWorldConfig { | ||
hayBlockFallDamage = getBoolean("hay-block-fall-damage", hayBlockFallDamage); | ||
} | ||
|
||
+ public int catSpawnDelay = 1200; | ||
+ public boolean catSpawnDisableSwampHut = false; | ||
+ public int catSpawnSwampHutScanRange = 16; | ||
+ public boolean catSpawnDisableVillage = false; | ||
+ public int catSpawnVillageScanRange = 48; | ||
+ private void catSettings() { | ||
+ catSpawnDelay = getInt("cat-spawns.delay", catSpawnDelay); | ||
+ catSpawnDisableSwampHut = getBoolean("cat-spawns.swamp-hut.disable", catSpawnDisableSwampHut); | ||
+ catSpawnSwampHutScanRange = getInt("cat-spawns.swamp-hut.scan-range-for-other-cats", catSpawnSwampHutScanRange); | ||
+ catSpawnDisableVillage = getBoolean("cat-spawns.village.disable", catSpawnDisableVillage); | ||
+ catSpawnVillageScanRange = getInt("cat-spawns.village.scan-range-for-other-cats", catSpawnVillageScanRange); | ||
+ } | ||
+ | ||
public int limitPillagerOutpostSpawns = 10; | ||
private void limitPillagerOutpostSpawns() { | ||
limitPillagerOutpostSpawns = getInt("limit-pillager-outpost-spawns", limitPillagerOutpostSpawns); | ||
-- | ||
2.24.0 | ||
|
acfe380
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BillyGalbreath Do you think it would make sense to also add an option for natural spawning bees as well since bees cannot spawn outside of new 1.15 terrain?