Search in sources :

Example 1 with SimpleLeveledRegistry

use of ivorius.reccomplex.files.SimpleLeveledRegistry in project RecurrentComplex by Ivorforce.

the class RCGuiHandler method openComponentGui.

protected static void openComponentGui(EntityPlayer player, String key, Component component, SaveDirectoryData saveDirectoryData, int guiID) {
    if (key == null)
        key = "New Generator";
    if (component == null)
        component = Component.createDefaultComponent();
    if (saveDirectoryData == null) {
        SimpleLeveledRegistry<Component>.Status<Component> status = GenericItemCollectionRegistry.INSTANCE.status(key);
        saveDirectoryData = SaveDirectoryData.defaultData(key, status != null && status.isActive(), RecurrentComplex.loader.tryFindIDs(ResourceDirectory.ACTIVE.toPath(), RCFileSuffix.INVENTORY_GENERATION_COMPONENT), RecurrentComplex.loader.tryFindIDs(ResourceDirectory.INACTIVE.toPath(), RCFileSuffix.INVENTORY_GENERATION_COMPONENT));
    }
    ByteBuf buf = Unpooled.buffer();
    ByteBufUtils.writeUTF8String(buf, key);
    ItemCollectionSaveHandler.INSTANCE.write(buf, component);
    saveDirectoryData.writeTo(buf);
    IvGuiRegistry.INSTANCE.openGui(player, RecurrentComplex.MOD_ID, guiID, buf);
}
Also used : Component(ivorius.reccomplex.world.storage.loot.GenericItemCollection.Component) ByteBuf(io.netty.buffer.ByteBuf) SimpleLeveledRegistry(ivorius.reccomplex.files.SimpleLeveledRegistry)

Example 2 with SimpleLeveledRegistry

use of ivorius.reccomplex.files.SimpleLeveledRegistry in project RecurrentComplex by Ivorforce.

the class PacketEditStructureHandler method openEditStructure.

public static void openEditStructure(GenericStructure structureInfo, String structureID, EntityPlayerMP player) {
    if (structureID == null)
        structureID = "NewStructure";
    RCEntityInfo entityInfo = RCEntityInfo.get(player, null);
    if (entityInfo != null)
        entityInfo.setCachedExportStructureBlockDataNBT(structureInfo.worldDataCompound);
    SimpleLeveledRegistry<Structure<?>>.Status<Structure<?>> status = StructureRegistry.INSTANCE.status(structureID);
    RecurrentComplex.network.sendTo(new PacketEditStructure(structureInfo, structureID, SaveDirectoryData.defaultData(structureID, status != null && status.isActive(), RecurrentComplex.loader.tryFindIDs(ResourceDirectory.ACTIVE.toPath(), RCFileSuffix.STRUCTURE), RecurrentComplex.loader.tryFindIDs(ResourceDirectory.INACTIVE.toPath(), RCFileSuffix.STRUCTURE))), player);
}
Also used : RCEntityInfo(ivorius.reccomplex.capability.RCEntityInfo) GenericStructure(ivorius.reccomplex.world.gen.feature.structure.generic.GenericStructure) Structure(ivorius.reccomplex.world.gen.feature.structure.Structure) GuiEditGenericStructure(ivorius.reccomplex.gui.editstructure.GuiEditGenericStructure) SimpleLeveledRegistry(ivorius.reccomplex.files.SimpleLeveledRegistry)

Aggregations

SimpleLeveledRegistry (ivorius.reccomplex.files.SimpleLeveledRegistry)2 ByteBuf (io.netty.buffer.ByteBuf)1 RCEntityInfo (ivorius.reccomplex.capability.RCEntityInfo)1 GuiEditGenericStructure (ivorius.reccomplex.gui.editstructure.GuiEditGenericStructure)1 Structure (ivorius.reccomplex.world.gen.feature.structure.Structure)1 GenericStructure (ivorius.reccomplex.world.gen.feature.structure.generic.GenericStructure)1 Component (ivorius.reccomplex.world.storage.loot.GenericItemCollection.Component)1