Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Check if spawner contains entity type (#3450)
Dieser Commit ist enthalten in:
Ursprung
6876a90c3b
Commit
2d63f09e16
@ -27,6 +27,7 @@ package org.geysermc.geyser.translator.level.block.entity;
|
|||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
import com.github.steveice10.mc.protocol.data.game.level.block.BlockEntityType;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
import com.github.steveice10.opennbt.tag.builtin.Tag;
|
||||||
import com.nukkitx.nbt.NbtMapBuilder;
|
import com.nukkitx.nbt.NbtMapBuilder;
|
||||||
import org.geysermc.geyser.entity.EntityDefinition;
|
import org.geysermc.geyser.entity.EntityDefinition;
|
||||||
@ -68,16 +69,18 @@ public class SpawnerBlockEntityTranslator extends BlockEntityTranslator {
|
|||||||
|
|
||||||
CompoundTag spawnData = tag.get("SpawnData");
|
CompoundTag spawnData = tag.get("SpawnData");
|
||||||
if (spawnData != null) {
|
if (spawnData != null) {
|
||||||
String entityID = (String) ((CompoundTag) spawnData.get("entity"))
|
StringTag idTag = ((CompoundTag) spawnData.get("entity")).get("id");
|
||||||
.get("id")
|
if (idTag != null) {
|
||||||
.getValue();
|
// As of 1.19.3, spawners can be empty
|
||||||
builder.put("EntityIdentifier", entityID);
|
String entityId = idTag.getValue();
|
||||||
|
builder.put("EntityIdentifier", entityId);
|
||||||
|
|
||||||
EntityDefinition<?> definition = Registries.JAVA_ENTITY_IDENTIFIERS.get(entityID);
|
EntityDefinition<?> definition = Registries.JAVA_ENTITY_IDENTIFIERS.get(entityId);
|
||||||
if (definition != null) {
|
if (definition != null) {
|
||||||
builder.put("DisplayEntityWidth", definition.width());
|
builder.put("DisplayEntityWidth", definition.width());
|
||||||
builder.put("DisplayEntityHeight", definition.height());
|
builder.put("DisplayEntityHeight", definition.height());
|
||||||
builder.put("DisplayEntityScale", 1.0f);
|
builder.put("DisplayEntityScale", 1.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren