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 fu, final int integer2, final int integer3) {
        this.pos = fu;
        this.rotation = integer2;
        this.entityId = integer3;
    }
    
    public static MapFrame load(final CompoundTag le) {
        final BlockPos fu2 = NbtUtils.readBlockPos(le.getCompound("Pos"));
        final int integer3 = le.getInt("Rotation");
        final int integer4 = le.getInt("EntityId");
        return new MapFrame(fu2, integer3, integer4);
    }
    
    public CompoundTag save() {
        final CompoundTag le2 = new CompoundTag();
        le2.put("Pos", NbtUtils.writeBlockPos(this.pos));
        le2.putInt("Rotation", this.rotation);
        le2.putInt("EntityId", this.entityId);
        return le2;
    }
    
    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 fu) {
        return "frame-" + fu.getX() + "," + fu.getY() + "," + fu.getZ();
    }
}
