Paper/Spigot-Server-Patches/0414-Add-option-to-nerf-pigmen-from-nether-portals.patch
Aikar 1ab021ddca Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
565a5727 #533: Add consumed item, hand and consumeItem boolean to EntityShootBowEvent

CraftBukkit Changes:
927200a9 #718: Add consumed item, hand and consumeItem boolean to EntityShootBowEvent
2020-08-31 08:30:51 -04:00

64 lines
3.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 7 Feb 2020 14:36:56 -0600
Subject: [PATCH] Add option to nerf pigmen from nether portals
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index d846c55de176879e94f6c0e5bf8f58910657fc75..5517caf85740c7d8ac29dba74f5da1c026629f63 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -580,4 +580,9 @@ public class PaperWorldConfig {
disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents);
log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled"));
}
+
+ public boolean nerfNetherPortalPigmen = false;
+ private void nerfNetherPortalPigmen() {
+ nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java
index a224a04ee1bb9705166913ef1c66aa031d87c270..4132cd4c6f13cfa1c0cda43daaa908ff3c07f32b 100644
--- a/src/main/java/net/minecraft/server/BlockPortal.java
+++ b/src/main/java/net/minecraft/server/BlockPortal.java
@@ -44,6 +44,8 @@ public class BlockPortal extends Block {
if (entity != null) {
entity.resetPortalCooldown();
+ entity.fromNetherPortal = true; // Paper
+ if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper
}
}
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 260e87eaec644c5b18c22a6638ef7e5d7f7b786b..14b860e6ba4cde37aa0a6d854187be5765acfa91 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -191,6 +191,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public long activatedTick = Integer.MIN_VALUE;
public boolean isTemporarilyActive = false; // Paper
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
+ public boolean fromNetherPortal; // Paper
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@@ -1602,6 +1603,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (spawnedViaMobSpawner) {
nbttagcompound.setBoolean("Paper.FromMobSpawner", true);
}
+ if (fromNetherPortal) {
+ nbttagcompound.setBoolean("Paper.FromNetherPortal", true);
+ }
// Paper end
return nbttagcompound;
} catch (Throwable throwable) {
@@ -1727,6 +1731,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
}
spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
+ fromNetherPortal = nbttagcompound.getBoolean("Paper.FromNetherPortal");
if (nbttagcompound.hasKey("Paper.SpawnReason")) {
String spawnReasonName = nbttagcompound.getString("Paper.SpawnReason");
try {