Skip to content

Commit

Permalink
Cloche Fertilizer Changes
Browse files Browse the repository at this point in the history
Adds in new fertilizers for the cloche to balance the enormous amount of sulfur that comes from the Excavator.
  • Loading branch information
BluSunrize authored Mar 30, 2024
2 parents f699f56 + 225dd9f commit 30e0a42
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 35 deletions.
29 changes: 25 additions & 4 deletions src/datagen/java/blusunrize/immersiveengineering/data/Recipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,27 @@ private void recipesCoke(@Nonnull Consumer<FinishedRecipe> out)

private void recipesCloche(@Nonnull Consumer<FinishedRecipe> out)
{
ClocheFertilizerBuilder.builder(1.25f)
//Minor nutrients are 10% boost (calcium, magnesium, sulfur), major nutrients are 20% (phosphorous, nitrogen, potassium)
//Single-nutrient fertilizers:
ClocheFertilizerBuilder.builder(1.10f)
.addInput(IETags.sulfurDust)
.build(out, toRL("fertilizer/sulfur"));
//Dual-nutrient fertilizers:
//Slag: Phosphorous, Calcium
ClocheFertilizerBuilder.builder(1.30f)
.addInput(IETags.slag)
.build(out, toRL("fertilizer/slag"));
//Nitrate: Nitrogen, no Potassium because it can be many things including sodium - and the recipe is closest to Chilean saltpeter (NaNO3)
ClocheFertilizerBuilder.builder(1.20f)
.addInput(IETags.saltpeterDust)
.build(out, toRL("fertilizer/saltpeter"));
//Bonemeal: Calcium, Phosphorous
ClocheFertilizerBuilder.builder(1.30f)
.addInput(Items.BONE_MEAL)
.build(out, toRL("fertilizer/bone_meal"));
ClocheFertilizerBuilder.builder(1.25f)
.build(out, toRL("fertilizer/bonemeal"));
//Quad-nutrient fertilizers:
//Industrial Fertilizer: Nitrogen, Phosphorous, Sulfur, Calcium
ClocheFertilizerBuilder.builder(1.60f)
.addInput(Misc.FERTILIZER)
.build(out, toRL("fertilizer/fertilizer"));

Expand Down Expand Up @@ -3455,10 +3472,14 @@ private void recipesMisc(@Nonnull Consumer<FinishedRecipe> out)
.define('W', ItemTags.WOOL)
.unlockedBy("has_iron_rod", has(IETags.ironRod))
.save(out, toRL(toPath(Misc.EARMUFFS)));
shapelessMisc(Misc.FERTILIZER)
shapelessMisc(Misc.FERTILIZER, 3)
.requires(IETags.saltpeterDust)
.requires(IETags.slag)
.requires(IETags.sulfurDust)
.requires(new IngredientFluidStack(FluidTags.WATER, FluidType.BUCKET_VOLUME))
.unlockedBy("has_saltpeter", has(IETags.saltpeterDust))
.unlockedBy("has_sulfur", has(IETags.sulfurDust))
.unlockedBy("has_slag", has(IETags.slag))
.save(out, toRL(toPath(Misc.FERTILIZER)));

shapedMisc(MetalDecoration.LANTERN)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public float getGuiProgress()
ClocheRecipe recipe = cachedRecipe.get();
if(recipe==null)
return 0;
return Mth.clamp(renderGrowth/recipe.getTime(seed, soil), 0, 1);
return Mth.clamp(growth/recipe.getTime(seed, soil), 0, 1);
}

