mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
entity meta data: fix exception with opt block id
This commit is contained in:
parent
7165a95e36
commit
be5d8ae06f
@ -17,6 +17,7 @@ import de.bixilon.minosoft.data.entities.Poses;
|
||||
import de.bixilon.minosoft.data.entities.VillagerData;
|
||||
import de.bixilon.minosoft.data.inventory.Slot;
|
||||
import de.bixilon.minosoft.data.mappings.blocks.Block;
|
||||
import de.bixilon.minosoft.data.mappings.blocks.Blocks;
|
||||
import de.bixilon.minosoft.data.mappings.particle.data.ParticleData;
|
||||
import de.bixilon.minosoft.data.text.ChatComponent;
|
||||
import de.bixilon.minosoft.data.world.BlockPosition;
|
||||
@ -89,7 +90,13 @@ public class EntityMetaData {
|
||||
case BLOCK_ID -> buffer.getConnection().getMapping().getBlockById(buffer.readVarInt());
|
||||
case OPT_VAR_INT -> buffer.readVarInt() - 1;
|
||||
case VILLAGER_DATA -> new VillagerData(VillagerData.VillagerTypes.byId(buffer.readVarInt()), VillagerData.VillagerProfessions.byId(buffer.readVarInt(), buffer.getVersionId()), VillagerData.VillagerLevels.byId(buffer.readVarInt()));
|
||||
default -> throw new IllegalStateException("Unexpected value: " + type);
|
||||
case OPT_BLOCK_ID -> {
|
||||
int blockId = buffer.readVarInt();
|
||||
if (blockId == 0) {
|
||||
yield Blocks.nullBlock;
|
||||
}
|
||||
yield buffer.getConnection().getMapping().getBlockById(blockId);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user