Paper/Spigot-Server-Patches/0443-Add-option-to-allow-iron-golems-to-spawn-in-air.patch

36 lines
1.9 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sat, 13 Apr 2019 16:50:58 -0500
Subject: [PATCH] Add option to allow iron golems to spawn in air
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 47c6d66b78ed312ef85dd90178c7d6059bc94661..b773b750ae4cd41708e3fde4c88b5cf1af7098cb 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -413,6 +413,11 @@ public class PaperWorldConfig {
scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true);
}
+ public boolean ironGolemsCanSpawnInAir = false;
+ private void ironGolemsCanSpawnInAir() {
+ ironGolemsCanSpawnInAir = getBoolean("iron-golems-can-spawn-in-air", ironGolemsCanSpawnInAir);
+ }
+
public int bedSearchRadius = 1;
private void bedSearchRadius() {
bedSearchRadius = getInt("bed-search-radius", 1);
diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java
index 2f764776b2fd7b9fd7c2489f1ab914dc6d2f121a..7f6a56776000643ecc42b0b917f6673b7b038d79 100644
--- a/src/main/java/net/minecraft/server/EntityIronGolem.java
+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java
@@ -221,7 +221,7 @@ public class EntityIronGolem extends EntityGolem {
BlockPosition blockposition1 = blockposition.down();
IBlockData iblockdata = iworldreader.getType(blockposition1);
- if (!iblockdata.a((IBlockAccess) iworldreader, blockposition1, (Entity) this)) {
+ if (!iblockdata.a((IBlockAccess) iworldreader, blockposition1, (Entity) this) && !world.paperConfig.ironGolemsCanSpawnInAir) { // Paper
return false;
} else {
for (int i = 1; i < 3; ++i) {