Paper/patches/server/0323-Add-option-to-nerf-pigmen-from-nether-portals.patch
Riley Park f17519338b
Expose server build information (#10729)
* Expose server build information

* squash patches

* final tweaks

---------

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: masmc05 <masmc05@gmail.com>
2024-05-15 17:06:59 -07:00

50 lines
2.9 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/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 5bb379251c5af88d4350bd2715147e6442d695fd..f75457a5297fc041de5f2d7eabcc072201a42a09 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -399,6 +399,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public void inactiveTick() { }
// Spigot end
protected int numCollisions = 0; // Paper - Cap entity collisions
+ public boolean fromNetherPortal; // Paper - Add option to nerf pigmen from nether portals
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
// Paper start - Entity origin API
@javax.annotation.Nullable
@@ -2214,6 +2215,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (spawnedViaMobSpawner) {
nbttagcompound.putBoolean("Paper.FromMobSpawner", true);
}
+ if (fromNetherPortal) {
+ nbttagcompound.putBoolean("Paper.FromNetherPortal", true);
+ }
// Paper end
return nbttagcompound;
} catch (Throwable throwable) {
@@ -2356,6 +2360,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
+ fromNetherPortal = nbt.getBoolean("Paper.FromNetherPortal");
if (nbt.contains("Paper.SpawnReason")) {
String spawnReasonName = nbt.getString("Paper.SpawnReason");
try {
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
index f0d4c16fffe7af7e913f4bb300c72f7bdf91e0e8..d3f2c0e3107a781b462a2b67c10cd1e5f05feefb 100644
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
@@ -71,6 +71,8 @@ public class NetherPortalBlock extends Block {
if (entity != null) {
entity.setPortalCooldown();
+ entity.fromNetherPortal = true; // Paper - Add option to nerf pigmen from nether portals
+ if (world.paperConfig().entities.behavior.nerfPigmenFromNetherPortals) ((net.minecraft.world.entity.Mob) entity).aware = false; // Paper - Add option to nerf pigmen from nether portals
}
}
}