use of ivorius.reccomplex.world.storage.loot.GenericItemCollection.Component 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);
}
use of ivorius.reccomplex.world.storage.loot.GenericItemCollection.Component in project RecurrentComplex by Ivorforce.
the class ItemInventoryGenComponentTag method addInformation.
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advancedInformation) {
super.addInformation(stack, player, list, advancedInformation);
Component component = component(stack);
if (component != null) {
list.add(component.inventoryGeneratorID);
list.add(GenericItemCollectionRegistry.INSTANCE.hasActive(componentKey(stack)) ? IvTranslations.format("inventoryGen.active", TextFormatting.GREEN, TextFormatting.RESET) : IvTranslations.format("inventoryGen.inactive", TextFormatting.RED, TextFormatting.RESET));
} else
list.add(IvTranslations.get("inventoryGen.create"));
}
use of ivorius.reccomplex.world.storage.loot.GenericItemCollection.Component in project RecurrentComplex by Ivorforce.
the class RCGuiHandler method getClientGuiElement.
@Override
public Object getClientGuiElement(int id, EntityPlayer player, ByteBuf data) {
if (id == editInventoryGen || id == editInventoryGenItems) {
String key = ByteBufUtils.readUTF8String(data);
Component component = ItemCollectionSaveHandler.INSTANCE.read(data);
SaveDirectoryData saveDirectoryData = SaveDirectoryData.readFrom(data);
if (component != null) {
if (id == editInventoryGen)
return new GuiEditInventoryGen(player, component, key, saveDirectoryData);
else
return new GuiEditInventoryGenItems(player, component, key, saveDirectoryData);
}
}
return null;
}
Aggregations