Merge pull request #169 from finalchild/master

Fix #163 (ServerBlockValuePacket) and #159 (Effect)
This commit is contained in:
Steven Smith 2016-05-25 07:27:10 -07:00
commit 242743539a
3 changed files with 16 additions and 15 deletions

View file

@ -265,6 +265,10 @@ public class MagicValues {
register(Effect.HEALTH_BOOST, 21); register(Effect.HEALTH_BOOST, 21);
register(Effect.ABSORPTION, 22); register(Effect.ABSORPTION, 22);
register(Effect.SATURATION, 23); register(Effect.SATURATION, 23);
register(Effect.GLOWING, 24);
register(Effect.LEVITATION, 25);
register(Effect.LUCK, 26);
register(Effect.BAD_LUCK, 27);
register(EntityStatus.HURT_OR_MINECART_SPAWNER_DELAY_RESET, 1); register(EntityStatus.HURT_OR_MINECART_SPAWNER_DELAY_RESET, 1);
register(EntityStatus.LIVING_HURT, 2); register(EntityStatus.LIVING_HURT, 2);

View file

@ -24,6 +24,10 @@ public enum Effect {
WITHER_EFFECT, WITHER_EFFECT,
HEALTH_BOOST, HEALTH_BOOST,
ABSORPTION, ABSORPTION,
SATURATION; SATURATION,
GLOWING,
LEVITATION,
LUCK,
BAD_LUCK;
} }

View file

@ -68,32 +68,25 @@ public class ServerBlockValuePacket implements Packet {
public void read(NetInput in) throws IOException { public void read(NetInput in) throws IOException {
this.position = NetUtil.readPosition(in); this.position = NetUtil.readPosition(in);
int type = in.readUnsignedByte(); int type = in.readUnsignedByte();
int value = in.readUnsignedByte();
this.blockId = in.readVarInt() & 0xFFF;
if(this.blockId == NOTE_BLOCK) { if(this.blockId == NOTE_BLOCK) {
this.type = MagicValues.key(NoteBlockValueType.class, type); this.type = MagicValues.key(NoteBlockValueType.class, type);
} else if(this.blockId == STICKY_PISTON || this.blockId == PISTON) {
this.type = MagicValues.key(PistonValueType.class, type);
} else if(this.blockId == MOB_SPAWNER) {
this.type = MagicValues.key(MobSpawnerValueType.class, type);
} else if(this.blockId == CHEST || this.blockId == ENDER_CHEST || this.blockId == TRAPPED_CHEST) {
this.type = MagicValues.key(ChestValueType.class, type);
} else {
this.type = MagicValues.key(GenericBlockValueType.class, type);
}
int value = in.readUnsignedByte();
if(this.blockId == NOTE_BLOCK) {
this.value = new NoteBlockValue(value); this.value = new NoteBlockValue(value);
} else if(this.blockId == STICKY_PISTON || this.blockId == PISTON) { } else if(this.blockId == STICKY_PISTON || this.blockId == PISTON) {
this.type = MagicValues.key(PistonValueType.class, type);
this.value = MagicValues.key(PistonValue.class, value); this.value = MagicValues.key(PistonValue.class, value);
} else if(this.blockId == MOB_SPAWNER) { } else if(this.blockId == MOB_SPAWNER) {
this.type = MagicValues.key(MobSpawnerValueType.class, type);
this.value = new MobSpawnerValue(); this.value = new MobSpawnerValue();
} else if(this.blockId == CHEST || this.blockId == ENDER_CHEST || this.blockId == TRAPPED_CHEST) { } else if(this.blockId == CHEST || this.blockId == ENDER_CHEST || this.blockId == TRAPPED_CHEST) {
this.type = MagicValues.key(ChestValueType.class, type);
this.value = new ChestValue(value); this.value = new ChestValue(value);
} else { } else {
this.type = MagicValues.key(GenericBlockValueType.class, type);
this.value = new GenericBlockValue(value); this.value = new GenericBlockValue(value);
} }
this.blockId = in.readVarInt() & 4095;
} }
@Override @Override