Search in sources :

Example 16 with GristSet

use of com.mraof.minestuck.util.GristSet in project Minestuck by mraof.

the class DeployList method registerItems.

public static void registerItems() {
    registerItem(new ItemStack(MinestuckBlocks.sburbMachine, 1, 0), new GristSet(), new GristSet(GristType.Build, 100), 0);
    registerItem(new ItemStack(MinestuckBlocks.sburbMachine, 1, 2), new GristSet(), new GristSet(GristType.Build, 100), 0);
    registerItem(AlchemyRecipeHandler.createCard(new ItemStack(MinestuckItems.cruxiteApple), true), new GristSet(), null, 0);
    registerItem(new ItemStack(MinestuckBlocks.sburbMachine, 1, 3), new GristSet(), new GristSet(GristType.Build, 100), 0);
    registerItem(new ItemStack(MinestuckBlocks.sburbMachine, 1, 1), new GristSet(GristType.Shale, 4), 0);
}
Also used : GristSet(com.mraof.minestuck.util.GristSet) ItemStack(net.minecraft.item.ItemStack)

Example 17 with GristSet

use of com.mraof.minestuck.util.GristSet in project Minestuck by mraof.

the class GuiCrockerMachine method drawGuiContainerForegroundLayer.

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    fontRenderer.drawString(I18n.format("gui." + guis[type.ordinal()] + ".name"), 8, 6, 0xFFFFFF);
    // draws "Inventory" or your regional equivalent
    fontRenderer.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 0xFFFFFF);
    if (type == MachineType.GRIST_WIDGET && !te.getStackInSlot(0).isEmpty()) {
        // Render grist requirements
        ItemStack stack = AlchemyRecipeHandler.getDecodedItem(te.getStackInSlot(0));
        GristSet set = GristRegistry.getGristConversion(stack);
        if (set != null) {
            float multiplier = stack.getCount();
            if (multiplier != 1) {
                set = set.scaleGrist(multiplier);
            }
            set.scaleGrist(0.9F);
        }
        if (set != null && stack.isItemDamaged()) {
            float multiplier = 1 - stack.getItem().getDamage(stack) / ((float) stack.getMaxDamage());
            for (GristAmount amount : set.getArray()) {
                set.setGrist(amount.getType(), (int) (amount.getAmount() * multiplier));
            }
        }
        GuiUtil.drawGristBoard(set, GuiUtil.GristboardMode.GRIST_WIDGET, 9, 45, fontRenderer);
        List<String> tooltip = GuiUtil.getGristboardTooltip(set, mouseX - this.guiLeft, mouseY - this.guiTop, 9, 45, fontRenderer);
        if (tooltip != null)
            this.drawHoveringText(tooltip, mouseX - this.guiLeft, mouseY - this.guiTop, fontRenderer);
    }
}
Also used : GristSet(com.mraof.minestuck.util.GristSet) GristAmount(com.mraof.minestuck.util.GristAmount) ItemStack(net.minecraft.item.ItemStack)

Example 18 with GristSet

use of com.mraof.minestuck.util.GristSet in project Minestuck by mraof.

the class GuiScreenMinestuck method drawGrist.

public void drawGrist(int xOffset, int yOffset, int xcor, int ycor, int page) {
    // Show the name of the grist instead of the count if displaying a tooltip
    boolean showName = false;
    GristType tooltipType = null;
    GristSet clientGrist = MinestuckPlayerData.getClientGrist();
    List<GristType> types = new ArrayList<>(GristType.REGISTRY.getValues());
    Collections.sort(types);
    types = types.stream().skip(page * rows * columns).limit(rows * columns).collect(Collectors.toList());
    int offset = 0;
    for (GristType type : types) {
        int column = offset % columns;
        int row = offset / columns;
        int gristXOffset = xOffset + (gristDisplayXOffset * column - column);
        int gristYOffset = yOffset + (gristDisplayYOffset * row - row);
        String amount = GuiUtil.addSuffix(clientGrist.getGrist(type));
        if (this.isPointInRegion(gristXOffset + gristIconX, gristYOffset + gristIconY, 16, 16, xcor, ycor)) {
            this.drawGradientRect(gristXOffset + gristIconX, gristYOffset + gristIconY, gristXOffset + gristIconX + 16, gristYOffset + gristIconY + 17, -2130706433, -2130706433);
            tooltipType = type;
            showName = true;
        }
        if (!String.valueOf(clientGrist.getGrist(type)).equals(amount) && this.isPointInRegion(gristXOffset + gristCountX - 1, gristYOffset + gristCountY - 1, 35, 10, xcor, ycor)) {
            tooltipType = type;
            showName = false;
        }
        this.drawIcon(gristXOffset + gristIconX, gristYOffset + gristIconY, type.getIcon());
        mc.fontRenderer.drawString(amount, gristXOffset + gristCountX, gristYOffset + gristCountY, 0xddddee);
        offset++;
    }
    if (tooltipType != null) {
        if (showName) {
            drawHoveringText(Collections.singletonList(I18n.format("grist.format", tooltipType.getDisplayName())), xcor, ycor, fontRenderer);
        } else {
            drawHoveringText(Collections.singletonList(String.valueOf(clientGrist.getGrist(tooltipType))), xcor, ycor, fontRenderer);
        }
    }
}
Also used : GristSet(com.mraof.minestuck.util.GristSet) GristType(com.mraof.minestuck.util.GristType)

Aggregations

GristSet (com.mraof.minestuck.util.GristSet)18 ItemStack (net.minecraft.item.ItemStack)11 GristType (com.mraof.minestuck.util.GristType)8 GristAmount (com.mraof.minestuck.util.GristAmount)5 Block (net.minecraft.block.Block)3 Item (net.minecraft.item.Item)3 List (java.util.List)2 Map (java.util.Map)2 ZenMethod (stanhebben.zenscript.annotations.ZenMethod)2 EntityGrist (com.mraof.minestuck.entity.item.EntityGrist)1 EntityVitalityGel (com.mraof.minestuck.entity.item.EntityVitalityGel)1 IItemStack (crafttweaker.api.item.IItemStack)1 ArrayList (java.util.ArrayList)1 Entry (java.util.Map.Entry)1 EntityItem (net.minecraft.entity.item.EntityItem)1 ResourceLocation (net.minecraft.util.ResourceLocation)1