mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
50 lines
2.9 KiB
Diff
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 ce2594baa8eb5cfff75a2fb9f3277676a7b08e18..f1b8e3f06db9bef44319c6d53574b1e7188c5931 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
|
|
}
|
|
}
|
|
}
|