SPIGOT-1638 / SPIGOT-1673: Rework Potions API

By: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2016-03-02 20:43:58 -05:00
parent d490a6e384
commit 104519f08f
20 changed files with 622 additions and 121 deletions

View File

@@ -0,0 +1,37 @@
--- a/net/minecraft/server/EntityTippedArrow.java
+++ b/net/minecraft/server/EntityTippedArrow.java
@@ -10,7 +10,7 @@
private static final DataWatcherObject<Integer> f = DataWatcher.a(EntityTippedArrow.class, DataWatcherRegistry.b);
private PotionRegistry g;
- private final Set<MobEffect> h;
+ public final Set<MobEffect> h; // CraftBukkit private -> public
public EntityTippedArrow(World world) {
super(world);
@@ -98,6 +98,25 @@
}
}
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
+ this.getDataWatcher().set(EntityTippedArrow.f, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.g, (Collection) this.h)))); // PAIL: rename
+ }
+
+ public String getType() {
+ return ((MinecraftKey) PotionRegistry.a.b(this.g)).toString();
+ }
+
+ public void setType(String string) {
+ this.g = PotionRegistry.a.get(new MinecraftKey(string));
+ this.datawatcher.set(EntityTippedArrow.f, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.g, (Collection) this.h)))); // PAIL: rename
+ }
+
+ public boolean isTipped() {
+ return !(this.h.isEmpty() && this.g == Potions.a); // PAIL: rename
+ }
+ // CraftBukkit end
+
public int n() {
return ((Integer) this.datawatcher.get(EntityTippedArrow.f)).intValue();
}