Search in sources :

Example 1 with BigItemStack

use of betterquesting.api.utils.BigItemStack in project BetterQuesting by Funwayguy.

the class QuestInstance method setupProps.

private void setupProps() {
    setupValue(NativeProps.NAME, "New Quest");
    setupValue(NativeProps.DESC, "No Description");
    setupValue(NativeProps.ICON, new BigItemStack(Items.NETHER_STAR));
    setupValue(NativeProps.SOUND_COMPLETE);
    setupValue(NativeProps.SOUND_UPDATE);
    // setupValue(NativeProps.SOUND_UNLOCK);
    setupValue(NativeProps.LOGIC_QUEST, EnumLogic.AND);
    setupValue(NativeProps.LOGIC_TASK, EnumLogic.AND);
    setupValue(NativeProps.REPEAT_TIME, -1);
    setupValue(NativeProps.LOCKED_PROGRESS, false);
    setupValue(NativeProps.AUTO_CLAIM, false);
    setupValue(NativeProps.SILENT, false);
    setupValue(NativeProps.MAIN, false);
    setupValue(NativeProps.PARTY_LOOT, false);
    setupValue(NativeProps.GLOBAL_SHARE, false);
    setupValue(NativeProps.SIMULTANEOUS, false);
}
Also used : BigItemStack(betterquesting.api.utils.BigItemStack)

Example 2 with BigItemStack

use of betterquesting.api.utils.BigItemStack in project BetterQuesting by Funwayguy.

the class GuiThemes method initPanel.

