Implement getColor / setColor for TippedArrow

This commit is contained in:
Matthew 2017-04-26 20:28:27 -04:00
parent 2453830549
commit 55a1f9ff12
2 changed files with 20 additions and 2 deletions

View File

@ -1,9 +1,10 @@
--- a/net/minecraft/server/EntityTippedArrow.java
+++ b/net/minecraft/server/EntityTippedArrow.java
@@ -116,6 +116,25 @@
@@ -116,11 +116,30 @@
}
}
- public int o() {
+ // CraftBukkit start accessor methods
+ public void refreshEffects() {
+ this.getDataWatcher().set(EntityTippedArrow.f, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))));
@ -23,6 +24,12 @@
+ }
+ // CraftBukkit end
+
public int o() {
+ public int o() { // PAIL: rename getColor
return ((Integer) this.datawatcher.get(EntityTippedArrow.f)).intValue();
}
- private void d(int i) {
+ public void d(int i) { // PAIL: private -> public, rename setColor
this.at = true;
this.datawatcher.set(EntityTippedArrow.f, Integer.valueOf(i));
}

View File

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.entity;
import java.util.List;
import org.apache.commons.lang.Validate;
import org.bukkit.Color;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.entity.EntityType;
@ -119,4 +120,14 @@ public class CraftTippedArrow extends CraftArrow implements TippedArrow {
public PotionData getBasePotionData() {
return CraftPotionUtil.toBukkit(getHandle().getType());
}
@Override
public void setColor(Color color) {
getHandle().d(color.asRGB());
}
@Override
public Color getColor() {
return Color.fromRGB(getHandle().o());
}
}