Fix TagsPacket

This commit is contained in:
Articdive 2021-06-11 21:55:30 +02:00
parent 9dffc7658c
commit f3f854feaa
No known key found for this signature in database
GPG Key ID: B069585F0F7D90DE
2 changed files with 4 additions and 5 deletions

View File

@ -37,8 +37,6 @@ import net.minestom.server.event.item.PickupExperienceEvent;
import net.minestom.server.event.player.*; import net.minestom.server.event.player.*;
import net.minestom.server.instance.Chunk; import net.minestom.server.instance.Chunk;
import net.minestom.server.instance.Instance; import net.minestom.server.instance.Instance;
import net.minestom.server.message.ChatMessageType;
import net.minestom.server.message.ChatPosition;
import net.minestom.server.inventory.Inventory; import net.minestom.server.inventory.Inventory;
import net.minestom.server.inventory.PlayerInventory; import net.minestom.server.inventory.PlayerInventory;
import net.minestom.server.item.ItemStack; import net.minestom.server.item.ItemStack;
@ -293,7 +291,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
// Tags // Tags
// FIXME // FIXME
//this.playerConnection.sendPacket(TagsPacket.getRequiredTagsPacket()); this.playerConnection.sendPacket(TagsPacket.getRequiredTagsPacket());
// Some client update // Some client update
this.playerConnection.sendPacket(getPropertiesPacket()); // Send default properties this.playerConnection.sendPacket(getPropertiesPacket()); // Send default properties

View File

@ -53,9 +53,10 @@ public class TagsPacket implements ServerPacket {
writer.writeVarInt(values.size()); writer.writeVarInt(values.size());
// entries // entries
for (NamespaceID name : values) { for (NamespaceID name : values) {
Block b = Registries.getBlock(name); Block b = Block.fromNamespaceId(name);
if (b == Block.AIR && !name.toString().equals("minecraft:air")) { if (b == null) {
writer.writeVarInt(-1); writer.writeVarInt(-1);
continue;
} }
writer.writeVarInt(b.getId()); writer.writeVarInt(b.getId());
} }