@Override
public void initPanel() {
    super.initPanel();
    PEventBroadcaster.INSTANCE.register(this, PEventButton.class);
    // Background panel
    CanvasTextured bgCan = new CanvasTextured(new GuiTransform(GuiAlign.FULL_BOX, new GuiPadding(0, 0, 0, 0), 0), PresetTexture.PANEL_MAIN.getTexture());
    this.addPanel(bgCan);
    // Inner canvas bounds
    CanvasEmpty inCan = new CanvasEmpty(new GuiTransform(GuiAlign.FULL_BOX, new GuiPadding(16, 16, 16, 16), 0));
    bgCan.addPanel(inCan);
    PanelTextBox panTxt = new PanelTextBox(new GuiTransform(GuiAlign.TOP_EDGE, new GuiPadding(0, 0, 0, -16), 0), I18n.format("betterquesting.title.select_theme")).setAlignment(1);
    panTxt.setColor(PresetColor.TEXT_HEADER.getColor());
    inCan.addPanel(panTxt);
    PanelButton btnExit = new PanelButton(new GuiTransform(GuiAlign.BOTTOM_CENTER, new GuiPadding(-100, -16, -100, 0), 0), 0, I18n.format("gui.done"));
    bgCan.addPanel(btnExit);
    CanvasScrolling canScroll = new CanvasScrolling(new GuiTransform(GuiAlign.HALF_LEFT, new GuiPadding(0, 16, 16, 16), 0));
    inCan.addPanel(canScroll);
    List<ITheme> themes = betterquesting.client.themes.ThemeRegistry.INSTANCE.getAllThemes();
    // List<IGuiTheme> themes = ThemeRegistry.INSTANCE.getAllThemes();
    int width = canScroll.getTransform().getWidth();
    for (int i = 0; i < themes.size(); i++) {
        GuiRectangle trans = new GuiRectangle(0, i * 24, width, 24, 0);
        ITheme theme = themes.get(i);
        PanelButtonStorage<ResourceLocation> pbs = new PanelButtonStorage<>(trans, 1, theme.getDisplayName(), theme.getThemeID());
        canScroll.addPanel(pbs);
        if (betterquesting.client.themes.ThemeRegistry.INSTANCE.getCurrentTheme() == theme) {
            pbs.setEnabled(false);
        }
    }
    PanelVScrollBar vsb = new PanelVScrollBar(new GuiTransform(GuiAlign.RIGHT_EDGE, new GuiPadding(0, 0, -8, 0), 0));
    inCan.addPanel(vsb);
    vsb.getTransform().setParent(canScroll.getTransform());
    canScroll.setScrollDriverY(vsb);
    scrollPanel = vsb;
    // === PREVIEW PANELS ===
    CanvasEmpty preCan = new CanvasEmpty(new GuiTransform(GuiAlign.HALF_RIGHT, new GuiPadding(8, 16, 0, 16), 0));
    inCan.addPanel(preCan);
    CanvasTextured preCanIn0 = new CanvasTextured(new GuiTransform(new Vector4f(0F, 0F, 0.5F, 0.5F), new GuiPadding(0, 0, 0, 0), 0), PresetTexture.PANEL_MAIN.getTexture());
    preCan.addPanel(preCanIn0);
    preCanIn0.addPanel(new PanelTextBox(new GuiTransform(GuiAlign.MID_CENTER, -32, -8, 64, 16, 0), "EXAMPLE").setAlignment(1).setColor(PresetColor.TEXT_MAIN.getColor()));
    CanvasTextured preCanIn1 = new CanvasTextured(new GuiTransform(new Vector4f(0.5F, 0F, 1F, 0.5F), new GuiPadding(0, 0, 0, 0), 0), PresetTexture.PANEL_INNER.getTexture());
    preCanIn1.addPanel(new PanelTextBox(new GuiTransform(GuiAlign.MID_CENTER, -32, -8, 64, 16, 0), "EXAMPLE").setAlignment(1).setColor(PresetColor.TEXT_AUX_0.getColor()));
    preCan.addPanel(preCanIn1);
    CanvasTextured preCanIn2 = new CanvasTextured(new GuiTransform(GuiAlign.HALF_BOTTOM, new GuiPadding(0, 0, 0, 0), 0), PresetTexture.AUX_FRAME_0.getTexture());
    preCan.addPanel(preCanIn2);
    IGuiTexture icoSlides = new SlideShowTexture(1F, new GuiTextureColored(PresetTexture.QUEST_NORM_0.getTexture(), PresetColor.QUEST_ICON_LOCKED.getColor()), new GuiTextureColored(PresetTexture.QUEST_NORM_1.getTexture(), PresetColor.QUEST_ICON_UNLOCKED.getColor()), new GuiTextureColored(PresetTexture.QUEST_NORM_2.getTexture(), PresetColor.QUEST_ICON_PENDING.getColor()), new GuiTextureColored(PresetTexture.QUEST_NORM_3.getTexture(), PresetColor.QUEST_ICON_COMPLETE.getColor()), new GuiTextureColored(PresetTexture.QUEST_MAIN_0.getTexture(), PresetColor.QUEST_ICON_LOCKED.getColor()), new GuiTextureColored(PresetTexture.QUEST_MAIN_1.getTexture(), PresetColor.QUEST_ICON_UNLOCKED.getColor()), new GuiTextureColored(PresetTexture.QUEST_MAIN_2.getTexture(), PresetColor.QUEST_ICON_PENDING.getColor()), new GuiTextureColored(PresetTexture.QUEST_MAIN_3.getTexture(), PresetColor.QUEST_ICON_COMPLETE.getColor()), new GuiTextureColored(PresetTexture.QUEST_AUX_0.getTexture(), PresetColor.QUEST_ICON_LOCKED.getColor()), new GuiTextureColored(PresetTexture.QUEST_AUX_1.getTexture(), PresetColor.QUEST_ICON_UNLOCKED.getColor()), new GuiTextureColored(PresetTexture.QUEST_AUX_2.getTexture(), PresetColor.QUEST_ICON_PENDING.getColor()), new GuiTextureColored(PresetTexture.QUEST_AUX_3.getTexture(), PresetColor.QUEST_ICON_COMPLETE.getColor()));
    PanelGeneric pqp = new PanelGeneric(new GuiTransform(new Vector4f(0.25F, 0.5F, 0.25F, 0.5F), -12, -12, 24, 24, 0), icoSlides);
    preCanIn2.addPanel(pqp);
    CanvasTextured itemFrame = new CanvasTextured(new GuiTransform(new Vector4f(0.75F, 0.5F, 0.75F, 0.5F), -12, -12, 24, 24, 0), PresetTexture.ITEM_FRAME.getTexture());
    itemFrame.addPanel(new PanelGeneric(new GuiTransform(GuiAlign.FULL_BOX, new GuiPadding(1, 1, 1, 1), 0), new ItemTexture(new BigItemStack(BetterQuesting.guideBook))));
    preCanIn2.addPanel(itemFrame);
    IGuiLine linSeq = new GuiLineSequence(1F, PresetLine.QUEST_LOCKED.getLine(), PresetLine.QUEST_UNLOCKED.getLine(), PresetLine.QUEST_PENDING.getLine(), PresetLine.QUEST_COMPLETE.getLine());
    IGuiColor colSeq = new GuiColorSequence(1F, PresetColor.QUEST_LINE_LOCKED.getColor(), PresetColor.QUEST_LINE_UNLOCKED.getColor(), PresetColor.QUEST_LINE_PENDING.getColor(), PresetColor.QUEST_LINE_COMPLETE.getColor());
    preCanIn2.addPanel(new PanelLine(pqp.getTransform(), itemFrame.getTransform(), linSeq, 4, colSeq, 1));
    preCanIn2.addPanel(new PanelTextBox(new GuiTransform(GuiAlign.FULL_BOX, new GuiPadding(8, 8, 8, 8), 0), "EXAMPLE").setAlignment(1).setColor(PresetColor.TEXT_AUX_1.getColor()));
    IGuiRect ls0 = new GuiTransform(GuiAlign.TOP_CENTER, 0, 16, 0, 0, 0);
    ls0.setParent(inCan.getTransform());
    IGuiRect le0 = new GuiTransform(GuiAlign.BOTTOM_CENTER, 0, -16, 0, 0, 0);
    le0.setParent(inCan.getTransform());
    PanelLine paLine0 = new PanelLine(ls0, le0, PresetLine.GUI_DIVIDER.getLine(), 1, PresetColor.GUI_DIVIDER.getColor(), 1);
    inCan.addPanel(paLine0);
}
Also used : PanelButton(betterquesting.api2.client.gui.controls.PanelButton) IPanelButton(betterquesting.api2.client.gui.controls.IPanelButton) GuiLineSequence(betterquesting.api2.client.gui.resources.lines.GuiLineSequence) PanelVScrollBar(betterquesting.api2.client.gui.panels.bars.PanelVScrollBar) IGuiColor(betterquesting.api2.client.gui.resources.colors.IGuiColor) Vector4f(org.lwjgl.util.vector.Vector4f) ResourceLocation(net.minecraft.util.ResourceLocation) CanvasTextured(betterquesting.api2.client.gui.panels.CanvasTextured) PanelButtonStorage(betterquesting.api2.client.gui.controls.PanelButtonStorage) ITheme(betterquesting.api.client.themes.ITheme) IGuiTexture(betterquesting.api2.client.gui.resources.textures.IGuiTexture) IGuiLine(betterquesting.api2.client.gui.resources.lines.IGuiLine) PanelLine(betterquesting.api2.client.gui.panels.content.PanelLine) CanvasEmpty(betterquesting.api2.client.gui.panels.CanvasEmpty) SlideShowTexture(betterquesting.api2.client.gui.resources.textures.SlideShowTexture) PanelTextBox(betterquesting.api2.client.gui.panels.content.PanelTextBox) GuiTextureColored(betterquesting.api2.client.gui.resources.textures.GuiTextureColored) GuiColorSequence(betterquesting.api2.client.gui.resources.colors.GuiColorSequence) CanvasScrolling(betterquesting.api2.client.gui.panels.lists.CanvasScrolling) PanelGeneric(betterquesting.api2.client.gui.panels.content.PanelGeneric) BigItemStack(betterquesting.api.utils.BigItemStack) ItemTexture(betterquesting.api2.client.gui.resources.textures.ItemTexture)