protected void sendSyncPacket()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import blusunrize.immersiveengineering.common.util.compat.jei.blastfurnace.BlastFurnaceFuelCategory;
import blusunrize.immersiveengineering.common.util.compat.jei.blastfurnace.BlastFurnaceRecipeCategory;
import blusunrize.immersiveengineering.common.util.compat.jei.bottlingmachine.BottlingMachineRecipeCategory;
import blusunrize.immersiveengineering.common.util.compat.jei.cloche.ClocheFertilizerCategory;
import blusunrize.immersiveengineering.common.util.compat.jei.cloche.ClocheRecipeCategory;
import blusunrize.immersiveengineering.common.util.compat.jei.cokeoven.CokeOvenRecipeCategory;
import blusunrize.immersiveengineering.common.util.compat.jei.crusher.CrusherRecipeCategory;
Expand Down Expand Up @@ -113,6 +114,7 @@ public void registerCategories(IRecipeCategoryRegistration registry)
new BlastFurnaceRecipeCategory(guiHelper),
new BlastFurnaceFuelCategory(guiHelper),
new ClocheRecipeCategory(guiHelper),
new ClocheFertilizerCategory(guiHelper),
new MetalPressRecipeCategory(guiHelper),
new CrusherRecipeCategory(guiHelper),
new SawmillRecipeCategory(guiHelper),
Expand All @@ -138,6 +140,7 @@ public void registerRecipes(IRecipeRegistration registration)
registration.addRecipes(JEIRecipeTypes.BLAST_FURNACE, getRecipes(BlastFurnaceRecipe.RECIPES));
registration.addRecipes(JEIRecipeTypes.BLAST_FUEL, getRecipes(BlastFurnaceFuel.RECIPES));
registration.addRecipes(JEIRecipeTypes.CLOCHE, getRecipes(ClocheRecipe.RECIPES));
registration.addRecipes(JEIRecipeTypes.CLOCHE_FERTILIZER, getRecipes(ClocheFertilizer.RECIPES));
registration.addRecipes(JEIRecipeTypes.METAL_PRESS, getFiltered(MetalPressRecipe.STANDARD_RECIPES, IJEIRecipe::listInJEI));
registration.addRecipes(JEIRecipeTypes.CRUSHER, getFiltered(CrusherRecipe.RECIPES, IJEIRecipe::listInJEI));
registration.addRecipes(JEIRecipeTypes.SAWMILL, getFiltered(SawmillRecipe.RECIPES, IJEIRecipe::listInJEI));
Expand Down Expand Up @@ -184,6 +187,7 @@ public void registerRecipeCatalysts(IRecipeCatalystRegistration registration)
registration.addRecipeCatalyst(IEMultiblockLogic.ADV_BLAST_FURNACE.iconStack(), JEIRecipeTypes.BLAST_FURNACE, JEIRecipeTypes.BLAST_FUEL);
registration.addRecipeCatalyst(IEMultiblockLogic.BLAST_FURNACE.iconStack(), JEIRecipeTypes.BLAST_FURNACE, JEIRecipeTypes.BLAST_FUEL);
registration.addRecipeCatalyst(new ItemStack(MetalDevices.CLOCHE), JEIRecipeTypes.CLOCHE);
registration.addRecipeCatalyst(new ItemStack(MetalDevices.CLOCHE), JEIRecipeTypes.CLOCHE_FERTILIZER);
registration.addRecipeCatalyst(IEMultiblockLogic.METAL_PRESS.iconStack(), JEIRecipeTypes.METAL_PRESS);
registration.addRecipeCatalyst(IEMultiblockLogic.CRUSHER.iconStack(), JEIRecipeTypes.CRUSHER);
registration.addRecipeCatalyst(IEMultiblockLogic.SAWMILL.iconStack(), JEIRecipeTypes.SAWMILL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class JEIRecipeTypes
public static final RecipeType<BlueprintCraftingRecipe> BLUEPRINT = create(IERecipeTypes.BLUEPRINT);
public static final RecipeType<BottlingMachineRecipe> BOTTLING_MACHINE = create(IERecipeTypes.BOTTLING_MACHINE);
public static final RecipeType<ClocheRecipe> CLOCHE = create(IERecipeTypes.CLOCHE);
public static final RecipeType<ClocheFertilizer> CLOCHE_FERTILIZER = create(IERecipeTypes.FERTILIZER);
public static final RecipeType<CokeOvenRecipe> COKE_OVEN = create(IERecipeTypes.COKE_OVEN);
public static final RecipeType<CrusherRecipe> CRUSHER = create(IERecipeTypes.CRUSHER);
public static final RecipeType<FermenterRecipe> FERMENTER = create(IERecipeTypes.FERMENTER);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* BluSunrize
* Copyright (c) 2020
*
* This code is licensed under "Blu's License of Common Sense"
* Details can be found in the license file in the root folder of this project
*/

package blusunrize.immersiveengineering.common.util.compat.jei.cloche;

import blusunrize.immersiveengineering.api.crafting.ClocheFertilizer;
import blusunrize.immersiveengineering.client.ClientUtils;
import blusunrize.immersiveengineering.common.register.IEBlocks;
import blusunrize.immersiveengineering.common.util.Utils;
import blusunrize.immersiveengineering.common.util.compat.jei.IERecipeCategory;
import blusunrize.immersiveengineering.common.util.compat.jei.JEIHelper;
import blusunrize.immersiveengineering.common.util.compat.jei.JEIRecipeTypes;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.resources.language.I18n;
import net.minecraft.world.item.ItemStack;

public class ClocheFertilizerCategory extends IERecipeCategory<ClocheFertilizer>
{
public ClocheFertilizerCategory(IGuiHelper helper)
{
super(helper, JEIRecipeTypes.CLOCHE_FERTILIZER, "desc.immersiveengineering.jei.category.fertilizer");
setBackground(helper.createBlankDrawable(150, 50));
setIcon(new ItemStack(IEBlocks.MetalDevices.CLOCHE));
}

@Override
public void setRecipe(IRecipeLayoutBuilder builder, ClocheFertilizer recipe, IFocusGroup focuses)
{
builder.addSlot(RecipeIngredientRole.INPUT, 33, 13)
.addItemStack(recipe.input.getItems()[0])
.setBackground(JEIHelper.slotDrawable, -1, -1);
}

@Override
public void draw(ClocheFertilizer recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY)
{
graphics.pose().pushPose();
graphics.pose().scale(3, 3, 1);
this.getIcon().draw(graphics, -2, 0);
graphics.pose().popPose();
String growthModifier = I18n.get("desc.immersiveengineering.jei.cloche_modifier", Utils.formatDouble(recipe.growthModifier, "#.##"));
graphics.drawString(ClientUtils.font(), growthModifier, 53, 17, 0x777777, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,82 @@

package blusunrize.immersiveengineering.common.util.compat.jei.cloche;

import blusunrize.immersiveengineering.api.Lib;
import blusunrize.immersiveengineering.api.crafting.ClocheFertilizer;
import blusunrize.immersiveengineering.api.crafting.ClocheRecipe;
import blusunrize.immersiveengineering.common.register.IEBlocks;
import blusunrize.immersiveengineering.common.util.compat.jei.IERecipeCategory;
import blusunrize.immersiveengineering.common.util.compat.jei.JEIHelper;
import blusunrize.immersiveengineering.common.util.compat.jei.JEIRecipeTypes;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.forge.ForgeTypes;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.drawable.IDrawableAnimated;
import mezz.jei.api.gui.drawable.IDrawableStatic;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.IIngredientType;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.fluids.FluidStack;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.stream.Collectors;

public class ClocheRecipeCategory extends IERecipeCategory<ClocheRecipe>
{
private final IDrawableStatic tankOverlay;
private final IDrawableAnimated arrow;

public ClocheRecipeCategory(IGuiHelper helper)
{
super(helper, JEIRecipeTypes.CLOCHE, "block.immersiveengineering.cloche");
setBackground(helper.createBlankDrawable(100, 50));
ResourceLocation background = new ResourceLocation(Lib.MODID, "textures/gui/cloche.png");
setBackground(helper.createDrawable(background, 0, 0, 176, 77));
setIcon(new ItemStack(IEBlocks.MetalDevices.CLOCHE));
tankOverlay = helper.createDrawable(background, 176, 30, 20, 51);
arrow = helper.drawableBuilder(background, 181, 1, 13, 13).buildAnimated(200, IDrawableAnimated.StartDirection.LEFT, false);
}

@Override
public void setRecipe(IRecipeLayoutBuilder builder, ClocheRecipe recipe, IFocusGroup focuses)
{
builder.addSlot(RecipeIngredientRole.INPUT, 5, 7)
.addItemStacks(Arrays.asList(recipe.seed.getItems()))
.setBackground(JEIHelper.slotDrawable, -1, -1);
builder.addSlot(RecipeIngredientRole.INPUT, 62, 34)
.addItemStacks(Arrays.asList(recipe.seed.getItems()));

builder.addSlot(RecipeIngredientRole.INPUT, 5, 31)
.addItemStacks(Arrays.asList(recipe.soil.getItems()))
.setBackground(JEIHelper.slotDrawable, -1, -1);
builder.addSlot(RecipeIngredientRole.INPUT, 62, 54)
.addItemStacks(Arrays.asList(recipe.soil.getItems()));

for(int i = 0; i < recipe.outputs.size(); i++)
builder.addSlot(RecipeIngredientRole.OUTPUT, 65+i%2*18, 13+i/2*18)
.addItemStack(recipe.outputs.get(i).get())
.setBackground(JEIHelper.slotDrawable, -1, -1);
builder.addSlot(RecipeIngredientRole.OUTPUT, 116+i%2*18, 34+i/2*18)
.addItemStack(recipe.outputs.get(i).get());

builder.addSlot(RecipeIngredientRole.INPUT, 6, 6)
.setFluidRenderer(4000, false, 20, 51)
.setOverlay(tankOverlay, 0, 0)
.addIngredient(ForgeTypes.FLUID_STACK, new FluidStack(Fluids.WATER, 4000))
.addTooltipCallback(JEIHelper.fluidTooltipCallback);

// TODO: Fix this to not be this unperformant and just bad, if there is a better way to do it
ArrayList<ItemStack> fertilizers = new ArrayList<>(Collections.singleton(ItemStack.EMPTY));
for(ClocheFertilizer fertilizerList : ClocheFertilizer.RECIPES.getRecipes(Minecraft.getInstance().level))
fertilizers.addAll(Arrays.stream(fertilizerList.input.getItems()).toList());

builder.addSlot(RecipeIngredientRole.INPUT, 8, 59)
.addItemStacks(fertilizers);
}

@Override
public void draw(ClocheRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY)
{
graphics.pose().pushPose();
graphics.pose().scale(3, 3, 1);
this.getIcon().draw(graphics, 7, 0);
graphics.pose().popPose();
arrow.draw(graphics, 101, 35);
}
}
Loading

0 comments on commit 30e0a42

Please sign in to comment.