package net.pietru.omni_power.blockevents;

import finalforeach.cosmicreach.blockevents.BlockEventArgs;
import finalforeach.cosmicreach.blockevents.actions.ActionId;
import finalforeach.cosmicreach.blockevents.actions.IBlockAction;
import finalforeach.cosmicreach.items.containers.SlotContainer;
import net.pietru.omni_power.OmniPower;
import net.pietru.omni_power.ui.CustomScreen;
import net.pietru.omni_power.ui.DummyObject;

@ActionId(id = OmniPower.MOD_ID+":open_ui")
public class OpenCustomUI implements IBlockAction {
    public static boolean block_entities = false;

    public String ui_id;
    public int slots;

    public OpenCustomUI(){
        block_entities=OmniPower.block_entities;
    }

    @Override
    public void act(BlockEventArgs args) {
        DummyObject tmp = new DummyObject();
        tmp.srcBlockState=args.srcBlockState;
        tmp.blockEventTrigger=args.blockEventTrigger;
        tmp.zone=args.zone;
        tmp.blockPos=args.blockPos;
        tmp.setSrcIdentity(args.getSrcIdentity());
        tmp.ui_id=ui_id;
        tmp.container=new SlotContainer(slots);
        CustomScreen.addOpenContainer(tmp,tmp.container);
    }
}