Example 3 with BigItemStack

use of betterquesting.api.utils.BigItemStack in project BetterQuesting by Funwayguy.

the class GuiJsonTypeMenu method initGui.

@Override
public void initGui() {
    super.initGui();
    fluid = null;
    stack = null;
    entity = null;
    if (json != null) {
        if (// Must have at least these 3 to be considered a valid 'item'
        JsonHelper.isItem(json)) {
            stack = JsonHelper.JsonToItemStack(json);
        }
        if (stack == null && JsonHelper.isEntity(json)) {
            entity = EntityList.createEntityFromNBT(json, Minecraft.getMinecraft().world);
        }
        if (stack == null && entity == null && JsonHelper.isFluid(json)) {
            fluid = JsonHelper.JsonToFluidStack(json);
        }
    } else // JSON cannot be null!
    {
        this.mc.displayGuiScreen(parent);
        return;
    }
    if (stack == null) {
        stack = new BigItemStack(Blocks.STONE);
    }
    if (entity == null) {
        entity = new EntityPig(Minecraft.getMinecraft().world);
    }
    if (fluid == null) {
        fluid = new FluidStack(FluidRegistry.WATER, 1000);
    }
    if (lastType == EditType.ITEM) {
        JsonHelper.ClearCompoundTag(json);
        JsonHelper.ItemStackToJson(stack, json);
    } else if (lastType == EditType.FLUID) {
        JsonHelper.ClearCompoundTag(json);
        JsonHelper.FluidStackToJson(fluid, json);
    } else if (lastType == EditType.ENTITY) {
        JsonHelper.ClearCompoundTag(json);
        JsonHelper.EntityToJson(entity, json);
    }
    if (lastType != EditType.NONE) {
        mc.displayGuiScreen(parent);
    }
    // JSON Editor
    GuiButtonThemed editButton = new GuiButtonThemed(3, this.width / 2 - 100, this.height / 2 - 40, 200, 20, I18n.format("betterquesting.btn.raw_nbt"), true);
    // Item Selector
    GuiButtonThemed itemButton = new GuiButtonThemed(1, this.width / 2 - 100, this.height / 2 - 20, 200, 20, I18n.format("betterquesting.btn.item"), true);
    // Fluid Editor
    GuiButtonThemed fluidButton = new GuiButtonThemed(4, this.width / 2 - 100, this.height / 2 + 00, 200, 20, I18n.format("betterquesting.btn.fluid"), true);
    // Entity Selector
    GuiButtonThemed entityButton = new GuiButtonThemed(2, this.width / 2 - 100, this.height / 2 + 20, 200, 20, I18n.format("betterquesting.btn.entity"), true);
    this.buttonList.add(itemButton);
    this.buttonList.add(entityButton);
    this.buttonList.add(editButton);
    this.buttonList.add(fluidButton);
    itemCallback = new JsonItemCallback(json, stack);
    fluidCallback = new JsonFluidCallback(json, fluid);
    entityCallback = new JsonEntityCallback(json, entity);
}
Also used : EntityPig(net.minecraft.entity.passive.EntityPig) FluidStack(net.minecraftforge.fluids.FluidStack) JsonEntityCallback(betterquesting.client.gui.editors.json.callback.JsonEntityCallback) GuiButtonThemed(betterquesting.api.client.gui.controls.GuiButtonThemed) BigItemStack(betterquesting.api.utils.BigItemStack) JsonFluidCallback(betterquesting.client.gui.editors.json.callback.JsonFluidCallback) JsonItemCallback(betterquesting.client.gui.editors.json.callback.JsonItemCallback)

Example 4 with BigItemStack

use of betterquesting.api.utils.BigItemStack in project BetterQuesting by Funwayguy.

the class JsonItemCallback method setValue.

public void setValue(BigItemStack stack) {
    if (stack != null) {
        this.baseStack = stack;
    } else {
        this.baseStack = new BigItemStack(Blocks.STONE);
    }
    JsonHelper.ClearCompoundTag(json);
    JsonHelper.ItemStackToJson(baseStack, json);
}
Also used : BigItemStack(betterquesting.api.utils.BigItemStack)

Example 5 with BigItemStack

use of betterquesting.api.utils.BigItemStack in project BetterQuesting by Funwayguy.

the class GuiToolIconProxy method setValue.

@Override
public void setValue(BigItemStack value) {
    BigItemStack stack = value != null ? value : new BigItemStack(Items.NETHER_STAR);
    quest.getProperties().setProperty(NativeProps.ICON, stack);
    SendChanges();
}
Also used : BigItemStack(betterquesting.api.utils.BigItemStack)

Aggregations

BigItemStack (betterquesting.api.utils.BigItemStack)9 ItemStack (net.minecraft.item.ItemStack)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 GuiButtonThemed (betterquesting.api.client.gui.controls.GuiButtonThemed)1 ITheme (betterquesting.api.client.themes.ITheme)1 IPanelButton (betterquesting.api2.client.gui.controls.IPanelButton)1 PanelButton (betterquesting.api2.client.gui.controls.PanelButton)1 PanelButtonStorage (betterquesting.api2.client.gui.controls.PanelButtonStorage)1 CanvasEmpty (betterquesting.api2.client.gui.panels.CanvasEmpty)1 CanvasTextured (betterquesting.api2.client.gui.panels.CanvasTextured)1 PanelVScrollBar (betterquesting.api2.client.gui.panels.bars.PanelVScrollBar)1 PanelGeneric (betterquesting.api2.client.gui.panels.content.PanelGeneric)1 PanelLine (betterquesting.api2.client.gui.panels.content.PanelLine)1 PanelTextBox (betterquesting.api2.client.gui.panels.content.PanelTextBox)1 CanvasScrolling (betterquesting.api2.client.gui.panels.lists.CanvasScrolling)1 GuiColorSequence (betterquesting.api2.client.gui.resources.colors.GuiColorSequence)1 IGuiColor (betterquesting.api2.client.gui.resources.colors.IGuiColor)1 GuiLineSequence (betterquesting.api2.client.gui.resources.lines.GuiLineSequence)1