2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2020-02-19 01:42:05 +00: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
|
2021-01-11 01:44:06 +00:00
|
|
|
index 7fbd501d70dccf869a4454e2789a5d68f2e15754..9e4591ddc4b755f4ff5a6f1078b51cb13db80480 100644
|
2020-02-19 01:42:05 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-01-11 01:44:06 +00:00
|
|
|
@@ -594,4 +594,9 @@ public class PaperWorldConfig {
|
2020-02-19 01:42:05 +00:00
|
|
|
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);
|
|
|
|
+ }
|
|
|
|
}
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
2021-06-07 15:38:33 +00:00
|
|
|
index b1495da5fdead24caf9e936a385d97fd2db2a0cc..334d60c71fa13841f9d04af5404cc25acbc0ec76 100644
|
2021-03-16 07:19:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2021-03-16 13:04:28 +00:00
|
|
|
@@ -278,6 +278,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2020-02-19 01:42:05 +00:00
|
|
|
public long activatedTick = Integer.MIN_VALUE;
|
2020-03-30 02:26:44 +00:00
|
|
|
public boolean isTemporarilyActive = false; // Paper
|
2020-02-19 01:42:05 +00: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
|
2021-06-07 15:38:33 +00:00
|
|
|
@@ -1694,6 +1695,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2020-02-19 01:42:05 +00:00
|
|
|
if (spawnedViaMobSpawner) {
|
|
|
|
nbttagcompound.setBoolean("Paper.FromMobSpawner", true);
|
|
|
|
}
|
|
|
|
+ if (fromNetherPortal) {
|
|
|
|
+ nbttagcompound.setBoolean("Paper.FromNetherPortal", true);
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
return nbttagcompound;
|
|
|
|
} catch (Throwable throwable) {
|
2021-06-07 15:38:33 +00:00
|
|
|
@@ -1828,6 +1832,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2020-02-19 01:42:05 +00: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 {
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockPortal.java b/src/main/java/net/minecraft/world/level/block/BlockPortal.java
|
2021-03-16 15:50:45 +00:00
|
|
|
index e115ff86987c69f5e3571af5d7f034f24a3f6bba..5f797260eff317409a5039b88b01ad79ee2fdd91 100644
|
2021-03-16 07:19:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockPortal.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockPortal.java
|
2021-03-16 15:50:45 +00:00
|
|
|
@@ -7,6 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraft.network.chat.IChatBaseComponent;
|
|
|
|
import net.minecraft.server.level.WorldServer;
|
|
|
|
import net.minecraft.world.entity.Entity;
|
|
|
|
+import net.minecraft.world.entity.EntityInsentient;
|
|
|
|
import net.minecraft.world.entity.EntityTypes;
|
|
|
|
import net.minecraft.world.entity.EnumMobSpawn;
|
|
|
|
import net.minecraft.world.entity.player.EntityHuman;
|
|
|
|
@@ -62,6 +63,8 @@ public class BlockPortal extends Block {
|
2021-03-16 07:19:45 +00:00
|
|
|
|
|
|
|
if (entity != null) {
|
|
|
|
entity.resetPortalCooldown();
|
|
|
|
+ entity.fromNetherPortal = true; // Paper
|
|
|
|
+ if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|