package net.minecraft.world.level.saveddata.maps;

import net.minecraft.nbt.Tag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.core.BlockPos;

public class MapFrame {
    private final BlockPos pos;
    private final int rotation;
    private final int entityId;
    
    public MapFrame(final BlockPos fk, final int integer2, final int integer3) {
        this.pos = fk;
        this.rotation = integer2;
        this.entityId = integer3;
    }
    
    public static MapFrame load(final CompoundTag jt) {
        final BlockPos fk2 = NbtUtils.readBlockPos(jt.getCompound("Pos"));
        final int integer3 = jt.getInt("Rotation");
        final int integer4 = jt.getInt("EntityId");
        return new MapFrame(fk2, integer3, integer4);
    }
    
    public CompoundTag save() {
        final CompoundTag jt2 = new CompoundTag();
        jt2.put("Pos", NbtUtils.writeBlockPos(this.pos));
        jt2.putInt("Rotation", this.rotation);
        jt2.putInt("EntityId", this.entityId);
        return jt2;
    }
    
    public BlockPos getPos() {
        return this.pos;
    }
    
    public int getRotation() {
        return this.rotation;
    }
    
    public int getEntityId() {
        return this.entityId;
    }
    
    public String getId() {
        return frameId(this.pos);
    }
    
    public static String frameId(final BlockPos fk) {
        return "frame-" + fk.getX() + "," + fk.getY() + "," + fk.getZ();
    }
}
