2020-04-22 00:06:30 +02:00
|
|
|
From aa70337f4df45eb5d3d89286423c5e5ee73ba431 Mon Sep 17 00:00:00 2001
|
2020-02-19 02:42:05 +01:00
|
|
|
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
|
2020-04-12 08:41:57 +02:00
|
|
|
index bce50218..7d408542 100644
|
2020-02-19 02:42:05 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
@@ -653,4 +653,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
|
2020-04-12 08:41:57 +02:00
|
|
|
index 2dc3ab4c..09c7c131 100644
|
2020-02-19 02:42:05 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockPortal.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockPortal.java
|
|
|
|
@@ -45,6 +45,8 @@ public class BlockPortal extends Block {
|
|
|
|
Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
|
|
|
|
|
|
|
|
if (entity != null) {
|
|
|
|
+ entity.fromNetherPortal = true; // Paper
|
2020-02-21 18:52:20 +01:00
|
|
|
+ if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper
|
2020-02-19 02:42:05 +01:00
|
|
|
entity.portalCooldown = entity.ba();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2020-04-12 08:41:57 +02:00
|
|
|
index a3306c6b..16f2e32d 100644
|
2020-02-19 02:42:05 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2020-03-30 04:26:44 +02:00
|
|
|
@@ -194,6 +194,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-02-19 02:42:05 +01:00
|
|
|
public long activatedTick = Integer.MIN_VALUE;
|
2020-03-30 04:26:44 +02:00
|
|
|
public boolean isTemporarilyActive = false; // Paper
|
2020-02-19 02:42:05 +01:00
|
|
|
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
|
2020-04-12 08:41:57 +02:00
|
|
|
@@ -1645,6 +1646,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-02-19 02:42:05 +01:00
|
|
|
if (spawnedViaMobSpawner) {
|
|
|
|
nbttagcompound.setBoolean("Paper.FromMobSpawner", true);
|
|
|
|
}
|
|
|
|
+ if (fromNetherPortal) {
|
|
|
|
+ nbttagcompound.setBoolean("Paper.FromNetherPortal", true);
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
return nbttagcompound;
|
|
|
|
} catch (Throwable throwable) {
|
2020-04-12 08:41:57 +02:00
|
|
|
@@ -1767,6 +1771,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-02-19 02:42:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
|
|
|
--
|
2020-04-22 00:06:30 +02:00
|
|
|
2.25.1.windows.1
|
2020-02-19 02:42:05 +01:00
|
|
|
|