mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-13 09:11:03 -05:00
Fix #163 (ServerBlockValuePacket)
This commit is contained in:
parent
b460ac6534
commit
61dbf354ff
1 changed files with 9 additions and 16 deletions
|
@ -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();
|
||||||
if(this.blockId == NOTE_BLOCK) {
|
int value = in.readUnsignedByte();
|
||||||
|
this.blockId = in.readVarInt() & 0xFFF;
|
||||||
|
|
||||||
|
if(this.blockId == NOTE_BLOCK) {
|
||||||
this.type = MagicValues.key(NoteBlockValueType.class, type);
|
this.type = MagicValues.key(NoteBlockValueType.class, type);
|
||||||
|
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.type = MagicValues.key(PistonValueType.class, type);
|
||||||
|
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.type = MagicValues.key(MobSpawnerValueType.class, type);
|
||||||
|
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.type = MagicValues.key(ChestValueType.class, type);
|
||||||
|
this.value = new ChestValue(value);
|
||||||
} else {
|
} else {
|
||||||
this.type = MagicValues.key(GenericBlockValueType.class, type);
|
this.type = MagicValues.key(GenericBlockValueType.class, type);
|
||||||
|
this.value = new GenericBlockValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int value = in.readUnsignedByte();
|
|
||||||
if(this.blockId == NOTE_BLOCK) {
|
|
||||||
this.value = new NoteBlockValue(value);
|
|
||||||
} else if(this.blockId == STICKY_PISTON || this.blockId == PISTON) {
|
|
||||||
this.value = MagicValues.key(PistonValue.class, value);
|
|
||||||
} else if(this.blockId == MOB_SPAWNER) {
|
|
||||||
this.value = new MobSpawnerValue();
|
|
||||||
} else if(this.blockId == CHEST || this.blockId == ENDER_CHEST || this.blockId == TRAPPED_CHEST) {
|
|
||||||
this.value = new ChestValue(value);
|
|
||||||
} else {
|
|
||||||
this.value = new GenericBlockValue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.blockId = in.readVarInt() & 4095;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue