Get rid of the silly getData must return Integer

This commit is contained in:
libraryaddict 2014-06-19 10:01:08 +12:00
parent 410f71044f
commit dc6348cf38
2 changed files with 5 additions and 10 deletions

View File

@ -11,8 +11,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class MiscDisguise extends TargetedDisguise { public class MiscDisguise extends TargetedDisguise {
private Integer data; private int id = -1, data = 0;
private int id = -1;
public MiscDisguise(DisguiseType disguiseType) { public MiscDisguise(DisguiseType disguiseType) {
this(disguiseType, -1, -1); this(disguiseType, -1, -1);
@ -120,7 +119,7 @@ public class MiscDisguise extends TargetedDisguise {
/** /**
* This is the getId of everything but falling block. * This is the getId of everything but falling block.
*/ */
public Integer getData() { public int getData() {
switch (getType()) { switch (getType()) {
case FALLING_BLOCK: case FALLING_BLOCK:
return (int) ((FallingBlockWatcher) getWatcher()).getBlock().getDurability(); return (int) ((FallingBlockWatcher) getWatcher()).getBlock().getDurability();

View File

@ -294,17 +294,13 @@ public class PacketsManager {
} else if (disguise.getType().isMisc()) { } else if (disguise.getType().isMisc()) {
int id = disguise.getType().getEntityId(); int id = disguise.getType().getEntityId();
Integer data = ((MiscDisguise) disguise).getData(); int data = ((MiscDisguise) disguise).getData();
if (disguise.getType() == DisguiseType.FALLING_BLOCK) { if (disguise.getType() == DisguiseType.FALLING_BLOCK) {
data = (((MiscDisguise) disguise).getId() | data << 16); data = (((MiscDisguise) disguise).getId() | data << 16);
} else if (disguise.getType() == DisguiseType.FISHING_HOOK) { } else if (disguise.getType() == DisguiseType.FISHING_HOOK && data == 0) {
// If the MiscDisguise data isn't set. Then no entity id was provided, so default to the owners entity id // If the MiscDisguise data isn't set. Then no entity id was provided, so default to the owners entity id
if (data == null) {
data = disguisedEntity.getEntityId(); data = disguisedEntity.getEntityId();
} }
} else if (data == null) {
data = 0;
}
/* else if (disguise.getType() == DisguiseType.ITEM_FRAME) { /* else if (disguise.getType() == DisguiseType.ITEM_FRAME) {
data = (int) loc.getYaw(); data = (int) loc.getYaw();
if (data < 0) if (data < 0)