#1209: Clean up various patches

By: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
This commit is contained in:
CraftBukkit/Spigot
2023-06-24 17:15:05 +10:00
parent 0f9e7a497e
commit b97cc9b99f
71 changed files with 662 additions and 719 deletions

View File

@@ -1,32 +1,24 @@
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
@@ -142,6 +142,25 @@
}
@@ -28,7 +28,7 @@
private static final int NO_EFFECT_COLOR = -1;
private static final DataWatcherObject<Integer> ID_EFFECT_COLOR = DataWatcher.defineId(EntityTippedArrow.class, DataWatcherRegistry.INT);
private static final byte EVENT_POTION_PUFF = 0;
- private PotionRegistry potion;
+ public PotionRegistry potion; // CraftBukkit private -> public
public final Set<MobEffect> effects;
private boolean fixedColor;
@@ -86,7 +86,7 @@
return nbttagcompound != null && nbttagcompound.contains("CustomPotionColor", 99) ? nbttagcompound.getInt("CustomPotionColor") : -1;
}
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
+ this.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, (Collection) this.effects)));
+ }
+
+ public String getPotionType() {
+ return BuiltInRegistries.POTION.getKey(this.potion).toString();
+ }
+
+ public void setPotionType(String string) {
+ this.potion = BuiltInRegistries.POTION.get(new net.minecraft.resources.MinecraftKey(string));
+ this.getEntityData().set(EntityTippedArrow.ID_EFFECT_COLOR, PotionUtil.getColor((Collection) PotionUtil.getAllEffects(this.potion, (Collection) this.effects)));
+ }
+
+ public boolean isTipped() {
+ return !(this.effects.isEmpty() && this.potion == Potions.EMPTY);
+ }
+ // CraftBukkit end
+
public int getColor() {
return (Integer) this.entityData.get(EntityTippedArrow.ID_EFFECT_COLOR);
}
@@ -212,7 +231,7 @@
- private void updateColor() {
+ public void updateColor() { // CraftBukkit private -> public
this.fixedColor = false;
if (this.potion == Potions.EMPTY && this.effects.isEmpty()) {
this.entityData.set(EntityTippedArrow.ID_EFFECT_COLOR, -1);
@@ -212,7 +212,7 @@
mobeffect = (MobEffect) iterator.next();
entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {
return i / 8;
@@ -35,7 +27,7 @@
}
if (!this.effects.isEmpty()) {
@@ -220,7 +239,7 @@
@@ -220,7 +220,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next();