Remove more redundant actions

This commit is contained in:
riking 2014-06-04 09:17:47 -07:00
parent 23303952b4
commit bb0ac727bf
3 changed files with 5 additions and 5 deletions

View File

@ -55,7 +55,7 @@ public class FlagWatcher {
} }
private byte addEntityAnimations(byte originalValue, byte entityValue) { private byte addEntityAnimations(byte originalValue, byte entityValue) {
byte valueByte = (Byte) originalValue; byte valueByte = originalValue;
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
if ((entityValue & 1 << i) != 0 && !modifiedEntityAnimations.contains(i)) { if ((entityValue & 1 << i) != 0 && !modifiedEntityAnimations.contains(i)) {
valueByte = (byte) (valueByte | 1 << i); valueByte = (byte) (valueByte | 1 << i);
@ -66,7 +66,7 @@ public class FlagWatcher {
} }
public FlagWatcher clone(Disguise owningDisguise) { public FlagWatcher clone(Disguise owningDisguise) {
FlagWatcher cloned = null; FlagWatcher cloned;
try { try {
cloned = getClass().getConstructor(Disguise.class).newInstance(getDisguise()); cloned = getClass().getConstructor(Disguise.class).newInstance(getDisguise());
} catch (Exception e) { } catch (Exception e) {

View File

@ -12,7 +12,7 @@ public class MinecartWatcher extends FlagWatcher {
} }
public ItemStack getBlockInCart() { public ItemStack getBlockInCart() {
int id = (Integer) getValue(20, 0) & '\uffff'; int id = (Integer) getValue(20, 0) & 0xffff;
int data = (Integer) getValue(20, 0) >> 16; int data = (Integer) getValue(20, 0) >> 16;
return new ItemStack(id, 1, (short) data); return new ItemStack(id, 1, (short) data);
} }
@ -32,7 +32,7 @@ public class MinecartWatcher extends FlagWatcher {
public void setBlockInCart(ItemStack item) { public void setBlockInCart(ItemStack item) {
int id = item.getTypeId(); int id = item.getTypeId();
int data = item.getDurability(); int data = item.getDurability();
setValue(20, (int) (id & '\uffff' | data << 16)); setValue(20, (int) (id & 0xffff | data << 16));
sendData(20); sendData(20);
setViewBlockInCart(true); setViewBlockInCart(true);
} }

View File

@ -748,7 +748,7 @@ public class PacketsManager {
StructureModifier<Object> mods = packet.getModifier(); StructureModifier<Object> mods = packet.getModifier();
mods.write(0, observer.getEntityId()); mods.write(0, observer.getEntityId());
List<WrappedWatchableObject> watchableList = new ArrayList<WrappedWatchableObject>(); List<WrappedWatchableObject> watchableList = new ArrayList<WrappedWatchableObject>();
byte b = (byte) (0 | 1 << 5); byte b = (byte) 1 << 5;
if (observer.isSprinting()) if (observer.isSprinting())
b = (byte) (b | 1 << 3); b = (byte) (b | 1 << 3);
watchableList.add(new WrappedWatchableObject(0, b)); watchableList.add(new WrappedWatchableObject(0, b));