Skip to content

Commit

Permalink
Use item identifiers in item frame nbt sent to client (#2144)
Browse files Browse the repository at this point in the history
  • Loading branch information
PetteriM1 authored Oct 24, 2023
1 parent 3328245 commit 50319c2
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import cn.nukkit.event.block.ItemFrameDropItemEvent;
import cn.nukkit.item.Item;
import cn.nukkit.item.ItemBlock;
import cn.nukkit.item.RuntimeItems;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.NBTIO;
import cn.nukkit.nbt.tag.CompoundTag;
Expand Down Expand Up @@ -103,7 +104,12 @@ public CompoundTag getSpawnCompound() {
.putInt("y", (int) this.y)
.putInt("z", (int) this.z);

if (item.getShort("id") != Item.AIR) {
int itemId = item.getShort("id");
if (itemId != Item.AIR) {
String identifier = RuntimeItems.getMapping().toRuntime(itemId, item.getShort("Damage")).getIdentifier();
item.putString("Name", identifier);
item.remove("id");

tag.putCompound("Item", item)
.putByte("ItemRotation", this.getItemRotation());
}
Expand Down

0 comments on commit 50319c2

Please sign in to comment.