mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
remove no longer needed patches and fix tests
This commit is contained in:
parent
1bc278b125
commit
19ac9d43ce
@ -6,7 +6,7 @@ Subject: [PATCH] Add missing effects
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Effect.java b/src/main/java/org/bukkit/Effect.java
|
||||
index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..326c99d91ae125b28054b5730b9576b214e4595e 100644
|
||||
index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..88e93da6021b90a3351df17d95adc4d9277578f8 100644
|
||||
--- a/src/main/java/org/bukkit/Effect.java
|
||||
+++ b/src/main/java/org/bukkit/Effect.java
|
||||
@@ -131,9 +131,9 @@ public enum Effect {
|
||||
@ -31,7 +31,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..326c99d91ae125b28054b5730b9576b2
|
||||
VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class),
|
||||
/**
|
||||
* The sound/particles used by the enderdragon's breath
|
||||
@@ -336,21 +338,152 @@ public enum Effect {
|
||||
@@ -336,21 +338,197 @@ public enum Effect {
|
||||
* block.
|
||||
*/
|
||||
OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL),
|
||||
@ -143,6 +143,16 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..326c99d91ae125b28054b5730b9576b2
|
||||
+ */
|
||||
+ BEE_GROWTH(2011, Type.VISUAL, Integer.class),
|
||||
+
|
||||
+ /**
|
||||
+ * {@link Integer} param is the number of particles
|
||||
+ */
|
||||
+ TURTLE_EGG_PLACEMENT(2012, Type.VISUAL, Integer.class),
|
||||
+
|
||||
+ /**
|
||||
+ * {@link Integer} param is relative to the number of particles
|
||||
+ */
|
||||
+ SMASH_ATTACK(2013, Type.VISUAL, Integer.class),
|
||||
+
|
||||
+ PARTICLES_SCULK_CHARGE(3006, Type.VISUAL, Integer.class),
|
||||
+
|
||||
+ PARTICLES_SCULK_SHRIEK(3007, Type.SOUND),
|
||||
@ -154,9 +164,15 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..326c99d91ae125b28054b5730b9576b2
|
||||
+ @Deprecated(forRemoval = true, since = "1.20.5")
|
||||
+ GUST_DUST(3010, Type.VISUAL),
|
||||
+
|
||||
+ TRIAL_SPAWNER_SPAWN(3011, Type.VISUAL),
|
||||
+ /**
|
||||
+ * {@link Boolean} param is true for "ominous" vaults
|
||||
+ */
|
||||
+ TRIAL_SPAWNER_SPAWN(3011, Type.VISUAL, Boolean.class),
|
||||
+
|
||||
+ TRIAL_SPAWNER_SPAWN_MOB_AT(3012, Type.VISUAL),
|
||||
+ /**
|
||||
+ * {@link Boolean} param is true for "ominous" vaults
|
||||
+ */
|
||||
+ TRIAL_SPAWNER_SPAWN_MOB_AT(3012, Type.VISUAL, Boolean.class),
|
||||
+
|
||||
+ /**
|
||||
+ * {@link Integer} param is the number of players
|
||||
@ -164,6 +180,35 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..326c99d91ae125b28054b5730b9576b2
|
||||
+ TRIAL_SPAWNER_DETECT_PLAYER(3013, Type.VISUAL, Integer.class),
|
||||
+
|
||||
+ TRIAL_SPAWNER_EJECT_ITEM(3014, Type.VISUAL),
|
||||
+
|
||||
+ /**
|
||||
+ * {@link Boolean} param is true for "ominous" vaults
|
||||
+ */
|
||||
+ VAULT_ACTIVATE(3015, Type.VISUAL, Boolean.class),
|
||||
+
|
||||
+ /**
|
||||
+ * {@link Boolean} param is true for "ominous" vaults
|
||||
+ */
|
||||
+ VAULT_DEACTIVATE(3016, Type.VISUAL, Boolean.class),
|
||||
+
|
||||
+ VAULT_EJECT_ITEM(3017, Type.VISUAL),
|
||||
+
|
||||
+ SPAWN_COBWEB(3018, Type.VISUAL),
|
||||
+
|
||||
+ /**
|
||||
+ * {@link Integer} param is the number of players
|
||||
+ */
|
||||
+ TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS(3019, Type.VISUAL, Integer.class),
|
||||
+
|
||||
+ /**
|
||||
+ * {@link Boolean} param is true for changing to "ominous"
|
||||
+ */
|
||||
+ TRIAL_SPAWNER_BECOME_OMINOUS(3020, Type.VISUAL, Boolean.class),
|
||||
+
|
||||
+ /**
|
||||
+ * {@link Boolean} param is true for "ominous" vaults
|
||||
+ */
|
||||
+ TRIAL_SPAWNER_SPAWN_ITEM(3021, Type.VISUAL, Boolean.class)
|
||||
;
|
||||
+ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger();
|
||||
+ // Paper end
|
||||
@ -188,7 +233,7 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..326c99d91ae125b28054b5730b9576b2
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,8 +499,10 @@ public enum Effect {
|
||||
@@ -366,8 +544,10 @@ public enum Effect {
|
||||
|
||||
/**
|
||||
* @return The type of the effect.
|
||||
@ -199,24 +244,25 @@ index fd9cf25f2fdef5ee3b7143f27e5f43dfe3f21a38..326c99d91ae125b28054b5730b9576b2
|
||||
public Type getType() {
|
||||
return this.type;
|
||||
}
|
||||
@@ -378,8 +513,15 @@ public enum Effect {
|
||||
@@ -378,9 +558,16 @@ public enum Effect {
|
||||
*/
|
||||
@Nullable
|
||||
public Class<?> getData() {
|
||||
- return this.data;
|
||||
+ return this.data == null ? null : this.data.get(0); // Paper
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // Paper start - support deprecated data types
|
||||
+ @org.jetbrains.annotations.ApiStatus.Internal
|
||||
+ public boolean isApplicable(Object obj) {
|
||||
+ return this.data != null && com.google.common.collect.Iterables.any(this.data, aClass -> aClass.isAssignableFrom(obj.getClass()));
|
||||
}
|
||||
+ }
|
||||
+ // Paper end - support deprecated data types
|
||||
|
||||
+
|
||||
/**
|
||||
* Gets the Effect associated with the given ID.
|
||||
@@ -396,12 +538,26 @@ public enum Effect {
|
||||
*
|
||||
@@ -396,12 +583,26 @@ public enum Effect {
|
||||
|
||||
static {
|
||||
for (Effect effect : values()) {
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Replace ItemFlag.HIDE_POTION_EFFECTS
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFlag.java b/src/main/java/org/bukkit/inventory/ItemFlag.java
|
||||
index 1b3580d1861af402396121805715e4087b3bc587..7174b843b7deac023637c6c112cf30a567969971 100644
|
||||
index 1b3580d1861af402396121805715e4087b3bc587..a435f6c8947e4ac50b8c04f37b107055970937dd 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemFlag.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemFlag.java
|
||||
@@ -38,4 +38,26 @@ public enum ItemFlag {
|
||||
@@ -38,4 +38,27 @@ public enum ItemFlag {
|
||||
* Setting to show/hide armor trim from armor.
|
||||
*/
|
||||
HIDE_ARMOR_TRIM;
|
||||
@ -30,6 +30,7 @@ index 1b3580d1861af402396121805715e4087b3bc587..7174b843b7deac023637c6c112cf30a5
|
||||
+ * <li>Shulker box contents</li>
|
||||
+ * <li>Spawner descriptions</li>
|
||||
+ * </ul>
|
||||
+ * @deprecated use {@link #HIDE_ADDITIONAL_TOOLTIP}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static final ItemFlag HIDE_ITEM_SPECIFICS = HIDE_ADDITIONAL_TOOLTIP;
|
||||
|
@ -482,10 +482,10 @@ index 0000000000000000000000000000000000000000..c01b4393439838976965823298f12e47
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a8268886d4a039975b6fed94b8dc325a8270f5fd
|
||||
index 0000000000000000000000000000000000000000..4a34a49f12b106976ba19436f96f74ebb068249c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -0,0 +1,313 @@
|
||||
@@ -0,0 +1,311 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import co.aikar.timings.MinecraftTimings;
|
||||
@ -646,8 +646,6 @@ index 0000000000000000000000000000000000000000..a8268886d4a039975b6fed94b8dc325a
|
||||
+ public boolean performUsernameValidation = true;
|
||||
+ @Comment("This setting controls if players should be able to create headless pistons.")
|
||||
+ public boolean allowHeadlessPistons = false;
|
||||
+ @Comment("This setting controls if grindstones should be able to output overstacked items (such as cursed books).")
|
||||
+ public boolean allowGrindstoneOverstacking = false;
|
||||
+ @Comment("This setting controls what compression format is used for region files.")
|
||||
+ public CompressionFormat compressionFormat = CompressionFormat.ZLIB;
|
||||
+
|
||||
@ -1310,10 +1308,10 @@ index 0000000000000000000000000000000000000000..fa1c0aee8c3a4d0868482cf5c703bbfd
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..351fbbc577556ebbd62222615801a96b7c115822
|
||||
index 0000000000000000000000000000000000000000..ede22142ef70bbdc6ede22ff4a13ed69fbce4915
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/RemovedConfigurations.java
|
||||
@@ -0,0 +1,78 @@
|
||||
@@ -0,0 +1,80 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import org.spongepowered.configurate.NodePath;
|
||||
@ -1367,7 +1365,8 @@ index 0000000000000000000000000000000000000000..351fbbc577556ebbd62222615801a96b
|
||||
+ path("tnt-explosion-volume"),
|
||||
+ path("entities", "spawning", "despawn-ranges", "soft"),
|
||||
+ path("entities", "spawning", "despawn-ranges", "hard"),
|
||||
+ path("fixes", "fix-curing-zombie-villager-discount-exploit")
|
||||
+ path("fixes", "fix-curing-zombie-villager-discount-exploit"),
|
||||
+ path("entities", "mob-effects", "undead-immune-to-certain-effects")
|
||||
+ };
|
||||
+
|
||||
+ NodePath[] REMOVED_GLOBAL_PATHS = {
|
||||
@ -1388,16 +1387,17 @@ index 0000000000000000000000000000000000000000..351fbbc577556ebbd62222615801a96b
|
||||
+ path("baby-zombie-movement-speed"),
|
||||
+ path("limit-player-interactions"),
|
||||
+ path("warnWhenSettingExcessiveVelocity"),
|
||||
+ path("logging", "use-rgb-for-named-text-colors")
|
||||
+ path("logging", "use-rgb-for-named-text-colors"),
|
||||
+ path("unsupported-settings", "allow-grindstone-overstacking")
|
||||
+ };
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d3fdf62912d190f8b468b77230a927023c361074
|
||||
index 0000000000000000000000000000000000000000..bfc10ae8e09ac07b969a38eecddfab1e3c308f5a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,554 @@
|
||||
@@ -0,0 +1,553 @@
|
||||
+package io.papermc.paper.configuration;
|
||||
+
|
||||
+import com.google.common.collect.HashBasedTable;
|
||||
@ -1539,7 +1539,6 @@ index 0000000000000000000000000000000000000000..d3fdf62912d190f8b468b77230a92702
|
||||
+ public MobEffects mobEffects;
|
||||
+
|
||||
+ public class MobEffects extends ConfigurationPart {
|
||||
+ public boolean undeadImmuneToCertainEffects = true;
|
||||
+ public boolean spidersImmuneToPoisonEffect = true;
|
||||
+ public ImmuneToWitherEffect immuneToWitherEffect;
|
||||
+
|
||||
|
@ -120,6 +120,18 @@ index 1e3ca7ca98abfd5be233a7eeb6dad201776d2d6a..9ec50bbb262b25fea157ae48e8395f5c
|
||||
this.acceptsAll(Main.asList("nogui"), "Disables the graphical console");
|
||||
|
||||
this.acceptsAll(Main.asList("nojline"), "Disables jline and emulates the vanilla console");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
|
||||
index 6b34a8d33faa49ffa9082995e67af10d3cb38c03..f0c817e27a602740bc979b2ebaec3917e1906d74 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
|
||||
@@ -127,6 +127,7 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
|
||||
|
||||
@Override
|
||||
public int getMapId() {
|
||||
+ Preconditions.checkState(this.hasMapView(), "Item does not have map associated - check hasMapView() first!"); // Paper - more friendly message
|
||||
return this.mapId;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
index 905adf97c0d1f0d1c774a6835a5dffcfea884e58..c017ce2ca1bc535795c958a2e509af2adf88efa9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
|
@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or
|
||||
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index a8268886d4a039975b6fed94b8dc325a8270f5fd..0b283171294eca65a898ddd9ab1b7295ad183b0d 100644
|
||||
index 4a34a49f12b106976ba19436f96f74ebb068249c..d12fd313730c44dcec3c73fcd8c99c0c84f46743 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -287,7 +287,18 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -285,7 +285,18 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
@PostProcess
|
||||
private void postProcess() {
|
||||
|
@ -9,20 +9,25 @@ upstream. Until then, this test and these fixes
|
||||
should address all the known issues with them
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
|
||||
index 71733f918ed84b9879ac1b142ef6205c5e768a9c..239bbc2f5d2010e203eda2750777e507fc5937d0 100644
|
||||
index 71733f918ed84b9879ac1b142ef6205c5e768a9c..c856384019eff2f2d0bb831ebe1ccb0fb9210782 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftEffect.java
|
||||
@@ -15,6 +15,9 @@ public class CraftEffect {
|
||||
@@ -15,6 +15,14 @@ public class CraftEffect {
|
||||
public static <T> int getDataValue(Effect effect, T data) {
|
||||
int datavalue;
|
||||
switch (effect) {
|
||||
+ case PARTICLES_SCULK_CHARGE: // Paper - add missing effects
|
||||
+ case TRIAL_SPAWNER_DETECT_PLAYER: // Paper - add missing effects
|
||||
+ case BEE_GROWTH: // Paper - add missing effects
|
||||
+ // Paper start - add missing effects
|
||||
+ case PARTICLES_SCULK_CHARGE:
|
||||
+ case TRIAL_SPAWNER_DETECT_PLAYER:
|
||||
+ case BEE_GROWTH:
|
||||
+ case TURTLE_EGG_PLACEMENT:
|
||||
+ case SMASH_ATTACK:
|
||||
+ case TRIAL_SPAWNER_DETECT_PLAYER_OMINOUS:
|
||||
+ // Paper end - add missing effects
|
||||
case VILLAGER_PLANT_GROW:
|
||||
datavalue = (Integer) data;
|
||||
break;
|
||||
@@ -26,6 +29,13 @@ public class CraftEffect {
|
||||
@@ -26,6 +34,13 @@ public class CraftEffect {
|
||||
Preconditions.checkArgument(data == Material.AIR || ((Material) data).isRecord(), "Invalid record type for Material %s!", data);
|
||||
datavalue = Item.getId(CraftItemType.bukkitToMinecraft((Material) data));
|
||||
break;
|
||||
@ -36,7 +41,7 @@ index 71733f918ed84b9879ac1b142ef6205c5e768a9c..239bbc2f5d2010e203eda2750777e507
|
||||
case SMOKE:
|
||||
switch ((BlockFace) data) {
|
||||
case DOWN:
|
||||
@@ -57,8 +67,15 @@ public class CraftEffect {
|
||||
@@ -57,10 +72,25 @@ public class CraftEffect {
|
||||
}
|
||||
break;
|
||||
case STEP_SOUND:
|
||||
@ -51,7 +56,17 @@ index 71733f918ed84b9879ac1b142ef6205c5e768a9c..239bbc2f5d2010e203eda2750777e507
|
||||
+ // Paper end
|
||||
break;
|
||||
case COMPOSTER_FILL_ATTEMPT:
|
||||
+ // Paper start - add missing effects
|
||||
+ case TRIAL_SPAWNER_SPAWN:
|
||||
+ case TRIAL_SPAWNER_SPAWN_MOB_AT:
|
||||
+ case VAULT_ACTIVATE:
|
||||
+ case VAULT_DEACTIVATE:
|
||||
+ case TRIAL_SPAWNER_BECOME_OMINOUS:
|
||||
+ case TRIAL_SPAWNER_SPAWN_ITEM:
|
||||
+ // Paper end - add missing effects
|
||||
datavalue = ((Boolean) data) ? 1 : 0;
|
||||
break;
|
||||
case BONE_MEAL_USE:
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0c5c67480e16333641f4ebc89d892f7a0e2387fd..18c1cceb9e8b2873b24134a9e012633616634aae 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
|
@ -17,7 +17,7 @@ index c01b4393439838976965823298f12e4762e72eff..218bf89fd7583d6db9f64754c4db8fcc
|
||||
node = loader.load();
|
||||
this.verifyGlobalConfigVersion(node);
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 0b283171294eca65a898ddd9ab1b7295ad183b0d..481cfe3a291196c0391c2ec8560e566e0e1e2fb8 100644
|
||||
index d12fd313730c44dcec3c73fcd8c99c0c84f46743..5f59e733c00de9c0f5692b3b3c092a050a9f409f 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
@ -91,7 +91,7 @@ index 9cc81bcccbf1141f66fedada1359b7c0dfa8e22a..5c5b64bd058684520fa175bfd10622ff
|
||||
public String toString() {
|
||||
return "CraftMushroomCow";
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0fb3703c69 100644
|
||||
index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..14e944b4e83b80e0fc6d81e346cc305ab00561c5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
@@ -22,7 +22,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
@ -132,7 +132,7 @@ index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0f
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
@@ -120,27 +120,46 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
@@ -120,27 +120,47 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
@Override
|
||||
public boolean addCustomEffect(PotionEffect effect, boolean overwrite) {
|
||||
Preconditions.checkArgument(effect != null, "Potion effect cannot be null");
|
||||
@ -141,52 +141,61 @@ index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0f
|
||||
|
||||
- int index = this.indexOfEffect(effect.getType());
|
||||
- if (index != -1) {
|
||||
- if (overwrite) {
|
||||
- PotionEffect old = this.customEffects.get(index);
|
||||
- if (old.getDuration() == effect.getDuration()) {
|
||||
+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
+ @Override
|
||||
+ public boolean addCustomEffect(final io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, final boolean overwrite) {
|
||||
+ Preconditions.checkArgument(suspiciousEffectEntry != null, "Suspicious effect entry cannot be null");
|
||||
+ final List<io.papermc.paper.potion.SuspiciousEffectEntry> matchingEffects = this.customEffects.stream().filter(
|
||||
+ entry -> entry.effect() == suspiciousEffectEntry.effect()
|
||||
+ ).toList();
|
||||
+ if (!matchingEffects.isEmpty()) {
|
||||
if (overwrite) {
|
||||
- PotionEffect old = this.customEffects.get(index);
|
||||
- if (old.getDuration() == effect.getDuration()) {
|
||||
+ boolean foundMatchingDuration = false;
|
||||
+ boolean mutated = false;
|
||||
+ for (final io.papermc.paper.potion.SuspiciousEffectEntry matchingEffect : matchingEffects) {
|
||||
+ if (matchingEffect.duration() != suspiciousEffectEntry.duration()) {
|
||||
+ this.customEffects.remove(suspiciousEffectEntry);
|
||||
+ mutated = true;
|
||||
+ } else {
|
||||
+ foundMatchingDuration = true;
|
||||
+ if (this.hasCustomEffects()) {
|
||||
+ final List<io.papermc.paper.potion.SuspiciousEffectEntry> matchingEffects = this.customEffects.stream().filter(
|
||||
+ entry -> entry.effect() == suspiciousEffectEntry.effect()
|
||||
+ ).toList();
|
||||
+ if (!matchingEffects.isEmpty()) {
|
||||
+ if (overwrite) {
|
||||
+ boolean foundMatchingDuration = false;
|
||||
+ boolean mutated = false;
|
||||
+ for (final io.papermc.paper.potion.SuspiciousEffectEntry matchingEffect : matchingEffects) {
|
||||
+ if (matchingEffect.duration() != suspiciousEffectEntry.duration()) {
|
||||
+ this.customEffects.remove(suspiciousEffectEntry);
|
||||
+ mutated = true;
|
||||
+ } else {
|
||||
+ foundMatchingDuration = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (foundMatchingDuration && !mutated) {
|
||||
+ if (foundMatchingDuration && !mutated) {
|
||||
+ return false;
|
||||
+ } else if (!foundMatchingDuration) {
|
||||
+ this.customEffects.add(suspiciousEffectEntry);
|
||||
+ }
|
||||
+ return true;
|
||||
+ } else {
|
||||
return false;
|
||||
+ } else if (!foundMatchingDuration) {
|
||||
+ this.customEffects.add(suspiciousEffectEntry);
|
||||
}
|
||||
- this.customEffects.set(index, effect);
|
||||
return true;
|
||||
- return true;
|
||||
- } else {
|
||||
+ } else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (this.customEffects == null) {
|
||||
this.customEffects = new ArrayList<>();
|
||||
- return false;
|
||||
}
|
||||
- } else {
|
||||
- if (this.customEffects == null) {
|
||||
- this.customEffects = new ArrayList<>();
|
||||
- }
|
||||
- this.customEffects.add(effect);
|
||||
+ this.customEffects.add(suspiciousEffectEntry);
|
||||
return true;
|
||||
- return true;
|
||||
}
|
||||
+ if (this.customEffects == null) {
|
||||
+ this.customEffects = new ArrayList<>();
|
||||
+ }
|
||||
+ this.customEffects.add(suspiciousEffectEntry);
|
||||
+ return true;
|
||||
}
|
||||
+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta
|
||||
|
||||
@Override
|
||||
public boolean removeCustomEffect(PotionEffectType type) {
|
||||
@@ -151,10 +170,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
@@ -151,10 +171,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
}
|
||||
|
||||
boolean changed = false;
|
||||
@ -202,7 +211,7 @@ index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0f
|
||||
iterator.remove();
|
||||
changed = true;
|
||||
}
|
||||
@@ -177,7 +198,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
@@ -177,7 +199,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.customEffects.size(); i++) {
|
||||
@ -211,7 +220,7 @@ index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..4825edab85c7969e96018eb9ff47ef0f
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -222,7 +243,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
@@ -222,7 +244,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
super.serialize(builder);
|
||||
|
||||
if (this.hasCustomEffects()) {
|
||||
|
@ -14605,7 +14605,7 @@ index 0000000000000000000000000000000000000000..962d3cae6340fc11607b59355e291629
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 481cfe3a291196c0391c2ec8560e566e0e1e2fb8..30fe1c0645a07d663b08c0f988a1ab3a750bf7c4 100644
|
||||
index 5f59e733c00de9c0f5692b3b3c092a050a9f409f..b8a89bf8a7a0ef25f00ccc0e84ca64f4524fdc3e 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -29,6 +29,45 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@ -14676,7 +14676,7 @@ index 481cfe3a291196c0391c2ec8560e566e0e1e2fb8..30fe1c0645a07d663b08c0f988a1ab3a
|
||||
public UnsupportedSettings unsupportedSettings;
|
||||
|
||||
public class UnsupportedSettings extends ConfigurationPart {
|
||||
@@ -203,7 +227,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -201,7 +225,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
@PostProcess
|
||||
private void postProcess() {
|
||||
|
@ -5,9 +5,18 @@ Subject: [PATCH] handle converting old serialized names to new names
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index bf0870590fcf5c502cd986047efec9f754faf9a7..dabbdadf3824d1132bd4aa6d2f2360c270fa299a 100644
|
||||
index bf0870590fcf5c502cd986047efec9f754faf9a7..ee760d45c8e95c4f5a973254da7531d355aa5fee 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -490,7 +490,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
for (Object hideFlagObject : hideFlags) {
|
||||
String hideFlagString = (String) hideFlagObject;
|
||||
try {
|
||||
- ItemFlag hideFlatEnum = ItemFlag.valueOf(hideFlagString);
|
||||
+ ItemFlag hideFlatEnum = ItemFlag.valueOf(org.bukkit.craftbukkit.legacy.FieldRename.convertItemFlagName(org.bukkit.craftbukkit.util.ApiVersion.CURRENT, hideFlagString)); // Paper - handle old field names
|
||||
this.addItemFlags(hideFlatEnum);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Ignore when we got a old String which does not map to a Enum value anymore
|
||||
@@ -661,7 +661,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
enchantKey = "SWEEPING_EDGE";
|
||||
}
|
||||
@ -17,16 +26,12 @@ index bf0870590fcf5c502cd986047efec9f754faf9a7..dabbdadf3824d1132bd4aa6d2f2360c2
|
||||
if ((enchantment != null) && (entry.getValue() instanceof Integer)) {
|
||||
enchantments.put(enchantment, (Integer) entry.getValue());
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
|
||||
index a6d2370113eb44c0863b7837362dbb350f5057c6..21dbce78b1a0d42d20c9e7f87f8bee1c18c1353f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
|
||||
@@ -138,7 +138,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||
|
||||
String entityType = SerializableMeta.getString(map, CraftMetaSpawnEgg.ENTITY_ID.BUKKIT, true);
|
||||
if (entityType != null) {
|
||||
- this.spawnedType = EntityType.fromName(entityType);
|
||||
+ this.spawnedType = EntityType.fromName(org.bukkit.craftbukkit.legacy.FieldRename.convertEntityTypeName(org.bukkit.craftbukkit.util.ApiVersion.CURRENT, entityType)); // Paper - handle old entity type field names
|
||||
}
|
||||
}
|
||||
|
||||
@@ -695,7 +695,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
continue;
|
||||
}
|
||||
AttributeModifier modifier = (AttributeModifier) o;
|
||||
- Attribute attribute = EnumUtils.getEnum(Attribute.class, attributeName.toUpperCase(Locale.ROOT));
|
||||
+ Attribute attribute = EnumUtils.getEnum(Attribute.class, org.bukkit.craftbukkit.legacy.FieldRename.convertAttributeName(org.bukkit.craftbukkit.util.ApiVersion.CURRENT, attributeName.toUpperCase(Locale.ROOT))); // Paper - handle old field names
|
||||
if (attribute == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 2 Dec 2020 21:03:02 -0800
|
||||
Subject: [PATCH] Add config for mobs immune to default effects
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index c23d4ee0a16d1ae7168b2496d97189a14256bdcc..7ddca52f7fe3f289b4b867e134326b1ead1a2aee 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -604,7 +604,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
|
||||
@Override
|
||||
public boolean canBeAffected(MobEffectInstance effect) {
|
||||
- return effect.is(MobEffects.WITHER) ? false : super.canBeAffected(effect);
|
||||
+ return effect.is(MobEffects.WITHER) && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.wither ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
|
||||
}
|
||||
|
||||
private class WitherDoNothingGoal extends Goal {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
index ef8911f7bcf6a97496675abb4689bb09cf322e85..fa0316e9d2a4cf213982994dc8bf310299cca984 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
@@ -126,7 +126,7 @@ public class Spider extends Monster {
|
||||
|
||||
@Override
|
||||
public boolean canBeAffected(MobEffectInstance effect) {
|
||||
- return effect.is(MobEffects.POISON) ? false : super.canBeAffected(effect);
|
||||
+ return effect.is(MobEffects.POISON) && this.level().paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
|
||||
}
|
||||
|
||||
public boolean isClimbing() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
||||
index 05e9b083f7e49bd7a24f04fd2c46acef6d011e48..3f1191795e58f31b7e2fe34ef2774df13b9a789f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
||||
@@ -113,6 +113,6 @@ public class WitherSkeleton extends AbstractSkeleton {
|
||||
|
||||
@Override
|
||||
public boolean canBeAffected(MobEffectInstance effect) {
|
||||
- return effect.is(MobEffects.WITHER) ? false : super.canBeAffected(effect);
|
||||
+ return effect.is(MobEffects.WITHER) && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
|
||||
}
|
||||
}
|
45
patches/server/1039-Deep-clone-nbt-tags-in-PDC.patch
Normal file
45
patches/server/1039-Deep-clone-nbt-tags-in-PDC.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SoSeDiK <mrsosedik@gmail.com>
|
||||
Date: Thu, 26 May 2022 03:30:05 +0300
|
||||
Subject: [PATCH] Deep clone nbt tags in PDC
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index ee760d45c8e95c4f5a973254da7531d355aa5fee..9c813ebe1d9e735368006f48c72db62fdbdf96f7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -284,7 +284,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
this.damage = meta.damage;
|
||||
this.maxDamage = meta.maxDamage;
|
||||
this.unhandledTags = meta.unhandledTags;
|
||||
- this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
|
||||
+ this.persistentDataContainer.putAll(meta.persistentDataContainer.getTagsCloned()); // Paper - deep clone NBT tags
|
||||
|
||||
this.customTag = meta.customTag;
|
||||
|
||||
@@ -1509,7 +1509,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
if (this.customTag != null) {
|
||||
clone.customTag = this.customTag.copy();
|
||||
}
|
||||
- clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getRaw(), CraftMetaItem.DATA_TYPE_REGISTRY);
|
||||
+ clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getTagsCloned(), CraftMetaItem.DATA_TYPE_REGISTRY); // Paper - deep clone NBT tags
|
||||
clone.hideFlag = this.hideFlag;
|
||||
clone.hideTooltip = this.hideTooltip;
|
||||
clone.unbreakable = this.unbreakable;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
index 5a4e7e7150b7c137b077e0b393f17ed35b5aec34..f55fdd57ced259ad5a95878840e98ffaa3db2e05 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
@@ -207,4 +207,12 @@ public class CraftPersistentDataContainer implements PersistentDataContainer {
|
||||
}
|
||||
}
|
||||
// Paper end - byte array serialization
|
||||
+
|
||||
+ // Paper start - deep clone tags
|
||||
+ public Map<String, Tag> getTagsCloned() {
|
||||
+ final Map<String, Tag> tags = new HashMap<>();
|
||||
+ this.customDataTags.forEach((key, tag) -> tags.put(key, tag.copy()));
|
||||
+ return tags;
|
||||
+ }
|
||||
+ // Paper end - deep clone tags
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: chickeneer <emcchickeneer@gmail.com>
|
||||
Date: Tue, 16 Feb 2021 21:37:51 -0600
|
||||
Subject: [PATCH] Prevent grindstones from overstacking items
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
index 1783661f38a6f5fb655ea83953b9467bd91a1302..95ac3446fba1f37637c9700080de2e1ce7a3550a 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
@@ -198,13 +198,13 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
||||
i = Math.max(item.getMaxDamage() - l, 0);
|
||||
itemstack2 = this.mergeEnchants(itemstack, itemstack1);
|
||||
if (!itemstack2.isDamageableItem()) {
|
||||
- if (!ItemStack.matches(itemstack, itemstack1)) {
|
||||
+ if (!ItemStack.matches(itemstack, itemstack1) || (itemstack2.getMaxStackSize() == 1 && !io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowGrindstoneOverstacking)) { // Paper - add max stack size check & config value
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareGrindstoneEvent(this.getBukkitView(), ItemStack.EMPTY); // CraftBukkit
|
||||
this.broadcastChanges();
|
||||
return;
|
||||
}
|
||||
|
||||
- b0 = 2;
|
||||
+ b0 = 2; // Paper - add max stack size check & config value; the problem line for above change, causing over-stacking
|
||||
}
|
||||
} else {
|
||||
boolean flag3 = !itemstack.isEmpty();
|
@ -1,57 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Wed, 2 Dec 2020 21:03:02 -0800
|
||||
Subject: [PATCH] Add config for mobs immune to default effects
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 60c9bae18f277a90b464a6f1f55d074ed9046aff..f01ace6a6e517ff3d3cd66e69e2594ae3d702072 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1172,7 +1172,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (this.getMobType() == MobType.UNDEAD) {
|
||||
MobEffect mobeffectlist = effect.getEffect();
|
||||
|
||||
- if (mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) {
|
||||
+ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level().paperConfig().entities.mobEffects.undeadImmuneToCertainEffects) { // Paper - Add config for mobs immune to default effects
|
||||
return false;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
index bd9453a92e1b2eca0a6dc56aef921e31a18a20c3..25f611b35a5710c595574d2d6ed50c442ca55721 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||||
@@ -607,7 +607,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
||||
|
||||
@Override
|
||||
public boolean canBeAffected(MobEffectInstance effect) {
|
||||
- return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect);
|
||||
+ return effect.getEffect() == MobEffects.WITHER && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.wither ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
|
||||
}
|
||||
|
||||
private class WitherDoNothingGoal extends Goal {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
index 6241baccd3fdee59175f616cdf69d3873074f855..4d5cfaa58bdf4e6cb975134004d14c591f6e85fa 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java
|
||||
@@ -135,7 +135,7 @@ public class Spider extends Monster {
|
||||
|
||||
@Override
|
||||
public boolean canBeAffected(MobEffectInstance effect) {
|
||||
- return effect.getEffect() == MobEffects.POISON ? false : super.canBeAffected(effect);
|
||||
+ return effect.getEffect() == MobEffects.POISON && this.level().paperConfig().entities.mobEffects.spidersImmuneToPoisonEffect ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
|
||||
}
|
||||
|
||||
public boolean isClimbing() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
||||
index 62943d43b701d9ae6d955003f4e7658f76d5bdb3..20a65c11ededcd7170704b70118da6200151fbab 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java
|
||||
@@ -128,6 +128,6 @@ public class WitherSkeleton extends AbstractSkeleton {
|
||||
|
||||
@Override
|
||||
public boolean canBeAffected(MobEffectInstance effect) {
|
||||
- return effect.getEffect() == MobEffects.WITHER ? false : super.canBeAffected(effect);
|
||||
+ return effect.getEffect() == MobEffects.WITHER && this.level().paperConfig().entities.mobEffects.immuneToWitherEffect.witherSkeleton ? false : super.canBeAffected(effect); // Paper - Add config for mobs immune to default effects
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sun, 1 Aug 2021 09:49:06 +0100
|
||||
Subject: [PATCH] Fix incosistency issue with empty map items in CB
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||
index f643d3c06bd8fc37f6c571a19d5691694b0ce8d3..d8dd99ec8bf7444c5a3c426db3a9c13e334dc0ff 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/MapItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||
@@ -69,7 +69,7 @@ public class MapItem extends ComplexItem {
|
||||
public static Integer getMapId(ItemStack stack) {
|
||||
CompoundTag nbttagcompound = stack.getTag();
|
||||
|
||||
- return nbttagcompound != null && nbttagcompound.contains("map", 99) ? nbttagcompound.getInt("map") : -1; // CraftBukkit - make new maps for no tag
|
||||
+ return nbttagcompound != null && nbttagcompound.contains("map", 99) ? nbttagcompound.getInt("map") : null; // CraftBukkit - make new maps for no tag // Paper - don't return invalid ID
|
||||
}
|
||||
|
||||
public static int createNewSavedData(Level world, int x, int z, int scale, boolean showIcons, boolean unlimitedTracking, ResourceKey<Level> dimension) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
|
||||
index 0c7280621cce9855dcc9569e0aefba77bfd555cb..0c7c67e1eea44487c52ebf650d35b3b43cd00c3a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMap.java
|
||||
@@ -133,6 +133,7 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
|
||||
|
||||
@Override
|
||||
public int getMapId() {
|
||||
+ Preconditions.checkState(this.hasMapView(), "Item does not have map associated - check hasMapView() first!"); // Paper - more friendly message
|
||||
return this.mapId;
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Mon, 18 Dec 2023 20:05:50 -0800
|
||||
Subject: [PATCH] properly read and store sus effect duration
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
index e13146b71552ab3f9ae867110650fe3977563dfb..2c3b9f76067088efdc2250cdb5070df86e2dc0f5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java
|
||||
@@ -49,7 +49,14 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
if (type == null) {
|
||||
continue;
|
||||
}
|
||||
- int duration = effect.getInt(CraftMetaSuspiciousStew.DURATION.NBT);
|
||||
+ // Paper start - default duration is 160
|
||||
+ final int duration;
|
||||
+ if (effect.contains(CraftMetaSuspiciousStew.DURATION.NBT)) {
|
||||
+ duration = effect.getInt(CraftMetaSuspiciousStew.DURATION.NBT);
|
||||
+ } else {
|
||||
+ duration = net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION;
|
||||
+ }
|
||||
+ // Paper end start - default duration is 160
|
||||
this.customEffects.add(new PotionEffect(type, duration, 0));
|
||||
}
|
||||
}
|
||||
@@ -80,7 +87,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious
|
||||
for (PotionEffect effect : this.customEffects) {
|
||||
CompoundTag effectData = new CompoundTag();
|
||||
effectData.putString(CraftMetaSuspiciousStew.ID.NBT, effect.getType().getKey().toString());
|
||||
- effectData.putInt(CraftMetaSuspiciousStew.DURATION.NBT, effect.getDuration());
|
||||
+ if (effect.getDuration() != net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION) effectData.putInt(CraftMetaSuspiciousStew.DURATION.NBT, effect.getDuration()); // Paper - don't save duration if it's the default value
|
||||
effectList.add(effectData);
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 23 Jun 2022 19:25:51 -0700
|
||||
Subject: [PATCH] Track projectile source for fireworks from dispensers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
index b4f7e3ae855cbf48925f0db916501adf513ae08c..24b2d57ebe76ce825686a53c94ae994b418a1272 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||
@@ -517,6 +517,7 @@ public interface DispenseItemBehavior {
|
||||
itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
||||
Vec3 vec3d = DispenseItemBehavior.getEntityPokingOutOfBlockPos(pointer, EntityType.FIREWORK_ROCKET, enumdirection);
|
||||
FireworkRocketEntity entityfireworks = new FireworkRocketEntity(pointer.level(), itemstack1, vec3d.x(), vec3d.y(), vec3d.z(), true); // Paper - GH-2871 - fix last firework in stack having no effects when dispensed
|
||||
+ entityfireworks.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); // Paper - Track projectile source for fireworks from dispensers
|
||||
|
||||
entityfireworks.shoot((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), 0.5F, 1.0F);
|
||||
pointer.level().addFreshEntity(entityfireworks);
|
@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Mon, 15 May 2023 00:20:59 -0700
|
||||
Subject: [PATCH] Fix concurrenct access to lookups field in RegistryOps
|
||||
|
||||
The concurrent access occurs on the Netty IO threads when
|
||||
serializing packets. Thus, it seems it was an oversight of
|
||||
the implementator of this function as there are typically
|
||||
more than one Netty IO thread.
|
||||
|
||||
Fixes https://github.com/PaperMC/Folia/issues/11
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/resources/RegistryOps.java b/src/main/java/net/minecraft/resources/RegistryOps.java
|
||||
index 0272fe45449785e8589b6e42fa454f2abfcc0476..dd8a6bd463e5c8fe69271663cb46b45b201ba59c 100644
|
||||
--- a/src/main/java/net/minecraft/resources/RegistryOps.java
|
||||
+++ b/src/main/java/net/minecraft/resources/RegistryOps.java
|
||||
@@ -19,7 +19,10 @@ public class RegistryOps<T> extends DelegatingOps<T> {
|
||||
|
||||
private static RegistryOps.RegistryInfoLookup memoizeLookup(RegistryOps.RegistryInfoLookup registryInfoGetter) {
|
||||
return new RegistryOps.RegistryInfoLookup() {
|
||||
- private final Map<ResourceKey<? extends Registry<?>>, Optional<? extends RegistryOps.RegistryInfo<?>>> lookups = new HashMap<>();
|
||||
+ // The concurrent access occurs on the Netty IO threads when serializing packets.
|
||||
+ // Thus, it seems it was an oversight of the implementator of this function as there
|
||||
+ // are typically more than one Netty IO thread.
|
||||
+ private final Map<ResourceKey<? extends Registry<?>>, Optional<? extends RegistryOps.RegistryInfo<?>>> lookups = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - fix concurrent access to lookups field
|
||||
|
||||
@Override
|
||||
public <T> Optional<RegistryOps.RegistryInfo<T>> lookup(ResourceKey<? extends Registry<? extends T>> registryRef) {
|
@ -1,56 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: jellysquid3 <jellysquid3@users.noreply.github.com>
|
||||
Date: Sat, 8 Jul 2023 21:38:05 +0200
|
||||
Subject: [PATCH] Array backed synched entity data
|
||||
|
||||
Original code by jellysquid3 in Lithium, licensed under the GNU Lesser General Public License v3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
index d088479d160dbd2fc90b48a30553be141db8eef2..07a362f9e485d0d507f16f1dda1ac84ade07ab27 100644
|
||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
@@ -34,6 +34,11 @@ public class SynchedEntityData {
|
||||
private final Int2ObjectMap<SynchedEntityData.DataItem<?>> itemsById = new Int2ObjectOpenHashMap();
|
||||
// private final ReadWriteLock lock = new ReentrantReadWriteLock(); // Spigot - not required
|
||||
private boolean isDirty;
|
||||
+ // Paper start - Perf: array backed synched entity data
|
||||
+ private static final int DEFAULT_ENTRY_COUNT = 10;
|
||||
+ private static final int GROW_FACTOR = 8;
|
||||
+ private SynchedEntityData.DataItem<?>[] itemsArray = new SynchedEntityData.DataItem<?>[DEFAULT_ENTRY_COUNT];
|
||||
+ // Paper end - Perf: array backed synched entity data
|
||||
|
||||
public SynchedEntityData(Entity trackedEntity) {
|
||||
this.entity = trackedEntity;
|
||||
@@ -103,6 +108,15 @@ public class SynchedEntityData {
|
||||
// this.lock.writeLock().lock(); // Spigot - not required
|
||||
this.itemsById.put(key.getId(), datawatcher_item);
|
||||
// this.lock.writeLock().unlock(); // Spigot - not required
|
||||
+ // Paper start - Perf: array backed synched entity data
|
||||
+ if (this.itemsArray.length <= key.getId()) {
|
||||
+ final int newSize = Math.min(key.getId() + GROW_FACTOR, MAX_ID_VALUE);
|
||||
+
|
||||
+ this.itemsArray = java.util.Arrays.copyOf(this.itemsArray, newSize);
|
||||
+ }
|
||||
+
|
||||
+ this.itemsArray[key.getId()] = datawatcher_item;
|
||||
+ // Paper end - Perf: array backed synched entity data
|
||||
}
|
||||
|
||||
public <T> boolean hasItem(EntityDataAccessor<T> key) {
|
||||
@@ -130,7 +144,15 @@ public class SynchedEntityData {
|
||||
|
||||
return datawatcher_item;
|
||||
*/
|
||||
- return (SynchedEntityData.DataItem) this.itemsById.get(key.getId());
|
||||
+ // Paper start - Perf: array backed synched entity data
|
||||
+ final int id = key.getId();
|
||||
+
|
||||
+ if (id < 0 || id >= this.itemsArray.length) {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ return (DataItem<T>) this.itemsArray[id];
|
||||
+ // Paper end - Perf: array backed synched entity data
|
||||
// Spigot end
|
||||
}
|
||||
|
@ -1,62 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SoSeDiK <mrsosedik@gmail.com>
|
||||
Date: Thu, 26 May 2022 03:30:05 +0300
|
||||
Subject: [PATCH] Deep clone unhandled nbt tags
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 7d3d32679bdfe373d89a28c3616da5069640d1bb..9137d6d56386111dfd072859df84e533580ee294 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -305,7 +305,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
|
||||
|
||||
private CompoundTag internalTag;
|
||||
- final Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper
|
||||
+ Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper - Deep clone unhandled nbt tags; remove final
|
||||
private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY);
|
||||
|
||||
private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only
|
||||
@@ -346,8 +346,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys);
|
||||
}
|
||||
// Paper end - Add API for CanPlaceOn and CanDestroy NBT values
|
||||
- this.unhandledTags.putAll(meta.unhandledTags);
|
||||
- this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
|
||||
+ // Paper start - Deep clone unhandled nbt tags
|
||||
+ meta.unhandledTags.forEach((key, tag) -> this.unhandledTags.put(key, tag.copy()));
|
||||
+ this.persistentDataContainer.putAll(meta.persistentDataContainer.getTagsCloned());
|
||||
+ // Paper end - Deep clone unhandled nbt tags
|
||||
|
||||
this.internalTag = meta.internalTag;
|
||||
if (this.internalTag != null) {
|
||||
@@ -1393,7 +1395,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
if (this.hasAttributeModifiers()) {
|
||||
clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers);
|
||||
}
|
||||
- clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getRaw(), CraftMetaItem.DATA_TYPE_REGISTRY);
|
||||
+ // Paper start - Deep clone unhandled nbt tags
|
||||
+ clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getTagsCloned(), CraftMetaItem.DATA_TYPE_REGISTRY);
|
||||
+ clone.unhandledTags = new TreeMap<>(this.unhandledTags);
|
||||
+ clone.unhandledTags.replaceAll((key, tag) -> tag.copy());
|
||||
+ // Paper end - Deep clone unhandled nbt tags
|
||||
clone.hideFlag = this.hideFlag;
|
||||
clone.unbreakable = this.unbreakable;
|
||||
clone.damage = this.damage;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
index 5a4e7e7150b7c137b077e0b393f17ed35b5aec34..f55fdd57ced259ad5a95878840e98ffaa3db2e05 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
||||
@@ -207,4 +207,12 @@ public class CraftPersistentDataContainer implements PersistentDataContainer {
|
||||
}
|
||||
}
|
||||
// Paper end - byte array serialization
|
||||
+
|
||||
+ // Paper start - deep clone tags
|
||||
+ public Map<String, Tag> getTagsCloned() {
|
||||
+ final Map<String, Tag> tags = new HashMap<>();
|
||||
+ this.customDataTags.forEach((key, tag) -> tags.put(key, tag.copy()));
|
||||
+ return tags;
|
||||
+ }
|
||||
+ // Paper end - deep clone tags
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 10 Oct 2023 10:17:43 -0700
|
||||
Subject: [PATCH] Use correct variable for initializing CraftLootTable
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
|
||||
index 973b786368cf628815f099eefe968338c97c52ed..3ddf6ab00de2456ebf504985b88994f970e3b5c4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootDataManager.java
|
||||
@@ -103,7 +103,7 @@ public class LootDataManager implements PreparableReloadListener, LootDataResolv
|
||||
});
|
||||
// CraftBukkit start
|
||||
map1.forEach((key, lootTable) -> {
|
||||
- if (object instanceof LootTable table) {
|
||||
+ if (lootTable instanceof LootTable table) { // Paper - Use correct variable for initializing CraftLootTable
|
||||
table.craftLootTable = new CraftLootTable(CraftNamespacedKey.fromMinecraft(key.location()), table);
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user