Search in sources :

Example 6 with GristType

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

the class GristCachePacket method generatePacket.

@Override
public MinestuckPacket generatePacket(Object... dat) {
    GristSet gristSet = (GristSet) dat[0];
    data.writeInt(gristSet.gristTypes.size());
    for (Map.Entry<GristType, Integer> entry : gristSet.getMap().entrySet()) {
        data.writeInt(entry.getKey().getId());
        data.writeInt(entry.getValue());
    }
    data.writeBoolean((Boolean) dat[1]);
    return this;
}
Also used : GristSet(com.mraof.minestuck.util.GristSet) Map(java.util.Map) GristType(com.mraof.minestuck.util.GristType)

Example 7 with GristType

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

the class Minegicka3Support method registerRecipes.

@Override
public void registerRecipes() throws Exception {
    Item thingy = ((Item) (Class.forName("com.williameze.minegicka3.ModBase").getField("thingy").get(null)));
    Item thingy2 = ((Item) (Class.forName("com.williameze.minegicka3.ModBase").getField("thingyGood").get(null)));
    Item thingy3 = ((Item) (Class.forName("com.williameze.minegicka3.ModBase").getField("thingySuper").get(null)));
    Item stick = ((Item) (Class.forName("com.williameze.minegicka3.ModBase").getField("stick").get(null)));
    Item stick2 = ((Item) (Class.forName("com.williameze.minegicka3.ModBase").getField("stickGood").get(null)));
    Item stick3 = ((Item) (Class.forName("com.williameze.minegicka3.ModBase").getField("stickSuper").get(null)));
    GristRegistry.addGristConversion(new ItemStack(thingy), false, new GristSet(new GristType[] { GristType.Rust, GristType.Gold }, new int[] { 16, 16 }));
    CombinationRegistry.addCombination(new ItemStack(thingy), new ItemStack(Items.STICK), CombinationRegistry.MODE_AND, new ItemStack(stick));
    CombinationRegistry.addCombination(new ItemStack(thingy2), new ItemStack(Items.STICK), CombinationRegistry.MODE_AND, new ItemStack(stick2));
    CombinationRegistry.addCombination(new ItemStack(thingy3), new ItemStack(Items.STICK), CombinationRegistry.MODE_AND, new ItemStack(stick3));
}
Also used : Item(net.minecraft.item.Item) GristSet(com.mraof.minestuck.util.GristSet) ItemStack(net.minecraft.item.ItemStack) GristType(com.mraof.minestuck.util.GristType)

Example 8 with GristType

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

the class TinkersConstructSupport method registerRecipes.

@Override
public void registerRecipes() throws Exception {
    Block oreBush1 = ((Block) Class.forName("tconstruct.world.TinkerWorld").getField("oreBerry").get(null));
    Block oreBush2 = ((Block) Class.forName("tconstruct.world.TinkerWorld").getField("oreBerrySecond").get(null));
    String[] items1 = { "ingotIron", "ingotGold", "ingotCopper", "ingotTin" };
    GristRegistry.addGristConversion(new ItemStack(oreBush1, 1, 0), new GristSet(new GristType[] { GristType.Rust, GristType.Build, GristType.Amber }, new int[] { 16, 1, 1 }));
    GristRegistry.addGristConversion(new ItemStack(oreBush1, 1, 1), new GristSet(new GristType[] { GristType.Gold, GristType.Build, GristType.Amber }, new int[] { 16, 1, 1 }));
    GristRegistry.addGristConversion(new ItemStack(oreBush1, 1, 2), new GristSet(new GristType[] { GristType.Rust, GristType.Cobalt, GristType.Build, GristType.Amber }, new int[] { 16, 3, 1, 1 }));
    GristRegistry.addGristConversion(new ItemStack(oreBush1, 1, 3), new GristSet(new GristType[] { GristType.Rust, GristType.Caulk, GristType.Build, GristType.Amber }, new int[] { 16, 8, 1, 1 }));
    GristRegistry.addGristConversion(new ItemStack(oreBush2, 1, 0), new GristSet(new GristType[] { GristType.Rust, GristType.Chalk, GristType.Build, GristType.Amber }, new int[] { 16, 6, 1, 1 }));
    GristRegistry.addGristConversion(new ItemStack(oreBush2, 1, 1), new GristSet(new GristType[] { GristType.Uranium, GristType.Quartz, GristType.Diamond, GristType.Ruby, GristType.Build, GristType.Amber }, new int[] { 8, 1, 4, 4, 1, 1 }));
    for (int i = 0; i < items1.length; i++) CombinationRegistry.addCombination("treeLeaves", items1[i], CombinationRegistry.MODE_AND, new ItemStack(oreBush1, 1, i));
    CombinationRegistry.addCombination("treeLeaves", "ingotAluminium", CombinationRegistry.MODE_AND, new ItemStack(oreBush2, 1, 0));
    CombinationRegistry.addCombination("treeLeaves", Items.EXPERIENCE_BOTTLE, 0, CombinationRegistry.MODE_AND, new ItemStack(oreBush2, 1, 1));
}
Also used : GristSet(com.mraof.minestuck.util.GristSet) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack) GristType(com.mraof.minestuck.util.GristType)

Example 9 with GristType

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

the class GuiGristSelector method mouseClicked.

@Override
protected void mouseClicked(int xcor, int ycor, int mouseButton) throws IOException {
    super.mouseClicked(xcor, ycor, mouseButton);
    if (mouseButton == 0) {
        int xOffset = (width - guiWidth) / 2;
        int yOffset = (height - guiHeight) / 2;
        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 row = offset / columns;
            int column = offset % columns;
            int gristXOffset = xOffset + gristIconX + (gristDisplayXOffset * column - column);
            int gristYOffset = yOffset + gristIconY + (gristDisplayYOffset * row - row);
            if (isPointInRegion(gristXOffset, gristYOffset, 16, 16, xcor, ycor)) {
                otherGui.te.selectedGrist = type;
                otherGui.width = this.width;
                otherGui.height = this.height;
                mc.currentScreen = otherGui;
                MinestuckPacket packet = MinestuckPacket.makePacket(Type.MACHINE_STATE, type);
                MinestuckChannelHandler.sendToServer(packet);
                break;
            }
            offset++;
        }
    }
}
Also used : ArrayList(java.util.ArrayList) MinestuckPacket(com.mraof.minestuck.network.MinestuckPacket) GristType(com.mraof.minestuck.util.GristType)

Example 10 with GristType

use of com.mraof.minestuck.util.GristType 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

GristType (com.mraof.minestuck.util.GristType)10 GristSet (com.mraof.minestuck.util.GristSet)8 ItemStack (net.minecraft.item.ItemStack)4 Block (net.minecraft.block.Block)3 Item (net.minecraft.item.Item)3 GristAmount (com.mraof.minestuck.util.GristAmount)2 MinestuckPacket (com.mraof.minestuck.network.MinestuckPacket)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 ResourceLocation (net.minecraft.util.ResourceLocation)1