Search in sources :

Example 11 with GristSet

use of com.mraof.minestuck.util.GristSet 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 12 with GristSet

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

the class EntityUnderling method onDeathUpdate.

@Override
protected void onDeathUpdate() {
    super.onDeathUpdate();
    if (this.deathTime == 20 && !this.world.isRemote) {
        GristSet grist = this.getGristSpoils();
        if (fromSpawner)
            grist.scaleGrist(0.5F);
        if (!dropCandy) {
            for (GristAmount gristType : grist.getArray()) this.world.spawnEntity(new EntityGrist(world, randX(), this.posY, randZ(), gristType));
        } else {
            for (GristAmount gristType : grist.getArray()) {
                int candy = (gristType.getAmount() + 2) / 4;
                int gristAmount = gristType.getAmount() - candy * 2;
                if (candy > 0)
                    this.world.spawnEntity(new EntityItem(world, randX(), this.posY, randZ(), new ItemStack(MinestuckItems.candy, candy, gristType.getType().getId() + 1)));
                if (gristAmount > 0)
                    this.world.spawnEntity(new EntityGrist(world, randX(), this.posY, randZ(), new GristAmount(gristType.getType(), gristAmount)));
            }
        }
        if (this.rand.nextInt(4) == 0)
            this.world.spawnEntity(new EntityVitalityGel(world, randX(), this.posY, randZ(), this.getVitalityGel()));
    }
}
Also used : GristSet(com.mraof.minestuck.util.GristSet) EntityGrist(com.mraof.minestuck.entity.item.EntityGrist) EntityVitalityGel(com.mraof.minestuck.entity.item.EntityVitalityGel) GristAmount(com.mraof.minestuck.util.GristAmount) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem)

Example 13 with GristSet

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

the class MinestuckJeiPlugin method register.

@Override
public void register(IModRegistry registry) {
    ArrayList<AlchemiterRecipeWrapper> alchemiterRecipes = new ArrayList<AlchemiterRecipeWrapper>();
    for (Map.Entry<List<Object>, GristSet> entry : GristRegistry.getAllConversions().entrySet()) {
        for (ItemStack stack : getItemStacks(entry.getKey().get(0), (Integer) entry.getKey().get(1))) {
            alchemiterRecipes.add(new AlchemiterRecipeWrapper(stack, entry.getValue()));
        }
    }
    registry.addRecipes(alchemiterRecipes, alchemiterCategory.getUid());
    registry.addRecipeCatalyst(new ItemStack(MinestuckBlocks.sburbMachine, 1, BlockSburbMachine.MachineType.ALCHEMITER.ordinal()), alchemiterCategory.getUid());
    ArrayList<PunchCardRecipeWrapper> latheRecipes = new ArrayList<PunchCardRecipeWrapper>();
    ArrayList<PunchCardRecipeWrapper> designixRecipes = new ArrayList<PunchCardRecipeWrapper>();
    for (Map.Entry<List<Object>, ItemStack> entry : CombinationRegistry.getAllConversions().entrySet()) {
        List<ItemStack> firstStacks = getItemStacks(entry.getKey().get(0), (Integer) entry.getKey().get(1));
        List<ItemStack> secondStacks = getItemStacks(entry.getKey().get(2), (Integer) entry.getKey().get(3));
        if (!(firstStacks.isEmpty() || secondStacks.isEmpty())) {
            if ((Boolean) entry.getKey().get(4) == CombinationRegistry.MODE_AND) {
                latheRecipes.add(new TotemLatheRecipeWrapper(firstStacks, secondStacks, entry.getValue()));
            } else {
                designixRecipes.add(new DesignixRecipeWrapper(firstStacks, secondStacks, entry.getValue()));
            }
        }
    }
    Debug.info("Adding " + (latheRecipes.size() + designixRecipes.size()) + " punch card recipes to the jei plugin");
    registry.addRecipes(latheRecipes, totemLatheCategory.getUid());
    registry.addRecipes(designixRecipes, designixCategory.getUid());
    registry.addRecipeCatalyst(new ItemStack(MinestuckBlocks.sburbMachine, 1, BlockSburbMachine.MachineType.TOTEM_LATHE.ordinal()), totemLatheCategory.getUid());
    registry.addRecipeCatalyst(new ItemStack(MinestuckBlocks.sburbMachine, 1, BlockSburbMachine.MachineType.PUNCH_DESIGNIX.ordinal()), designixCategory.getUid());
}
Also used : ArrayList(java.util.ArrayList) GristSet(com.mraof.minestuck.util.GristSet) ArrayList(java.util.ArrayList) List(java.util.List) ItemStack(net.minecraft.item.ItemStack) Map(java.util.Map)

Example 14 with GristSet

use of com.mraof.minestuck.util.GristSet 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 15 with GristSet

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

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