Skip to content

Add the HeatCondition API to allow the creation of alternate heating types under basins #8654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: mc1.20.1/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2025-07-15T20:09:04.342419795 Registrate Provider for create [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), generic_server_provider, Blockstates, Item models, Lang (en_us/en_ud), generic_client_provider]
// 1.20.1 2025-06-10T19:27:13.538878 Registrate Provider for create [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
60bbdf92d2ac9824ea6144955c74043a6005f79d assets/create/blockstates/acacia_window.json
6a67703c2697d81b7dc83e9d72a66f9c9ff08383 assets/create/blockstates/acacia_window_pane.json
c3ae87b62e81d8e9476eccd793bb1548d74c66a1 assets/create/blockstates/adjustable_chain_gearshift.json
Expand Down Expand Up @@ -4702,7 +4702,7 @@ f675c20350ed60da4878b5d6301f02c8c05624bd data/create/tags/blocks/fan_processing_
a5874f73c7dc0a3ae12999e6ae8abf45bc7fb9be data/create/tags/blocks/passive_boiler_heaters.json
f400870b8dbcd14238be3ec99c419093073ba3a6 data/create/tags/blocks/postboxes.json
9bc8c13fd80bdbe7f767b91ee1a1042e9aff02b0 data/create/tags/blocks/roots.json
575c7b20bcd6d698c5961aa3db0ac7d206b3dbd2 data/create/tags/blocks/safe_nbt.json
55dccb895bbdacfbd6ee9005486cd3fe9df01249 data/create/tags/blocks/safe_nbt.json
79418bd729cef417b322cef9b491e7ae83317d61 data/create/tags/blocks/seats.json
7d783d948cc49503fb645045fe9ef48906b74341 data/create/tags/blocks/simple_mounted_storage.json
da544bd0281138617f5cd6b2a04920ccf7034d4b data/create/tags/blocks/single_block_inventories.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2025-07-15T20:09:04.337197893 Create's Processing Recipes
// 1.20.1 2025-06-10T19:33:57.719451 Create's Processing Recipes
3c94326fb730f68c1e44fe1e2ef09c9db6ffd92b data/create/recipes/compacting/andesite_from_flint.json
8d3d5b31f3601b9f681ff710e0545a483a1494c6 data/create/recipes/compacting/blaze_cake.json
8bd7f4e3a686ab520b2d55594d2018d0e9a50c91 data/create/recipes/compacting/chocolate.json
Expand Down Expand Up @@ -545,9 +545,7 @@ dd92906041688b897fe8259eb63ab5a26fb790c4 data/create/recipes/milling/lily_of_the
fc6f30a97d0d9da10ae70547f2b1cf59ed1345a2 data/create/recipes/milling/orange_tulip.json
f788ef9822a5884afe3ac6db187bddd86b0d5d89 data/create/recipes/milling/oxeye_daisy.json
ce353a1083c769d5984cf2c9f6b70132a19c4a2f data/create/recipes/milling/peony.json
11ebb5df7e28755767002d8b45dba047f91c1775 data/create/recipes/milling/pink_petals.json
a654ff381c572da2b860b20e53f017f59828e4d9 data/create/recipes/milling/pink_tulip.json
01b6ed50f5928fbd9b2c90f9a656af3c3d88c923 data/create/recipes/milling/pitcher_plant.json
9fb8da4cf864ebd5d32acf3048153afc778bd5f9 data/create/recipes/milling/poppy.json
7af146a5537a561343938d9377e8ee5a92fbd587 data/create/recipes/milling/red_tulip.json
a816354b8323dad95e552ff959b5101b65be8742 data/create/recipes/milling/rose_bush.json
Expand All @@ -558,25 +556,24 @@ f4f8d3d7e14580c5926b325b04db9cc9c0ab76bd data/create/recipes/milling/sandstone.j
b9f76af7f58d3e9b0689795dcad4c72be7f75211 data/create/recipes/milling/sunflower.json
1c4d6364e5b3f2dd361756f481615088d5cf8331 data/create/recipes/milling/tall_grass.json
c5846a4c7ccbe7b4bf6251f7ee11f3899c8926d2 data/create/recipes/milling/terracotta.json
3db3005e676a57a4e9b91c9e34e4488829fd2d66 data/create/recipes/milling/torchflower.json
67ad673d1f7b6000b8b2c88d8205210c8a563f68 data/create/recipes/milling/wheat.json
a91dae829938d3f69a7007d3cf8db02b70fe3a7f data/create/recipes/milling/white_tulip.json
023ab0c2abaf87295fb7c3fbe841a09c519b74f7 data/create/recipes/milling/wither_rose.json
74bb289e20e891112f4964761eb76c3ce4d3c8cd data/create/recipes/milling/wool.json
5f1b8a82af091cd4589ecfa5c13a4db6ad9c51b9 data/create/recipes/mixing/andesite_alloy.json
48604c2205b18fe1401eac58d14aa1677cbd9c2b data/create/recipes/mixing/andesite_alloy_from_zinc.json
d06c1d0362dccc4e5f8b22f851dc8316b35c06b0 data/create/recipes/mixing/brass_ingot.json
e02c9e5eb3e915a20ce9fac61f55e9146e98a0f0 data/create/recipes/mixing/brass_ingot.json
84a789f57691cb1e515f98cb162d7eda416eae7a data/create/recipes/mixing/cardboard_pulp.json
840a9008d4531425beadfcf224d21e938acc4502 data/create/recipes/mixing/chocolate.json
e7b86d4ca5de2df474794424d93b447e5f9dcdc3 data/create/recipes/mixing/chocolate_melting.json
a81c1955899569ccf4691977c3b660153b74e20b data/create/recipes/mixing/chocolate.json
4902bc0410366fbba41e75fc1585a6dd69b176f8 data/create/recipes/mixing/chocolate_melting.json
39e832016fa5e360434271505d09ced17a40e7eb data/create/recipes/mixing/compat/ae2/fluix_crystal.json
f0648e6b963e1ac1c1756f769988e779963eb1a1 data/create/recipes/mixing/compat/regions_unexplored/peat_mud.json
a2cf143f409a26709ad119f151c611331dca960c data/create/recipes/mixing/compat/regions_unexplored/silt_mud.json
4cf9a0979fb6401c51c763d71f0bb53ea2c8c32b data/create/recipes/mixing/dough_by_mixing.json
ac2a2456e2f0ccd74db6dc5ad029eb4e6781a25d data/create/recipes/mixing/honey.json
251c09ac25bb73e092fac483ceb5a9196a479919 data/create/recipes/mixing/lava_from_cobble.json
589a0fccb25f16c4a26bd3c77a8d225500cafdd0 data/create/recipes/mixing/honey.json
7ff78a2644738fecdea7b238cadeacb748321388 data/create/recipes/mixing/lava_from_cobble.json
939c55202f06b50cec3c16e66e85f915f2272db2 data/create/recipes/mixing/mud_by_mixing.json
4454cb7a73571d90e19826ee394b0c9e52ac8620 data/create/recipes/mixing/tea.json
7ae0e4d9b533bacc38f2b5bf84bb93a64108cf34 data/create/recipes/mixing/tea.json
77de88a8d25b974a63a5d132dd5461523e798fe2 data/create/recipes/pressing/aether_dirt_path.json
92a1198c990660458565ca871520b7c32fb0e24b data/create/recipes/pressing/aether_dirt_path_from_grass.json
8bd950c78b4db3b7f5a9a1f42c116677049b77fc data/create/recipes/pressing/brass_ingot.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "create:mixing",
"heatRequirement": "heated",
"heatRequirement": "create:heated",
"ingredients": [
{
"tag": "forge:ingots/copper"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "create:mixing",
"heatRequirement": "heated",
"heatRequirement": "create:heated",
"ingredients": [
{
"item": "minecraft:sugar"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "create:mixing",
"heatRequirement": "heated",
"heatRequirement": "create:heated",
"ingredients": [
{
"item": "create:bar_of_chocolate"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "create:mixing",
"heatRequirement": "heated",
"heatRequirement": "create:heated",
"ingredients": [
{
"item": "minecraft:honey_block"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "create:mixing",
"heatRequirement": "superheated",
"heatRequirement": "create:superheated",
"ingredients": [
{
"tag": "forge:cobblestone"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "create:mixing",
"heatRequirement": "heated",
"heatRequirement": "create:heated",
"ingredients": [
{
"tag": "minecraft:leaves"
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/simibubi/create/Create.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.Random;

import com.simibubi.create.content.processing.recipe.AllHeatConditions;

import org.slf4j.Logger;

import com.google.gson.Gson;
Expand Down Expand Up @@ -199,6 +201,7 @@ public static void onRegister(final RegisterEvent event) {
AllPotatoProjectileRenderModes.init();
AllPotatoProjectileEntityHitActions.init();
AllPotatoProjectileBlockHitActions.init();
AllHeatConditions.init();
}

public static LangBuilder lang() {
Expand Down
67 changes: 67 additions & 0 deletions src/main/java/com/simibubi/create/api/recipe/HeatCondition.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.simibubi.create.api.recipe;

import com.simibubi.create.api.registry.CreateBuiltInRegistries;

import mezz.jei.api.gui.drawable.IDrawable;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack;

import net.minecraft.world.level.Level;

import org.jetbrains.annotations.ApiStatus.Internal;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
* A HeatCondition is a recipe condition such as the requirement of being heated or superheated.
* This is demonstrated with the Blaze Burner.
* <p></p>
* This interface provides integration with JEI through {@link #visualize()},
* {@link #getItemHints()}, and {@link #getColor()}.
*/
public interface HeatCondition {
/**
* Tests the HeatCondition's criteria against a position.
* @param level The level in which the test is located in.
* @param testPos The position of the block entity to be heated (e.g. a Basin)
* @return Whether the HeatCondition is valid for this position.
*/
boolean test(Level level, BlockPos testPos);

/**
* @return The HeatingCondition's translation key.
*/
String getTranslationKey();

/**
* Gets the IDrawable responsible for rendering this HeatCondition in JEI.
* If it is null, then it should not be rendered.
* @see IDrawable
*/
@Nullable
default IDrawable visualize() {
return null;
}

/**
* Provides items associated with this HeatCondition (e.g. a Blaze Burner)
*/
@NotNull
default List<ItemStack> getItemHints() {
return List.of();
}

/**
* The color of the HeatCondition when shown in JEI.
*/
default int getColor() {
return 0xffffff;
}

@Internal
default int ordinal() {
return CreateBuiltInRegistries.HEAT_CONDITION.getId(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.simibubi.create.api.registry;

import com.simibubi.create.api.recipe.HeatCondition;

import org.jetbrains.annotations.ApiStatus;

import com.mojang.serialization.Codec;
Expand Down Expand Up @@ -41,6 +43,7 @@ public class CreateBuiltInRegistries {
public static final Registry<Codec<? extends PotatoProjectileRenderMode>> POTATO_PROJECTILE_RENDER_MODE = simple(CreateRegistries.POTATO_PROJECTILE_RENDER_MODE);
public static final Registry<Codec<? extends PotatoProjectileEntityHitAction>> POTATO_PROJECTILE_ENTITY_HIT_ACTION = simple(CreateRegistries.POTATO_PROJECTILE_ENTITY_HIT_ACTION);
public static final Registry<Codec<? extends PotatoProjectileBlockHitAction>> POTATO_PROJECTILE_BLOCK_HIT_ACTION = simple(CreateRegistries.POTATO_PROJECTILE_BLOCK_HIT_ACTION);
public static final Registry<HeatCondition> HEAT_CONDITION = simple(CreateRegistries.HEAT_CONDITION);

private static <T> Registry<T> simple(ResourceKey<Registry<T>> key) {
return register(key, new MappedRegistry<>(key, Lifecycle.stable(), false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import com.simibubi.create.content.kinetics.mechanicalArm.ArmInteractionPointType;
import com.simibubi.create.content.logistics.item.filter.attribute.ItemAttributeType;

import com.simibubi.create.api.recipe.HeatCondition;

import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;

Expand All @@ -36,6 +38,7 @@ public class CreateRegistries {
public static final ResourceKey<Registry<Codec<? extends PotatoProjectileRenderMode>>> POTATO_PROJECTILE_RENDER_MODE = key("potato_projectile/render_mode");
public static final ResourceKey<Registry<Codec<? extends PotatoProjectileEntityHitAction>>> POTATO_PROJECTILE_ENTITY_HIT_ACTION = key("potato_projectile/entity_hit_action");
public static final ResourceKey<Registry<Codec<? extends PotatoProjectileBlockHitAction>>> POTATO_PROJECTILE_BLOCK_HIT_ACTION = key("potato_projectile/block_hit_action");
public static final ResourceKey<Registry<HeatCondition>> HEAT_CONDITION = key("heat_condition");

private static <T> ResourceKey<Registry<T>> key(String name) {
return ResourceKey.createRegistryKey(Create.asResource(name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@

import javax.annotation.ParametersAreNonnullByDefault;

import com.simibubi.create.api.recipe.HeatCondition;

import net.minecraft.network.chat.Component;

import org.apache.commons.lang3.mutable.MutableInt;

import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.processing.basin.BasinRecipe;
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock.HeatLevel;
import com.simibubi.create.content.processing.recipe.HeatCondition;
import com.simibubi.create.content.processing.recipe.ProcessingOutput;
import com.simibubi.create.foundation.fluid.FluidIngredient;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.utility.CreateLang;

import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
Expand Down Expand Up @@ -91,24 +90,21 @@ public void setRecipe(IRecipeLayoutBuilder builder, BasinRecipe recipe, IFocusGr
i++;
}

HeatCondition requiredHeat = recipe.getRequiredHeat();
if (!requiredHeat.testBlazeBurner(HeatLevel.NONE)) {
builder
.addSlot(RecipeIngredientRole.RENDER_ONLY, 134, 81)
.addItemStack(AllBlocks.BLAZE_BURNER.asStack());
}
if (!requiredHeat.testBlazeBurner(HeatLevel.KINDLED)) {
builder
.addSlot(RecipeIngredientRole.CATALYST, 153, 81)
.addItemStack(AllItems.BLAZE_CAKE.asStack());
HeatCondition heatCondition = recipe.getRequiredHeat();
if (heatCondition == null) return;

List<ItemStack> itemHints = heatCondition.getItemHints();
for (int j = 0; j < itemHints.size(); j++) {
builder.addSlot(RecipeIngredientRole.RENDER_ONLY, 134 + (j*20), 81)
.addItemStack(itemHints.get(j));
}
}

@Override
public void draw(BasinRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) {
HeatCondition requiredHeat = recipe.getRequiredHeat();
HeatCondition heatCondition = recipe.getRequiredHeat();

boolean noHeat = requiredHeat == HeatCondition.NONE;
boolean noHeat = heatCondition == null;

int vRows = (1 + recipe.getFluidResults().size() + recipe.getRollableResults().size()) / 2;

Expand All @@ -123,8 +119,14 @@ public void draw(BasinRecipe recipe, IRecipeSlotsView recipeSlotsView, GuiGraphi

AllGuiTextures heatBar = noHeat ? AllGuiTextures.JEI_NO_HEAT_BAR : AllGuiTextures.JEI_HEAT_BAR;
heatBar.render(graphics, 4, 80);
graphics.drawString(Minecraft.getInstance().font, CreateLang.translateDirect(requiredHeat.getTranslationKey()), 9,
86, requiredHeat.getColor(), false);

if (noHeat) {
graphics.drawString(Minecraft.getInstance().font, Component.translatable("create.recipe.heat_requirement.none"), 9,
86, 0xffffff, false);
} else {
graphics.drawString(Minecraft.getInstance().font, Component.translatable(heatCondition.getTranslationKey()), 9,
86, heatCondition.getColor(), false);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.simibubi.create.compat.jei.category;

import com.simibubi.create.compat.jei.category.animations.AnimatedBlazeBurner;
import com.simibubi.create.compat.jei.category.animations.AnimatedMixer;
import com.simibubi.create.content.processing.basin.BasinRecipe;
import com.simibubi.create.content.processing.recipe.HeatCondition;
import com.simibubi.create.api.recipe.HeatCondition;

import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import net.minecraft.client.gui.GuiGraphics;

Expand All @@ -13,7 +14,6 @@
public class MixingCategory extends BasinCategory {

private final AnimatedMixer mixer = new AnimatedMixer();
private final AnimatedBlazeBurner heater = new AnimatedBlazeBurner();
MixingType type;

enum MixingType {
Expand Down Expand Up @@ -41,10 +41,12 @@ protected MixingCategory(Info<BasinRecipe> info, MixingType type) {
public void draw(BasinRecipe recipe, IRecipeSlotsView iRecipeSlotsView, GuiGraphics graphics, double mouseX, double mouseY) {
super.draw(recipe, iRecipeSlotsView, graphics, mouseX, mouseY);

HeatCondition requiredHeat = recipe.getRequiredHeat();
if (requiredHeat != HeatCondition.NONE)
heater.withHeat(requiredHeat.visualizeAsBlazeBurner())
.draw(graphics, getBackground().getWidth() / 2 + 3, 55);
HeatCondition heatCondition = recipe.getRequiredHeat();
if (heatCondition != null) {
IDrawable drawable = heatCondition.visualize();
if (drawable != null)
drawable.draw(graphics, getBackground().getWidth() / 2 + 3, 55);
}
mixer.draw(graphics, getBackground().getWidth() / 2 + 3, 34);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.simibubi.create.compat.jei.category;

import com.simibubi.create.compat.jei.category.animations.AnimatedBlazeBurner;
import com.simibubi.create.compat.jei.category.animations.AnimatedPress;
import com.simibubi.create.content.processing.basin.BasinRecipe;
import com.simibubi.create.content.processing.recipe.HeatCondition;
import com.simibubi.create.api.recipe.HeatCondition;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
Expand All @@ -19,7 +19,6 @@
public class PackingCategory extends BasinCategory {

private final AnimatedPress press = new AnimatedPress(true);
private final AnimatedBlazeBurner heater = new AnimatedBlazeBurner();
private final PackingType type;

enum PackingType {
Expand Down Expand Up @@ -76,10 +75,12 @@ public void draw(BasinRecipe recipe, IRecipeSlotsView iRecipeSlotsView, GuiGraph
}


HeatCondition requiredHeat = recipe.getRequiredHeat();
if (requiredHeat != HeatCondition.NONE)
heater.withHeat(requiredHeat.visualizeAsBlazeBurner())
.draw(graphics, getBackground().getWidth() / 2 + 3, 55);
HeatCondition heatCondition = recipe.getRequiredHeat();
if (heatCondition != null) {
IDrawable drawable = heatCondition.visualize();
if (drawable != null)
drawable.draw(graphics, getBackground().getWidth() / 2 + 3, 55);
}
press.draw(graphics, getBackground().getWidth() / 2 + 3, 34);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.simibubi.create.Create;
import com.simibubi.create.content.fluids.potion.PotionFluid.BottleType;
import com.simibubi.create.content.kinetics.mixer.MixingRecipe;
import com.simibubi.create.content.processing.recipe.HeatCondition;
import com.simibubi.create.content.processing.recipe.BlazeBurnerHeatCondition;
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder;
import com.simibubi.create.foundation.fluid.FluidIngredient;

Expand Down Expand Up @@ -122,7 +122,7 @@ private static MixingRecipe createRecipe(String id, Ingredient ingredient, Fluid
Create.asResource(id)).require(ingredient)
.require(FluidIngredient.fromFluidStack(fromFluid))
.output(toFluid)
.requiresHeat(HeatCondition.HEATED)
.requiresHeat(BlazeBurnerHeatCondition.HEATED)
.build();
}

Expand Down
Loading