From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath 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 4bfe2fb948ee204f8c5a8c316141904a8a6a8b16..3496f615aa9857aa704767f460b1b166295ccf39 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -596,4 +596,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 e5b8d45ed9f62c28b0429859593d881546ccead2..77f8d5e6662fa75e622f07b3e6efae04c38735fe 100644 --- a/src/main/java/net/minecraft/server/BlockPortal.java +++ b/src/main/java/net/minecraft/server/BlockPortal.java @@ -46,6 +46,8 @@ public class BlockPortal extends Block { if (entity != null) { entity.portalCooldown = entity.getDefaultPortalCooldown(); + 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 6cfbece5cbb6effb843f54e9917a755e2a9df4c5..278b379ba761b76fd94d3cb7aef9d3240271a973 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -195,6 +195,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 @@ -1607,6 +1608,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) { @@ -1731,6 +1735,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 {