geforkt von Mirrors/Paper
a923e332ee
Also adds per-world spawn limit config in paper.yml for `underground_water_creature`, and migrates existing spawn limit config options to their Mojang names.
66 Zeilen
3.6 KiB
Diff
66 Zeilen
3.6 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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 705dcec93ab60f88bb407b7d75fbc0aca65fb7f8..1eea1d2b0747b904ff30f0c6debb8f04fcbb6923 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -523,6 +523,11 @@ public class PaperWorldConfig {
|
|
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);
|
|
+ }
|
|
+
|
|
public int lightQueueSize = 20;
|
|
private void lightQueueSize() {
|
|
lightQueueSize = getInt("light-queue-size", lightQueueSize);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index bcdf26151eef02f3e37692a71d579ddfe9d3ed59..e198a4b7f8b0db72855461c2741041e67a195f55 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -330,6 +330,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
|
public long activatedImmunityTick = Integer.MIN_VALUE; // Paper
|
|
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
|
|
@@ -1892,6 +1893,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
|
if (spawnedViaMobSpawner) {
|
|
nbt.putBoolean("Paper.FromMobSpawner", true);
|
|
}
|
|
+ if (fromNetherPortal) {
|
|
+ nbt.putBoolean("Paper.FromNetherPortal", true);
|
|
+ }
|
|
// Paper end
|
|
return nbt;
|
|
} catch (Throwable throwable) {
|
|
@@ -2033,6 +2037,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
|
}
|
|
|
|
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 e34716f2a19eb578fef3f19182c124d359deb88f..cfea29f5bf1c5e74a0292c1344baaaa49c2f4403 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
|
@@ -66,6 +66,8 @@ public class NetherPortalBlock extends Block {
|
|
|
|
if (entity != null) {
|
|
entity.setPortalCooldown();
|
|
+ entity.fromNetherPortal = true; // Paper
|
|
+ if (world.paperConfig.nerfNetherPortalPigmen) ((net.minecraft.world.entity.Mob) entity).aware = false; // Paper
|
|
}
|
|
}
|
|
}
|