Search in sources :

Example 1 with ItemGasTube

use of ladysnake.gaspunk.item.ItemGasTube in project Gaspunk by Ladysnake.

the class GasRecipeDeserializer method deserializeRecipe.

private static void deserializeRecipe(JsonObject json, JsonContext context) {
    String resultName = JsonUtils.getString(json, "result");
    IGas result = ModGases.REGISTRY.getValue(new ResourceLocation(resultName));
    if (result == null)
        throw new JsonParseException("Unrecognized gas: " + resultName);
    JsonObject jsInput = JsonUtils.getJsonObject(json, "input");
    ItemStack in;
    if (jsInput.has("gas"))
        in = getBottle(ModGases.REGISTRY.getValue(new ResourceLocation(JsonUtils.getString(jsInput, "gas"))));
    else
        in = CraftingHelper.getItemStack(jsInput, context);
    JsonObject jsIngredient = JsonUtils.getJsonObject(json, "ingredient");
    String type = JsonUtils.getString(jsIngredient, "type", "minecraft:item");
    if ("forge:ore_dict".equals(type)) {
        String ingredient = JsonUtils.getString(jsIngredient, "ore");
        BrewingRecipeRegistry.addRecipe(new GasBrewingOreRecipe(in, ingredient, ((ItemGasTube) ModItems.GAS_TUBE).getItemStackFor(result)));
    } else if ("minecraft:item".equals(type)) {
        ItemStack ingredient = CraftingHelper.getItemStack(jsIngredient, context);
        BrewingRecipeRegistry.addRecipe(new GasBrewingRecipe(in, ingredient, ((ItemGasTube) ModItems.GAS_TUBE).getItemStackFor(result)));
    }
}
Also used : ItemGasTube(ladysnake.gaspunk.item.ItemGasTube) IGas(ladysnake.gaspunk.api.IGas) ResourceLocation(net.minecraft.util.ResourceLocation) JsonObject(com.google.gson.JsonObject) JsonParseException(com.google.gson.JsonParseException) ItemStack(net.minecraft.item.ItemStack)

Example 2 with ItemGasTube

use of ladysnake.gaspunk.item.ItemGasTube in project Gaspunk by Ladysnake.

the class ThaumcraftCompat method registerGasAspect.

private static void registerGasAspect(IGas gas, AspectList aspects) {
    ItemStack gasTube = ((ItemGasTube) ModItems.GAS_TUBE).getItemStackFor(gas);
    aspects.add(divide(generateAspectsFromBrewing(gasTube), 1.1));
    ThaumcraftApi.registerObjectTag(gasTube, aspects.copy());
    ItemStack grenade = ((ItemGrenade) ModItems.GRENADE).getItemStackFor(gas);
    // aspects = divide(aspects, 1.2);
    aspects.add(divide(AspectHelper.getObjectAspects(new ItemStack(ModItems.GRENADE)), 1.8));
    for (GrenadeSkins skin : GrenadeSkins.VALUES) {
        // need to register for every skin as thaumcraft counts an itemstack with different nbt as unique
        ((ItemGrenade) ModItems.GRENADE).setSkin(grenade, skin);
        ThaumcraftApi.registerObjectTag(grenade, aspects.copy());
    }
}
Also used : ItemGasTube(ladysnake.gaspunk.item.ItemGasTube) GrenadeSkins(ladysnake.gaspunk.api.customization.GrenadeSkins) ItemGrenade(ladysnake.gaspunk.item.ItemGrenade) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemGasTube (ladysnake.gaspunk.item.ItemGasTube)2 ItemStack (net.minecraft.item.ItemStack)2 JsonObject (com.google.gson.JsonObject)1 JsonParseException (com.google.gson.JsonParseException)1 IGas (ladysnake.gaspunk.api.IGas)1 GrenadeSkins (ladysnake.gaspunk.api.customization.GrenadeSkins)1 ItemGrenade (ladysnake.gaspunk.item.ItemGrenade)1 ResourceLocation (net.minecraft.util.ResourceLocation)1