mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@4fdda9e Keep newlines in outdated client/server message (#10042) PaperMC/Paper@f483b38 fix NPE on EntityTeleportEvent getTo (#10016) PaperMC/Paper@dc62150 Catch async usage of playsound (#10021) PaperMC/Paper@0d6a0c3 Fix command block async message (again) (#10082) PaperMC/Paper@d1f507f Don't fire 2 game events for certain cauldron interactions (#8904) PaperMC/Paper@a401585 Fix campfire recipes not always outputting full result (#8754) PaperMC/Paper@88d28d6 Fix long loading screen when refreshing skins (#10026) PaperMC/Paper@c081104 Add experience points api (#9688) PaperMC/Paper@8221b08 Fix global sound event gamerule not being respected (#8727) PaperMC/Paper@3c0d6aa Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10085) PaperMC/Paper@2c3ccb8 Add drops to shear events (#5678) PaperMC/Paper@b2ffb1b Add PlayerShieldDisableEvent (#9177) PaperMC/Paper@2951732 Add HiddenPotionEffect API (#9910) PaperMC/Paper@e4ab50d Properly disallow async Player#chat (#8123) PaperMC/Paper@5e978d3 Fix Folia scheduler tasks not canceling when plugin disable (#10091)
This commit is contained in:
@@ -5,31 +5,23 @@ Subject: [PATCH] Potion NamespacedKey
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
|
||||
index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6c5b7ed91 100644
|
||||
index bf304db1f9506d3e83d16cd632b9155c39346634..d94497083f3da89dbef6479ef8f70591e630e3e7 100644
|
||||
--- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
|
||||
+++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.util.ExtraCodecs;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import org.slf4j.Logger;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
|
||||
public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -35,6 +36,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
private boolean visible;
|
||||
@@ -36,6 +36,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
private boolean showIcon;
|
||||
@Nullable
|
||||
+ private NamespacedKey key; // Purpur - add key
|
||||
private MobEffectInstance hiddenEffect;
|
||||
public MobEffectInstance hiddenEffect;
|
||||
+ private org.bukkit.NamespacedKey key; // Purpur - add key
|
||||
private final Optional<MobEffectInstance.FactorData> factorData;
|
||||
|
||||
@@ -54,17 +56,36 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
public MobEffectInstance(MobEffect type) {
|
||||
@@ -54,17 +55,36 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
this(type, duration, amplifier, ambient, visible, visible);
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean visible, @Nullable NamespacedKey key) {
|
||||
+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean visible, @Nullable org.bukkit.NamespacedKey key) {
|
||||
+ this(type, duration, amplifier, ambient, visible, visible, key);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
@@ -37,20 +29,20 @@ index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6
|
||||
public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon) {
|
||||
- this(type, duration, amplifier, ambient, showParticles, showIcon, (MobEffectInstance)null, type.createFactorData());
|
||||
+ // Purpur start
|
||||
+ this(type, duration, amplifier, ambient, showParticles, showIcon, (MobEffectInstance)null, type.createFactorData(), (NamespacedKey)null);
|
||||
+ this(type, duration, amplifier, ambient, showParticles, showIcon, (MobEffectInstance)null, type.createFactorData(), (org.bukkit.NamespacedKey)null);
|
||||
+ }
|
||||
+
|
||||
+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable NamespacedKey key) {
|
||||
+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable org.bukkit.NamespacedKey key) {
|
||||
+ this(type, duration, amplifier, ambient, showParticles, showIcon, (MobEffectInstance)null, type.createFactorData(), key);
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable MobEffectInstance hiddenEffect, Optional<MobEffectInstance.FactorData> factorCalculationData) {
|
||||
+ // Purpur start
|
||||
+ this(type, duration, amplifier, ambient, showParticles, showIcon, hiddenEffect, factorCalculationData, (NamespacedKey) null);
|
||||
+ this(type, duration, amplifier, ambient, showParticles, showIcon, hiddenEffect, factorCalculationData, (org.bukkit.NamespacedKey) null);
|
||||
+ }
|
||||
+
|
||||
+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable MobEffectInstance hiddenEffect, Optional<MobEffectInstance.FactorData> factorCalculationData, @Nullable NamespacedKey key) {
|
||||
+ public MobEffectInstance(MobEffect type, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable MobEffectInstance hiddenEffect, Optional<MobEffectInstance.FactorData> factorCalculationData, @Nullable org.bukkit.NamespacedKey key) {
|
||||
+ // Purpur end
|
||||
this.effect = type;
|
||||
this.duration = duration;
|
||||
@@ -62,7 +54,7 @@ index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6
|
||||
this.hiddenEffect = hiddenEffect;
|
||||
this.factorData = factorCalculationData;
|
||||
}
|
||||
@@ -85,6 +106,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
@@ -85,6 +105,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
this.ambient = that.ambient;
|
||||
this.visible = that.visible;
|
||||
this.showIcon = that.showIcon;
|
||||
@@ -70,7 +62,7 @@ index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6
|
||||
}
|
||||
|
||||
public boolean update(MobEffectInstance that) {
|
||||
@@ -129,6 +151,13 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
@@ -129,6 +150,13 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
bl = true;
|
||||
}
|
||||
|
||||
@@ -84,7 +76,7 @@ index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6
|
||||
return bl;
|
||||
}
|
||||
|
||||
@@ -172,6 +201,17 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
@@ -172,6 +200,17 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
return this.showIcon;
|
||||
}
|
||||
|
||||
@@ -94,7 +86,7 @@ index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public NamespacedKey getKey() {
|
||||
+ public org.bukkit.NamespacedKey getKey() {
|
||||
+ return this.key;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
@@ -102,7 +94,7 @@ index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6
|
||||
public boolean tick(LivingEntity entity, Runnable overwriteCallback) {
|
||||
if (this.hasRemainingDuration()) {
|
||||
int i = this.isInfiniteDuration() ? entity.tickCount : this.duration;
|
||||
@@ -232,6 +272,12 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
@@ -232,6 +271,12 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
string = string + ", Show Icon: false";
|
||||
}
|
||||
|
||||
@@ -115,7 +107,7 @@ index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -247,7 +293,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
@@ -247,7 +292,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
return false;
|
||||
} else {
|
||||
MobEffectInstance mobEffectInstance = (MobEffectInstance)object;
|
||||
@@ -124,7 +116,7 @@ index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,6 +318,11 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
@@ -272,6 +317,11 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
nbt.putBoolean("ambient", this.isAmbient());
|
||||
nbt.putBoolean("show_particles", this.isVisible());
|
||||
nbt.putBoolean("show_icon", this.showIcon());
|
||||
@@ -136,21 +128,21 @@ index 68e1b8271475996020af50b3b2cf04cd25aa6c85..4f2fcbcf90d6f5ee89e35c993a65cae6
|
||||
if (this.hiddenEffect != null) {
|
||||
CompoundTag compoundTag = new CompoundTag();
|
||||
this.hiddenEffect.save(compoundTag);
|
||||
@@ -306,6 +357,13 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
@@ -306,6 +356,13 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
bl3 = nbt.getBoolean("show_icon");
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ NamespacedKey key = null;
|
||||
+ org.bukkit.NamespacedKey key = null;
|
||||
+ if (nbt.contains("key")) {
|
||||
+ key = NamespacedKey.fromString(nbt.getString("key"));
|
||||
+ key = org.bukkit.NamespacedKey.fromString(nbt.getString("key"));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
MobEffectInstance mobEffectInstance = null;
|
||||
if (nbt.contains("hidden_effect", 10)) {
|
||||
mobEffectInstance = loadSpecifiedEffect(type, nbt.getCompound("hidden_effect"));
|
||||
@@ -318,7 +376,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
@@ -318,7 +375,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
optional = Optional.empty();
|
||||
}
|
||||
|
||||
@@ -208,24 +200,24 @@ index bac3a5c378054481e1a5abaec1f83afde5d64ac1..f1050bf2b9efc54a894426b08989d445
|
||||
}
|
||||
this.customEffects.set(index, effect);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
||||
index 844fb8c662a409670f631228f687d85c5436d3dd..2bfa5908f1848702ceb42da7576a609d0928eddd 100644
|
||||
index e938255fcc5db0c289d3e132175a541187e4a748..f7a747ea73a80c97d863e0fd3772a0c333aef3c8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
||||
@@ -73,7 +73,7 @@ public class CraftPotionUtil {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class CraftPotionUtil {
|
||||
public static MobEffectInstance fromBukkit(PotionEffect effect) {
|
||||
MobEffect type = CraftPotionEffectType.bukkitToMinecraft(effect.getType());
|
||||
// Paper - Note: do not copy over the hidden effect, as this method is only used for applying to entities which we do not want to convert over.
|
||||
- return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper
|
||||
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon(), effect.getKey()); // Paper // Purpur - add key
|
||||
}
|
||||
|
||||
public static PotionEffect toBukkit(MobEffectInstance effect) {
|
||||
@@ -82,7 +82,7 @@ public class CraftPotionUtil {
|
||||
@@ -83,7 +83,7 @@ public class CraftPotionUtil {
|
||||
int duration = effect.getDuration();
|
||||
boolean ambient = effect.isAmbient();
|
||||
boolean particles = effect.isVisible();
|
||||
- return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon()); // Paper
|
||||
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.getKey()); // Paper // Purpur - add key
|
||||
- return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.hiddenEffect == null ? null : toBukkit(effect.hiddenEffect)); // Paper
|
||||
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.hiddenEffect == null ? null : toBukkit(effect.hiddenEffect), effect.getKey()); // Paper // Purpur - add key
|
||||
}
|
||||
|
||||
public static boolean equals(MobEffect mobEffect, PotionEffectType type) {
|
||||
|
||||
Reference in New Issue
Block a user