mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 07:48:53 +01:00
Configurable spawn chances for skeleton horses
Closes feature request GH-111
This commit is contained in:
parent
c1818249ac
commit
3f3fc8b6dc
3 changed files with 48 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
From 28bd75dabd3ed085189145006f8d09a99715a093 Mon Sep 17 00:00:00 2001
|
From 5c3d517ea581e47e6071bf2665291596bda05a15 Mon Sep 17 00:00:00 2001
|
||||||
From: Byteflux <byte@byteflux.net>
|
From: Byteflux <byte@byteflux.net>
|
||||||
Date: Tue, 1 Mar 2016 23:45:08 -0600
|
Date: Tue, 1 Mar 2016 23:45:08 -0600
|
||||||
Subject: [PATCH] FallingBlock and TNTPrimed source location API
|
Subject: [PATCH] FallingBlock and TNTPrimed source location API
|
||||||
|
@ -74,7 +74,7 @@ index d7bea3d..c1c0c7c 100644
|
||||||
|
|
||||||
world.addEntity(entitytntprimed);
|
world.addEntity(entitytntprimed);
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||||
index 4c8e336..c44e493 100644
|
index 6246c05..5e8523d 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||||
@@ -17,13 +17,25 @@ public class EntityFallingBlock extends Entity {
|
@@ -17,13 +17,25 @@ public class EntityFallingBlock extends Entity {
|
||||||
|
@ -193,10 +193,10 @@ index 564ea37..1820c7b 100644
|
||||||
|
|
||||||
public EntityLiving getSource() {
|
public EntityLiving getSource() {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index a487c2f..33c3428 100644
|
index 83e3003..25edfb8 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
@@ -916,7 +916,10 @@ public class CraftWorld implements World {
|
@@ -921,7 +921,10 @@ public class CraftWorld implements World {
|
||||||
double y = location.getBlockY() + 0.5;
|
double y = location.getBlockY() + 0.5;
|
||||||
double z = location.getBlockZ() + 0.5;
|
double z = location.getBlockZ() + 0.5;
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ index a487c2f..33c3428 100644
|
||||||
entity.ticksLived = 1;
|
entity.ticksLived = 1;
|
||||||
|
|
||||||
world.addEntity(entity, SpawnReason.CUSTOM);
|
world.addEntity(entity, SpawnReason.CUSTOM);
|
||||||
@@ -952,7 +955,10 @@ public class CraftWorld implements World {
|
@@ -957,7 +960,10 @@ public class CraftWorld implements World {
|
||||||
int type = CraftMagicNumbers.getId(blockData.getBlock());
|
int type = CraftMagicNumbers.getId(blockData.getBlock());
|
||||||
int data = blockData.getBlock().toLegacyData(blockData);
|
int data = blockData.getBlock().toLegacyData(blockData);
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ index a487c2f..33c3428 100644
|
||||||
} else if (Projectile.class.isAssignableFrom(clazz)) {
|
} else if (Projectile.class.isAssignableFrom(clazz)) {
|
||||||
if (Snowball.class.isAssignableFrom(clazz)) {
|
if (Snowball.class.isAssignableFrom(clazz)) {
|
||||||
entity = new EntitySnowball(world, x, y, z);
|
entity = new EntitySnowball(world, x, y, z);
|
||||||
@@ -1157,7 +1163,8 @@ public class CraftWorld implements World {
|
@@ -1162,7 +1168,8 @@ public class CraftWorld implements World {
|
||||||
throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location);
|
throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location);
|
||||||
}
|
}
|
||||||
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
|
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 6fdb5fbb0ccfd757fd43069d78c924d3e57837af Mon Sep 17 00:00:00 2001
|
From 48991a207b2252026559f74e4c497434ff6202e9 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Fri, 18 Mar 2016 17:57:25 -0400
|
Date: Fri, 18 Mar 2016 17:57:25 -0400
|
||||||
Subject: [PATCH] Optimize Chunk Unload Queue
|
Subject: [PATCH] Optimize Chunk Unload Queue
|
||||||
|
@ -261,7 +261,7 @@ index a6c8e53..d8bd36c 100644
|
||||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
|
||||||
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
|
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index be311cd..6307c19 100644
|
index c51c74b..caa5e62 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
@@ -206,7 +206,7 @@ public class CraftWorld implements World {
|
@@ -206,7 +206,7 @@ public class CraftWorld implements World {
|
||||||
|
@ -299,7 +299,7 @@ index be311cd..6307c19 100644
|
||||||
if (neighbor != null) {
|
if (neighbor != null) {
|
||||||
neighbor.setNeighborLoaded(-x, -z);
|
neighbor.setNeighborLoaded(-x, -z);
|
||||||
chunk.setNeighborLoaded(x, z);
|
chunk.setNeighborLoaded(x, z);
|
||||||
@@ -1538,7 +1539,7 @@ public class CraftWorld implements World {
|
@@ -1543,7 +1544,7 @@ public class CraftWorld implements World {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Already unloading?
|
// Already unloading?
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
From 55928e9bb2824290e4135881784001be635f74da Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||||
|
Date: Tue, 22 Mar 2016 12:04:28 -0500
|
||||||
|
Subject: [PATCH] Configurable spawn chances for skeleton horses
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
|
index 38272c4..8cd2070 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
|
@@ -301,4 +301,9 @@ public class PaperWorldConfig {
|
||||||
|
}
|
||||||
|
log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ public double skeleHorseSpawnChance;
|
||||||
|
+ private void skeleHorseSpawnChance() {
|
||||||
|
+ skeleHorseSpawnChance = getDouble("skeleton-horse-thunder-soawn-chance", -1.0D); // -1.0D represents a "vanilla" state
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
|
index 7e06fa9..f7bb918 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
||||||
|
@@ -426,7 +426,10 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
||||||
|
if (this.isRainingAt(blockposition)) {
|
||||||
|
DifficultyDamageScaler difficultydamagescaler = this.D(blockposition);
|
||||||
|
|
||||||
|
- if (this.random.nextDouble() < (double) difficultydamagescaler.b() * 0.05D) {
|
||||||
|
+ // Paper start - Configurable skeleton horse spawn chance
|
||||||
|
+ double chance = this.paperConfig.skeleHorseSpawnChance == -1.0D ? (double) difficultydamagescaler.b() * 0.05D : this.paperConfig.skeleHorseSpawnChance;
|
||||||
|
+ if (this.random.nextDouble() < chance) {
|
||||||
|
+ // Paper end
|
||||||
|
EntityHorse entityhorse = new EntityHorse(this);
|
||||||
|
|
||||||
|
entityhorse.setType(EnumHorseType.SKELETON);
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
Loading…
Reference in a new issue