JEI building, Gradle building

- Refactor JEI category building
- Fix placard item requirement not checking NBT
- Use AddPackFindersEvent instead of ShippedResourcePacks
- Remove unused config values
- Provide separate resource and data formats in pack.mcmeta
- Compress all images
- Update to latest Flywheel
- Disable jarJar inclusion of Flywheel
- Use ${file.jarVersion} instead of ${version}
- Add workaround for SpongePowered/MixinGradle#38
This commit is contained in:
PepperCode1 2022-07-16 01:58:43 -07:00
parent 4c45333687
commit 82be76d893
836 changed files with 534 additions and 487 deletions

View file

@ -133,19 +133,20 @@ repositories {
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
jarJar(group: 'com.tterrag.registrate', name: 'Registrate', version: '[MC1.18.2-1.1.3]') {
jarJar(group: 'com.tterrag.registrate', name: 'Registrate', version: '[MC1.18.2-1.1.3,)') {
jarJar.pin(it, project.registrate_version)
}
jarJar(group: 'com.jozufozu.flywheel', name: 'Flywheel-Forge', version: '[1.18-0.6.4,1.18-0.6.5)') {
jarJar.pin(it, project.flywheel_version)
}
// Uncomment once Forge fixes mixins for included jars
//jarJar(group: 'com.jozufozu.flywheel', name: "flywheel-forge-${flywheel_minecraft_version}", version: '[0.6.4,0.6.5)') {
// jarJar.pin(it, project.flywheel_version)
//}
implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")
if (inWorkspace) {
implementation project(':Flywheel')
} else {
implementation fg.deobf("com.jozufozu.flywheel:Flywheel-Forge:${flywheel_version}")
implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}")
}
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api")
@ -169,14 +170,6 @@ dependencies {
}
}
processResources {
inputs.property 'version', mod_version
filesMatching('META-INF/mods.toml') {
expand 'version': mod_version
}
}
sourceSets.main.resources {
srcDir 'src/generated/resources'
exclude '.cache/'
@ -186,6 +179,12 @@ mixin {
add sourceSets.main, 'create.refmap.json'
}
// Workaround for SpongePowered/MixinGradle#38
afterEvaluate {
tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava)
tasks.configureReobfTaskForReobfJarJar.mustRunAfter(tasks.compileJava)
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
@ -201,7 +200,7 @@ jar {
'Specification-Title': 'create',
'Specification-Vendor': 'simibubi',
'Specification-Version': '1',
'Implementation-Title': project.name,
'Implementation-Title': project.jar.baseName,
'Implementation-Version': project.jar.archiveVersion,
'Implementation-Vendor': 'simibubi',
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
@ -233,6 +232,7 @@ publishing {
artifactId = archivesBaseName
from components.java
fg.component(it)
jarJar.component(it)
}
}

View file

@ -20,9 +20,10 @@ parchment_version = 2022.07.10
# dependency versions
registrate_version = MC1.18.2-1.1.3
flywheel_version = 1.18-0.6.4.86
flywheel_minecraft_version = 1.18.2
flywheel_version = 0.6.4-90
jei_minecraft_version = 1.18.2
jei_version = 9.5.3.143
jei_version = 9.7.0.209
curios_minecraft_version = 1.18.2
curios_version = 5.0.7.0

View file

@ -27,7 +27,6 @@ import com.simibubi.create.foundation.render.CachedBufferer;
import com.simibubi.create.foundation.render.CreateContexts;
import com.simibubi.create.foundation.render.SuperByteBufferCache;
import com.simibubi.create.foundation.utility.ModelSwapper;
import com.simibubi.create.foundation.utility.ShippedResourcePacks;
import com.simibubi.create.foundation.utility.ghost.GhostBlocks;
import com.simibubi.create.foundation.utility.outliner.Outliner;
@ -85,8 +84,6 @@ public class CreateClient {
BUFFER_CACHE.registerCompartment(SBBContraptionManager.CONTRAPTION, 20);
BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
ShippedResourcePacks.extractFiles("Copper Legacy Pack");
AllKeys.register();
// AllFluids.assignRenderLayers();
AllBlockPartials.init();

View file

@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
@ -40,14 +41,24 @@ import com.simibubi.create.compat.jei.category.SawingCategory;
import com.simibubi.create.compat.jei.category.SequencedAssemblyCategory;
import com.simibubi.create.compat.jei.category.SpoutCategory;
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCraftingRecipe;
import com.simibubi.create.content.contraptions.components.crusher.AbstractCrushingRecipe;
import com.simibubi.create.content.contraptions.components.deployer.DeployerApplicationRecipe;
import com.simibubi.create.content.contraptions.components.deployer.ManualApplicationRecipe;
import com.simibubi.create.content.contraptions.components.fan.HauntingRecipe;
import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe;
import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity;
import com.simibubi.create.content.contraptions.components.press.PressingRecipe;
import com.simibubi.create.content.contraptions.components.saw.CuttingRecipe;
import com.simibubi.create.content.contraptions.components.saw.SawTileEntity;
import com.simibubi.create.content.contraptions.fluids.actors.FillingRecipe;
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluid;
import com.simibubi.create.content.contraptions.fluids.recipe.PotionMixingRecipes;
import com.simibubi.create.content.contraptions.itemAssembly.SequencedAssemblyRecipe;
import com.simibubi.create.content.contraptions.processing.BasinRecipe;
import com.simibubi.create.content.contraptions.processing.EmptyingRecipe;
import com.simibubi.create.content.contraptions.processing.ItemApplicationRecipe;
import com.simibubi.create.content.curiosities.tools.BlueprintScreen;
import com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe;
import com.simibubi.create.content.logistics.item.LinkedControllerScreen;
import com.simibubi.create.content.logistics.item.filter.AbstractFilterScreen;
import com.simibubi.create.content.logistics.trains.management.schedule.ScheduleScreen;
@ -56,11 +67,14 @@ import com.simibubi.create.foundation.config.CRecipes;
import com.simibubi.create.foundation.config.ConfigBase.ConfigBool;
import com.simibubi.create.foundation.data.recipe.LogStrippingFakeRecipes;
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.JeiPlugin;
import mezz.jei.api.constants.RecipeTypes;
import mezz.jei.api.forge.ForgeTypes;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.recipe.category.IRecipeCategory;
import mezz.jei.api.registration.IGuiHandlerRegistration;
import mezz.jei.api.registration.IRecipeCatalystRegistration;
@ -73,10 +87,13 @@ import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
import net.minecraft.world.item.crafting.CraftingRecipe;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.crafting.SmokingRecipe;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.common.crafting.IShapedRecipe;
import net.minecraftforge.fml.ModList;
@ -87,161 +104,217 @@ public class CreateJEI implements IModPlugin {
private static final ResourceLocation ID = Create.asResource("jei_plugin");
public IIngredientManager ingredientManager;
private final List<CreateRecipeCategory<?>> allCategories = new ArrayList<>();
private IIngredientManager ingredientManager;
private void loadCategories() {
allCategories.clear();
CreateRecipeCategory<?>
milling = register("milling", MillingCategory::new)
.addTypedRecipes(AllRecipeTypes.MILLING)
.catalyst(AllBlocks.MILLSTONE::get)
.build(),
milling = builder(AbstractCrushingRecipe.class)
.addTypedRecipes(AllRecipeTypes.MILLING)
.catalyst(AllBlocks.MILLSTONE::get)
.doubleItemIcon(AllBlocks.MILLSTONE.get(), AllItems.WHEAT_FLOUR.get())
.emptyBackground(177, 53)
.build("milling", MillingCategory::new),
crushing = register("crushing", CrushingCategory::new)
.addTypedRecipes(AllRecipeTypes.CRUSHING)
.addTypedRecipesExcluding(AllRecipeTypes.MILLING::getType, AllRecipeTypes.CRUSHING::getType)
.catalyst(AllBlocks.CRUSHING_WHEEL::get)
.build(),
crushing = builder(AbstractCrushingRecipe.class)
.addTypedRecipes(AllRecipeTypes.CRUSHING)
.addTypedRecipesExcluding(AllRecipeTypes.MILLING::getType, AllRecipeTypes.CRUSHING::getType)
.catalyst(AllBlocks.CRUSHING_WHEEL::get)
.doubleItemIcon(AllBlocks.CRUSHING_WHEEL.get(), AllItems.CRUSHED_GOLD.get())
.emptyBackground(177, 100)
.build("crushing", CrushingCategory::new),
pressing = register("pressing", PressingCategory::new)
.addTypedRecipes(AllRecipeTypes.PRESSING)
.catalyst(AllBlocks.MECHANICAL_PRESS::get)
.build(),
pressing = builder(PressingRecipe.class)
.addTypedRecipes(AllRecipeTypes.PRESSING)
.catalyst(AllBlocks.MECHANICAL_PRESS::get)
.doubleItemIcon(AllBlocks.MECHANICAL_PRESS.get(), AllItems.IRON_SHEET.get())
.emptyBackground(177, 70)
.build("pressing", PressingCategory::new),
washing = register("fan_washing", FanWashingCategory::new)
.addTypedRecipes(AllRecipeTypes.SPLASHING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_washing"))
.build(),
washing = builder(SplashingRecipe.class)
.addTypedRecipes(AllRecipeTypes.SPLASHING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_washing"))
.doubleItemIcon(AllItems.PROPELLER.get(), Items.WATER_BUCKET)
.emptyBackground(178, 72)
.build("fan_washing", FanWashingCategory::new),
smoking = register("fan_smoking", FanSmokingCategory::new)
.addTypedRecipes(() -> RecipeType.SMOKING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_smoking"))
.build(),
smoking = builder(SmokingRecipe.class)
.addTypedRecipes(() -> RecipeType.SMOKING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_smoking"))
.doubleItemIcon(AllItems.PROPELLER.get(), Items.CAMPFIRE)
.emptyBackground(178, 72)
.build("fan_smoking", FanSmokingCategory::new),
blasting = register("fan_blasting", FanBlastingCategory::new)
.addTypedRecipesExcluding(() -> RecipeType.SMELTING, () -> RecipeType.BLASTING)
.addTypedRecipes(() -> RecipeType.BLASTING)
.removeRecipes(() -> RecipeType.SMOKING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_blasting"))
.build(),
blasting = builder(AbstractCookingRecipe.class)
.addTypedRecipesExcluding(() -> RecipeType.SMELTING, () -> RecipeType.BLASTING)
.addTypedRecipes(() -> RecipeType.BLASTING)
.removeRecipes(() -> RecipeType.SMOKING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_blasting"))
.doubleItemIcon(AllItems.PROPELLER.get(), Items.LAVA_BUCKET)
.emptyBackground(178, 72)
.build("fan_blasting", FanBlastingCategory::new),
haunting = register("fan_haunting", FanHauntingCategory::new).addTypedRecipes(AllRecipeTypes.HAUNTING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_haunting"))
.build(),
haunting = builder(HauntingRecipe.class)
.addTypedRecipes(AllRecipeTypes.HAUNTING)
.catalystStack(ProcessingViaFanCategory.getFan("fan_haunting"))
.doubleItemIcon(AllItems.PROPELLER.get(), Items.SOUL_CAMPFIRE)
.emptyBackground(178, 72)
.build("fan_haunting", FanHauntingCategory::new),
mixing = register("mixing", MixingCategory::standard).addTypedRecipes(AllRecipeTypes.MIXING)
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
.catalyst(AllBlocks.BASIN::get)
.build(),
mixing = builder(BasinRecipe.class)
.addTypedRecipes(AllRecipeTypes.MIXING)
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
.catalyst(AllBlocks.BASIN::get)
.doubleItemIcon(AllBlocks.MECHANICAL_MIXER.get(), AllBlocks.BASIN.get())
.emptyBackground(177, 103)
.build("mixing", MixingCategory::standard),
seqAssembly = register("sequenced_assembly", SequencedAssemblyCategory::new)
.addTypedRecipes(AllRecipeTypes.SEQUENCED_ASSEMBLY)
.build(),
autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless)
.addAllRecipesIf(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe<?>)
&& r.getIngredients()
.size() > 1
&& !MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.shouldIgnoreInAutomation(r),
BasinRecipe::convertShapeless)
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
.catalyst(AllBlocks.BASIN::get)
.enableWhen(c -> c.allowShapelessInMixer)
.build(),
brewing = register("automatic_brewing", MixingCategory::autoBrewing).addRecipes(() -> PotionMixingRecipes.ALL)
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
.catalyst(AllBlocks.BASIN::get)
.build(),
sawing = register("sawing", SawingCategory::new).addTypedRecipes(AllRecipeTypes.CUTTING)
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.build(),
blockCutting = register("block_cutting", () -> new BlockCuttingCategory(Items.STONE_BRICK_STAIRS))
.addRecipes(() -> CondensedBlockCuttingRecipe.condenseRecipes(getTypedRecipesExcluding(RecipeType.STONECUTTING, AllRecipeTypes::shouldIgnoreInAutomation)))
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.enableWhen(c -> c.allowStonecuttingOnSaw)
.build(),
woodCutting = register("wood_cutting", () -> new BlockCuttingCategory(Items.OAK_STAIRS))
.addRecipes(() -> CondensedBlockCuttingRecipe.condenseRecipes(getTypedRecipesExcluding(SawTileEntity.woodcuttingRecipeType.get(), AllRecipeTypes::shouldIgnoreInAutomation)))
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.enableWhenBool(c -> c.allowWoodcuttingOnSaw.get() && ModList.get()
.isLoaded("druidcraft"))
.build(),
packing = register("packing", PackingCategory::standard).addTypedRecipes(AllRecipeTypes.COMPACTING)
.catalyst(AllBlocks.MECHANICAL_PRESS::get)
.catalyst(AllBlocks.BASIN::get)
.build(),
autoSquare = register("automatic_packing", PackingCategory::autoSquare)
.addAllRecipesIf(
r -> (r instanceof CraftingRecipe) && !(r instanceof MechanicalCraftingRecipe)
&& MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.shouldIgnoreInAutomation(r),
BasinRecipe::convertShapeless)
.catalyst(AllBlocks.MECHANICAL_PRESS::get)
.catalyst(AllBlocks.BASIN::get)
.enableWhen(c -> c.allowShapedSquareInPress)
.build(),
polishing = register("sandpaper_polishing", PolishingCategory::new)
.addTypedRecipes(AllRecipeTypes.SANDPAPER_POLISHING)
.catalyst(AllItems.SAND_PAPER::get)
.catalyst(AllItems.RED_SAND_PAPER::get)
.build(),
item_application = register("item_application", ItemApplicationCategory::new)
.addTypedRecipes(AllRecipeTypes.ITEM_APPLICATION)
.addRecipes(LogStrippingFakeRecipes::createRecipes)
.build(),
deploying = register("deploying", DeployingCategory::new).addTypedRecipes(AllRecipeTypes.DEPLOYING)
.addTypedRecipes(AllRecipeTypes.SANDPAPER_POLISHING::getType, DeployerApplicationRecipe::convert)
.addTypedRecipes(AllRecipeTypes.ITEM_APPLICATION::getType, ManualApplicationRecipe::asDeploying)
.catalyst(AllBlocks.DEPLOYER::get)
.catalyst(AllBlocks.DEPOT::get)
.catalyst(AllItems.BELT_CONNECTOR::get)
.build(),
mysteryConversion = register("mystery_conversion", MysteriousItemConversionCategory::new)
.addRecipes(() -> MysteriousItemConversionCategory.RECIPES)
.build(),
spoutFilling = register("spout_filling", SpoutCategory::new).addTypedRecipes(AllRecipeTypes.FILLING)
.addRecipeListConsumer(recipes -> SpoutCategory.consumeRecipes(recipes::add, ingredientManager))
.catalyst(AllBlocks.SPOUT::get)
.build(),
draining = register("draining", ItemDrainCategory::new)
.addRecipeListConsumer(recipes -> ItemDrainCategory.consumeRecipes(recipes::add, ingredientManager))
.addTypedRecipes(AllRecipeTypes.EMPTYING)
.catalyst(AllBlocks.ITEM_DRAIN::get)
.build(),
autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new)
.addAllRecipesIf(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe<?>)
autoShapeless = builder(BasinRecipe.class)
.enableWhen(c -> c.allowShapelessInMixer)
.addAllRecipesIf(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe<?>)
&& r.getIngredients()
.size() == 1
&& !AllRecipeTypes.shouldIgnoreInAutomation(r))
.addTypedRecipesIf(() -> RecipeType.CRAFTING,
recipe -> recipe instanceof IShapedRecipe<?> && !AllRecipeTypes.shouldIgnoreInAutomation(recipe))
.catalyst(AllBlocks.MECHANICAL_CRAFTER::get)
.enableWhen(c -> c.allowRegularCraftingInCrafter)
.build(),
.size() > 1
&& !MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.shouldIgnoreInAutomation(r),
BasinRecipe::convertShapeless)
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
.catalyst(AllBlocks.BASIN::get)
.doubleItemIcon(AllBlocks.MECHANICAL_MIXER.get(), Items.CRAFTING_TABLE)
.emptyBackground(177, 85)
.build("automatic_shapeless", MixingCategory::autoShapeless),
mechanicalCrafting = register("mechanical_crafting", MechanicalCraftingCategory::new)
.addTypedRecipes(AllRecipeTypes.MECHANICAL_CRAFTING)
.catalyst(AllBlocks.MECHANICAL_CRAFTER::get)
.build();
brewing = builder(BasinRecipe.class)
.addRecipes(() -> PotionMixingRecipes.ALL)
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
.catalyst(AllBlocks.BASIN::get)
.doubleItemIcon(AllBlocks.MECHANICAL_MIXER.get(), Blocks.BREWING_STAND)
.emptyBackground(177, 103)
.build("automatic_brewing", MixingCategory::autoBrewing),
packing = builder(BasinRecipe.class)
.addTypedRecipes(AllRecipeTypes.COMPACTING)
.catalyst(AllBlocks.MECHANICAL_PRESS::get)
.catalyst(AllBlocks.BASIN::get)
.doubleItemIcon(AllBlocks.MECHANICAL_PRESS.get(), AllBlocks.BASIN.get())
.emptyBackground(177, 103)
.build("packing", PackingCategory::standard),
autoSquare = builder(BasinRecipe.class)
.enableWhen(c -> c.allowShapedSquareInPress)
.addAllRecipesIf(
r -> (r instanceof CraftingRecipe) && !(r instanceof MechanicalCraftingRecipe)
&& MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.shouldIgnoreInAutomation(r),
BasinRecipe::convertShapeless)
.catalyst(AllBlocks.MECHANICAL_PRESS::get)
.catalyst(AllBlocks.BASIN::get)
.doubleItemIcon(AllBlocks.MECHANICAL_PRESS.get(), Blocks.CRAFTING_TABLE)
.emptyBackground(177, 85)
.build("automatic_packing", PackingCategory::autoSquare),
sawing = builder(CuttingRecipe.class)
.addTypedRecipes(AllRecipeTypes.CUTTING)
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.doubleItemIcon(AllBlocks.MECHANICAL_SAW.get(), Items.OAK_LOG)
.emptyBackground(177, 70)
.build("sawing", SawingCategory::new),
blockCutting = builder(CondensedBlockCuttingRecipe.class)
.enableWhen(c -> c.allowStonecuttingOnSaw)
.addRecipes(() -> CondensedBlockCuttingRecipe.condenseRecipes(getTypedRecipesExcluding(RecipeType.STONECUTTING, AllRecipeTypes::shouldIgnoreInAutomation)))
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.doubleItemIcon(AllBlocks.MECHANICAL_SAW.get(), Items.STONE_BRICK_STAIRS)
.emptyBackground(177, 70)
.build("block_cutting", BlockCuttingCategory::new),
woodCutting = builder(CondensedBlockCuttingRecipe.class)
.enableIf(c -> c.allowWoodcuttingOnSaw.get() && ModList.get()
.isLoaded("druidcraft"))
.addRecipes(() -> CondensedBlockCuttingRecipe.condenseRecipes(getTypedRecipesExcluding(SawTileEntity.woodcuttingRecipeType.get(), AllRecipeTypes::shouldIgnoreInAutomation)))
.catalyst(AllBlocks.MECHANICAL_SAW::get)
.doubleItemIcon(AllBlocks.MECHANICAL_SAW.get(), Items.OAK_STAIRS)
.emptyBackground(177, 70)
.build("wood_cutting", BlockCuttingCategory::new),
polishing = builder(SandPaperPolishingRecipe.class)
.addTypedRecipes(AllRecipeTypes.SANDPAPER_POLISHING)
.catalyst(AllItems.SAND_PAPER::get)
.catalyst(AllItems.RED_SAND_PAPER::get)
.itemIcon(AllItems.SAND_PAPER.get())
.emptyBackground(177, 55)
.build("sandpaper_polishing", PolishingCategory::new),
item_application = builder(ItemApplicationRecipe.class)
.addTypedRecipes(AllRecipeTypes.ITEM_APPLICATION)
.addRecipes(LogStrippingFakeRecipes::createRecipes)
.itemIcon(AllItems.BRASS_HAND.get())
.emptyBackground(177, 60)
.build("item_application", ItemApplicationCategory::new),
deploying = builder(DeployerApplicationRecipe.class)
.addTypedRecipes(AllRecipeTypes.DEPLOYING)
.addTypedRecipes(AllRecipeTypes.SANDPAPER_POLISHING::getType, DeployerApplicationRecipe::convert)
.addTypedRecipes(AllRecipeTypes.ITEM_APPLICATION::getType, ManualApplicationRecipe::asDeploying)
.catalyst(AllBlocks.DEPLOYER::get)
.catalyst(AllBlocks.DEPOT::get)
.catalyst(AllItems.BELT_CONNECTOR::get)
.itemIcon(AllBlocks.DEPLOYER.get())
.emptyBackground(177, 70)
.build("deploying", DeployingCategory::new),
spoutFilling = builder(FillingRecipe.class)
.addTypedRecipes(AllRecipeTypes.FILLING)
.addRecipeListConsumer(recipes -> SpoutCategory.consumeRecipes(recipes::add, ingredientManager))
.catalyst(AllBlocks.SPOUT::get)
.doubleItemIcon(AllBlocks.SPOUT.get(), Items.WATER_BUCKET)
.emptyBackground(177, 70)
.build("spout_filling", SpoutCategory::new),
draining = builder(EmptyingRecipe.class)
.addRecipeListConsumer(recipes -> ItemDrainCategory.consumeRecipes(recipes::add, ingredientManager))
.addTypedRecipes(AllRecipeTypes.EMPTYING)
.catalyst(AllBlocks.ITEM_DRAIN::get)
.doubleItemIcon(AllBlocks.ITEM_DRAIN.get(), Items.WATER_BUCKET)
.emptyBackground(177, 50)
.build("draining", ItemDrainCategory::new),
autoShaped = builder(CraftingRecipe.class)
.enableWhen(c -> c.allowRegularCraftingInCrafter)
.addAllRecipesIf(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe<?>)
&& r.getIngredients()
.size() == 1
&& !AllRecipeTypes.shouldIgnoreInAutomation(r))
.addTypedRecipesIf(() -> RecipeType.CRAFTING,
recipe -> recipe instanceof IShapedRecipe<?> && !AllRecipeTypes.shouldIgnoreInAutomation(recipe))
.catalyst(AllBlocks.MECHANICAL_CRAFTER::get)
.itemIcon(AllBlocks.MECHANICAL_CRAFTER.get())
.emptyBackground(177, 107)
.build("automatic_shaped", MechanicalCraftingCategory::new),
mechanicalCrafting = builder(CraftingRecipe.class)
.addTypedRecipes(AllRecipeTypes.MECHANICAL_CRAFTING)
.catalyst(AllBlocks.MECHANICAL_CRAFTER::get)
.itemIcon(AllBlocks.MECHANICAL_CRAFTER.get())
.emptyBackground(177, 107)
.build("mechanical_crafting", MechanicalCraftingCategory::new),
seqAssembly = builder(SequencedAssemblyRecipe.class)
.addTypedRecipes(AllRecipeTypes.SEQUENCED_ASSEMBLY)
.itemIcon(AllItems.PRECISION_MECHANISM.get())
.emptyBackground(180, 115)
.build("sequenced_assembly", SequencedAssemblyCategory::new),
mysteryConversion = builder(ConversionRecipe.class)
.addRecipes(() -> MysteriousItemConversionCategory.RECIPES)
.itemIcon(AllItems.CHROMATIC_COMPOUND.get())
.emptyBackground(177, 50)
.build("mystery_conversion", MysteriousItemConversionCategory::new);
}
private <T extends Recipe<?>> CategoryBuilder<T> register(String name, Supplier<CreateRecipeCategory<T>> supplier) {
return new CategoryBuilder<>(name, supplier);
private <T extends Recipe<?>> CategoryBuilder<T> builder(Class<? extends T> recipeClass) {
return new CategoryBuilder<>(recipeClass);
}
@Override
@ -250,25 +323,12 @@ public class CreateJEI implements IModPlugin {
return ID;
}
@Override
public void registerRecipeTransferHandlers(IRecipeTransferRegistration registration) {
registration.addRecipeTransferHandler(new BlueprintTransferHandler(), RecipeTypes.CRAFTING);
}
@Override
public void registerCategories(IRecipeCategoryRegistration registration) {
loadCategories();
registration.addRecipeCategories(allCategories.toArray(IRecipeCategory[]::new));
}
@Override
public void registerFluidSubtypes(ISubtypeRegistration registration) {
PotionFluidSubtypeInterpreter interpreter = new PotionFluidSubtypeInterpreter();
PotionFluid potionFluid = AllFluids.POTION.get();
registration.registerSubtypeInterpreter(potionFluid.getSource(), interpreter);
registration.registerSubtypeInterpreter(potionFluid.getFlowing(), interpreter);
}
@Override
public void registerRecipes(IRecipeRegistration registration) {
ingredientManager = registration.getIngredientManager();
@ -280,7 +340,20 @@ public class CreateJEI implements IModPlugin {
@Override
public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) {
allCategories.forEach(c -> c.recipeCatalysts.forEach(s -> registration.addRecipeCatalyst(s.get(), c.getRecipeType())));
allCategories.forEach(c -> c.registerCatalysts(registration));
}
@Override
public void registerRecipeTransferHandlers(IRecipeTransferRegistration registration) {
registration.addRecipeTransferHandler(new BlueprintTransferHandler(), RecipeTypes.CRAFTING);
}
@Override
public void registerFluidSubtypes(ISubtypeRegistration registration) {
PotionFluidSubtypeInterpreter interpreter = new PotionFluidSubtypeInterpreter();
PotionFluid potionFluid = AllFluids.POTION.get();
registration.registerSubtypeInterpreter(ForgeTypes.FLUID_STACK, potionFluid.getSource(), interpreter);
registration.registerSubtypeInterpreter(ForgeTypes.FLUID_STACK, potionFluid.getFlowing(), interpreter);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@ -295,15 +368,27 @@ public class CreateJEI implements IModPlugin {
}
private class CategoryBuilder<T extends Recipe<?>> {
private final CreateRecipeCategory<T> category;
private final List<Consumer<List<T>>> recipeListConsumers = new ArrayList<>();
private Predicate<CRecipes> predicate;
private final Class<? extends T> recipeClass;
private Predicate<CRecipes> predicate = cRecipes -> true;
public CategoryBuilder(String name, Supplier<CreateRecipeCategory<T>> category) {
this.category = category.get();
this.category.setCategoryId(name);
mezz.jei.api.recipe.RecipeType<T> recipeType = this.category.getRecipeType();
predicate = cRecipes -> true;
private IDrawable background;
private IDrawable icon;
private final List<Consumer<List<T>>> recipeListConsumers = new ArrayList<>();
private final List<Supplier<? extends ItemStack>> catalysts = new ArrayList<>();
public CategoryBuilder(Class<? extends T> recipeClass) {
this.recipeClass = recipeClass;
}
public CategoryBuilder<T> enableIf(Predicate<CRecipes> predicate) {
this.predicate = predicate;
return this;
}
public CategoryBuilder<T> enableWhen(Function<CRecipes, ConfigBool> configValue) {
predicate = c -> configValue.apply(c).get();
return this;
}
public CategoryBuilder<T> addRecipeListConsumer(Consumer<List<T>> consumer) {
@ -380,38 +465,61 @@ public class CreateJEI implements IModPlugin {
});
}
public CategoryBuilder<T> catalystStack(Supplier<ItemStack> supplier) {
catalysts.add(supplier);
return this;
}
public CategoryBuilder<T> catalyst(Supplier<ItemLike> supplier) {
return catalystStack(() -> new ItemStack(supplier.get()
.asItem()));
}
public CategoryBuilder<T> catalystStack(Supplier<ItemStack> supplier) {
category.recipeCatalysts.add(supplier);
public CategoryBuilder<T> icon(IDrawable icon) {
this.icon = icon;
return this;
}
public CategoryBuilder<T> enableWhen(Function<CRecipes, ConfigBool> configValue) {
predicate = c -> configValue.apply(c).get();
public CategoryBuilder<T> itemIcon(ItemLike item) {
icon(new ItemIcon(() -> new ItemStack(item)));
return this;
}
public CategoryBuilder<T> enableWhenBool(Function<CRecipes, Boolean> configValue) {
predicate = configValue::apply;
public CategoryBuilder<T> doubleItemIcon(ItemLike item1, ItemLike item2) {
icon(new DoubleItemIcon(() -> new ItemStack(item1), () -> new ItemStack(item2)));
return this;
}
public CreateRecipeCategory<T> build() {
if (predicate.test(AllConfigs.SERVER.recipes))
category.recipes.add(() -> {
public CategoryBuilder<T> background(IDrawable background) {
this.background = background;
return this;
}
public CategoryBuilder<T> emptyBackground(int width, int height) {
background(new EmptyBackground(width, height));
return this;
}
public CreateRecipeCategory<T> build(String name, CreateRecipeCategory.Factory<T> factory) {
Supplier<List<T>> recipesSupplier;
if (predicate.test(AllConfigs.SERVER.recipes)) {
recipesSupplier = () -> {
List<T> recipes = new ArrayList<>();
for (Consumer<List<T>> consumer : recipeListConsumers)
consumer.accept(recipes);
return recipes;
});
};
} else {
recipesSupplier = () -> Collections.emptyList();
}
CreateRecipeCategory.Info<T> info = new CreateRecipeCategory.Info<>(
new mezz.jei.api.recipe.RecipeType<>(Create.asResource(name), recipeClass),
Lang.translateDirect("recipe." + name), background, icon, recipesSupplier, catalysts);
CreateRecipeCategory<T> category = factory.create(info);
allCategories.add(category);
return category;
}
}
public static void consumeAllRecipes(Consumer<Recipe<?>> consumer) {

View file

@ -56,7 +56,6 @@ public class DoubleItemIcon implements IDrawable {
matrixStack.popPose();
matrixStack.popPose();
RenderSystem.enableBlend();
}
}

View file

@ -0,0 +1,48 @@
package com.simibubi.create.compat.jei;
import java.util.function.Supplier;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.gui.element.GuiGameElement;
import mezz.jei.api.gui.drawable.IDrawable;
import net.minecraft.world.item.ItemStack;
public class ItemIcon implements IDrawable {
private Supplier<ItemStack> supplier;
private ItemStack stack;
public ItemIcon(Supplier<ItemStack> stack) {
this.supplier = stack;
}
@Override
public int getWidth() {
return 18;
}
@Override
public int getHeight() {
return 18;
}
@Override
public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
if (stack == null) {
stack = supplier.get();
}
RenderSystem.enableDepthTest();
matrixStack.pushPose();
matrixStack.translate(xOffset + 1, yOffset + 1, 0);
GuiGameElement.of(stack)
.render(matrixStack);
matrixStack.popPose();
}
}

View file

@ -20,9 +20,8 @@ import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.Pair;
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.IDrawable;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
@ -36,16 +35,11 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
private final boolean needsHeating;
public BasinCategory(boolean needsHeating, IDrawable icon, IDrawable background) {
super(icon, background);
public BasinCategory(Info<BasinRecipe> info, boolean needsHeating) {
super(info);
this.needsHeating = needsHeating;
}
@Override
public Class<? extends BasinRecipe> getRecipeClass() {
return BasinRecipe.class;
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, BasinRecipe recipe, IFocusGroup focuses) {
List<Pair<Ingredient, MutableInt>> condensedIngredients = ItemHelper.condenseIngredients(recipe.getIngredients());
@ -72,7 +66,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
builder
.addSlot(RecipeIngredientRole.INPUT, 17 + xOffset + (i % 3) * 19, 51 - (i / 3) * 19)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredients(VanillaTypes.FLUID, withImprovedVisibility(fluidIngredient.getMatchingFluidStacks()))
.addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(fluidIngredient.getMatchingFluidStacks()))
.addTooltipCallback(addFluidTooltip(fluidIngredient.getRequiredAmount()));
i++;
}
@ -99,7 +93,7 @@ public class BasinCategory extends CreateRecipeCategory<BasinRecipe> {
builder
.addSlot(RecipeIngredientRole.OUTPUT, xPosition, yPosition)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredient(VanillaTypes.FLUID, withImprovedVisibility(fluidResult))
.addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(fluidResult))
.addTooltipCallback(addFluidTooltip(fluidResult.getAmount()));
i++;
}

View file

@ -7,7 +7,6 @@ import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlockCuttingRecipe;
import com.simibubi.create.compat.jei.category.animations.AnimatedSaw;
import com.simibubi.create.foundation.gui.AllGuiTextures;
@ -18,7 +17,6 @@ import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.Recipe;
@ -29,13 +27,8 @@ public class BlockCuttingCategory extends CreateRecipeCategory<CondensedBlockCut
private final AnimatedSaw saw = new AnimatedSaw();
public BlockCuttingCategory(Item symbol) {
super(doubleItemIcon(AllBlocks.MECHANICAL_SAW.get(), symbol), emptyBackground(177, 70)); // Items.STONE_BRICK_STAIRS
}
@Override
public Class<? extends CondensedBlockCuttingRecipe> getRecipeClass() {
return CondensedBlockCuttingRecipe.class;
public BlockCuttingCategory(Info<CondensedBlockCuttingRecipe> info) {
super(info);
}
@Override

View file

@ -12,19 +12,17 @@ import org.jetbrains.annotations.NotNull;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllFluids;
import com.simibubi.create.Create;
import com.simibubi.create.compat.jei.DoubleItemIcon;
import com.simibubi.create.compat.jei.EmptyBackground;
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluidHandler;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.utility.Lang;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.forge.ForgeTypes;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IRecipeSlotTooltipCallback;
import mezz.jei.api.recipe.RecipeType;
import mezz.jei.api.recipe.category.IRecipeCategory;
import mezz.jei.api.registration.IRecipeCatalystRegistration;
import mezz.jei.api.registration.IRecipeRegistration;
import net.minecraft.ChatFormatting;
import net.minecraft.MethodsReturnNonnullByDefault;
@ -33,42 +31,31 @@ import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.fluids.FluidStack;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IRecipeCategory<T> {
private static final IDrawable BASIC_SLOT = asDrawable(AllGuiTextures.JEI_SLOT);
private static final IDrawable CHANCE_SLOT = asDrawable(AllGuiTextures.JEI_CHANCE_SLOT);
public final List<Supplier<List<T>>> recipes = new ArrayList<>();
public final List<Supplier<? extends ItemStack>> recipeCatalysts = new ArrayList<>();
protected final RecipeType<T> type;
protected final Component title;
protected final IDrawable background;
protected final IDrawable icon;
protected String name;
protected RecipeType<T> type;
private final IDrawable background;
private final IDrawable icon;
private final Supplier<List<T>> recipes;
private final List<Supplier<? extends ItemStack>> catalysts;
private static final IDrawable basicSlot = asDrawable(AllGuiTextures.JEI_SLOT);
private static final IDrawable chanceSlot = asDrawable(AllGuiTextures.JEI_CHANCE_SLOT);
public CreateRecipeCategory(IDrawable icon, IDrawable background) {
this.background = background;
this.icon = icon;
public CreateRecipeCategory(Info<T> info) {
this.type = info.recipeType();
this.title = info.title();
this.background = info.background();
this.icon = info.icon();
this.recipes = info.recipes();
this.catalysts = info.catalysts();
}
public void setCategoryId(String name) {
this.name = name;
this.type = RecipeType.create(Create.ID, name, getRecipeClass());
}
@Override
public ResourceLocation getUid() {
return getRecipeType().getUid();
}
@Override
public abstract Class<? extends T> getRecipeClass();
@NotNull
@Override
public RecipeType<T> getRecipeType() {
@ -77,7 +64,7 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
@Override
public Component getTitle() {
return Lang.translateDirect("recipe." + name);
return title;
}
@Override
@ -90,12 +77,28 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
return icon;
}
@Override
@Deprecated
public final ResourceLocation getUid() {
return type.getUid();
}
@Override
@Deprecated
public final Class<? extends T> getRecipeClass() {
return type.getRecipeClass();
}
public void registerRecipes(IRecipeRegistration registration) {
recipes.forEach(s -> registration.addRecipes(getRecipeType(), s.get()));
registration.addRecipes(type, recipes.get());
}
public void registerCatalysts(IRecipeCatalystRegistration registration) {
catalysts.forEach(s -> registration.addRecipeCatalyst(s.get(), type));
}
public static IDrawable getRenderedSlot() {
return basicSlot;
return BASIC_SLOT;
}
public static IDrawable getRenderedSlot(ProcessingOutput output) {
@ -104,21 +107,9 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
public static IDrawable getRenderedSlot(float chance) {
if (chance == 1)
return basicSlot;
return BASIC_SLOT;
return chanceSlot;
}
public static IDrawable emptyBackground(int width, int height) {
return new EmptyBackground(width, height);
}
public static IDrawable doubleItemIcon(ItemLike item1, ItemLike item2) {
return new DoubleItemIcon(() -> new ItemStack(item1), () -> new ItemStack(item2));
}
public static IDrawable itemIcon(ItemLike item) {
return new DoubleItemIcon(() -> new ItemStack(item), () -> ItemStack.EMPTY);
return CHANCE_SLOT;
}
public static IRecipeSlotTooltipCallback addStochasticTooltip(ProcessingOutput output) {
@ -149,7 +140,7 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
public static IRecipeSlotTooltipCallback addFluidTooltip(int mbAmount) {
return (view, tooltip) -> {
Optional<FluidStack> displayed = view.getDisplayedIngredient(VanillaTypes.FLUID);
Optional<FluidStack> displayed = view.getDisplayedIngredient(ForgeTypes.FLUID_STACK);
if (displayed.isEmpty())
return;
@ -179,7 +170,7 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
};
}
private static IDrawable asDrawable(AllGuiTextures texture) {
protected static IDrawable asDrawable(AllGuiTextures texture) {
return new IDrawable() {
@Override
public int getWidth() {
@ -198,4 +189,10 @@ public abstract class CreateRecipeCategory<T extends Recipe<?>> implements IReci
};
}
public record Info<T extends Recipe<?>>(RecipeType<T> recipeType, Component title, IDrawable background, IDrawable icon, Supplier<List<T>> recipes, List<Supplier<? extends ItemStack>> catalysts) {
}
public interface Factory<T extends Recipe<?>> {
CreateRecipeCategory<T> create(Info<T> info);
}
}

View file

@ -6,8 +6,6 @@ import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedCrushingWheels;
import com.simibubi.create.content.contraptions.components.crusher.AbstractCrushingRecipe;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
@ -25,13 +23,8 @@ public class CrushingCategory extends CreateRecipeCategory<AbstractCrushingRecip
private final AnimatedCrushingWheels crushingWheels = new AnimatedCrushingWheels();
public CrushingCategory() {
super(doubleItemIcon(AllBlocks.CRUSHING_WHEEL.get(), AllItems.CRUSHED_GOLD.get()), emptyBackground(177, 100));
}
@Override
public Class<? extends AbstractCrushingRecipe> getRecipeClass() {
return AbstractCrushingRecipe.class;
public CrushingCategory(Info<AbstractCrushingRecipe> info) {
super(info);
}
@Override

View file

@ -3,7 +3,6 @@ package com.simibubi.create.compat.jei.category;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedDeployer;
import com.simibubi.create.content.contraptions.components.deployer.DeployerApplicationRecipe;
import com.simibubi.create.foundation.gui.AllGuiTextures;
@ -21,13 +20,8 @@ public class DeployingCategory extends CreateRecipeCategory<DeployerApplicationR
private final AnimatedDeployer deployer = new AnimatedDeployer();
public DeployingCategory() {
super(itemIcon(AllBlocks.DEPLOYER.get()), emptyBackground(177, 70));
}
@Override
public Class<DeployerApplicationRecipe> getRecipeClass() {
return DeployerApplicationRecipe.class;
public DeployingCategory(Info<DeployerApplicationRecipe> info) {
super(info);
}
@Override

View file

@ -3,24 +3,17 @@ package com.simibubi.create.compat.jei.category;
import org.jetbrains.annotations.NotNull;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.element.GuiGameElement;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.AbstractCookingRecipe;
import net.minecraft.world.level.material.Fluids;
public class FanBlastingCategory extends ProcessingViaFanCategory<AbstractCookingRecipe> {
public FanBlastingCategory() {
super(doubleItemIcon(AllItems.PROPELLER.get(), Items.LAVA_BUCKET));
}
@Override
public Class<? extends AbstractCookingRecipe> getRecipeClass() {
return AbstractCookingRecipe.class;
public FanBlastingCategory(Info<AbstractCookingRecipe> info) {
super(info);
}
@Override

View file

@ -3,24 +3,17 @@ package com.simibubi.create.compat.jei.category;
import org.jetbrains.annotations.NotNull;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
import com.simibubi.create.content.contraptions.components.fan.HauntingRecipe;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.element.GuiGameElement;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
public class FanHauntingCategory extends ProcessingViaFanCategory.MultiOutput<HauntingRecipe> {
public FanHauntingCategory() {
super(doubleItemIcon(AllItems.PROPELLER.get(), Items.SOUL_CAMPFIRE));
}
@Override
public Class<? extends HauntingRecipe> getRecipeClass() {
return HauntingRecipe.class;
public FanHauntingCategory(Info<HauntingRecipe> info) {
super(info);
}
@Override

View file

@ -3,24 +3,17 @@ package com.simibubi.create.compat.jei.category;
import org.jetbrains.annotations.NotNull;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.gui.element.GuiGameElement;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.SmokingRecipe;
import net.minecraft.world.level.block.Blocks;
public class FanSmokingCategory extends ProcessingViaFanCategory<SmokingRecipe> {
public FanSmokingCategory() {
super(doubleItemIcon(AllItems.PROPELLER.get(), Items.CAMPFIRE));
}
@Override
public Class<? extends SmokingRecipe> getRecipeClass() {
return SmokingRecipe.class;
public FanSmokingCategory(Info<SmokingRecipe> info) {
super(info);
}
@Override

View file

@ -3,23 +3,16 @@ package com.simibubi.create.compat.jei.category;
import org.jetbrains.annotations.NotNull;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe;
import com.simibubi.create.foundation.gui.element.GuiGameElement;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.material.Fluids;
public class FanWashingCategory extends ProcessingViaFanCategory.MultiOutput<SplashingRecipe> {
public FanWashingCategory() {
super(doubleItemIcon(AllItems.PROPELLER.get(), Items.WATER_BUCKET));
}
@Override
public Class<? extends SplashingRecipe> getRecipeClass() {
return SplashingRecipe.class;
public FanWashingCategory(Info<SplashingRecipe> info) {
super(info);
}
@Override

View file

@ -6,7 +6,6 @@ import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
import com.simibubi.create.content.contraptions.processing.ItemApplicationRecipe;
import com.simibubi.create.foundation.gui.AllGuiTextures;
@ -27,13 +26,8 @@ import net.minecraft.world.level.block.state.BlockState;
@ParametersAreNonnullByDefault
public class ItemApplicationCategory extends CreateRecipeCategory<ItemApplicationRecipe> {
public ItemApplicationCategory() {
super(itemIcon(AllItems.BRASS_HAND.get()), emptyBackground(177, 60));
}
@Override
public Class<ItemApplicationRecipe> getRecipeClass() {
return ItemApplicationRecipe.class;
public ItemApplicationCategory(Info<ItemApplicationRecipe> info) {
super(info);
}
@Override
@ -65,7 +59,7 @@ public class ItemApplicationCategory extends CreateRecipeCategory<ItemApplicatio
Optional<ItemStack> displayedIngredient = recipeSlotsView.getSlotViews()
.get(0)
.getDisplayedIngredient(VanillaTypes.ITEM);
.getDisplayedIngredient(VanillaTypes.ITEM_STACK);
if (displayedIngredient.isEmpty())
return;

View file

@ -5,7 +5,6 @@ import java.util.function.Consumer;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create;
import com.simibubi.create.compat.jei.category.animations.AnimatedItemDrain;
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluidHandler;
@ -14,6 +13,7 @@ import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuild
import com.simibubi.create.foundation.gui.AllGuiTextures;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.forge.ForgeTypes;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.IFocusGroup;
@ -33,15 +33,14 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem;
@ParametersAreNonnullByDefault
public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
AnimatedItemDrain drain;
private final AnimatedItemDrain drain = new AnimatedItemDrain();
public ItemDrainCategory() {
super(doubleItemIcon(AllBlocks.ITEM_DRAIN.get(), Items.WATER_BUCKET), emptyBackground(177, 50));
drain = new AnimatedItemDrain();
public ItemDrainCategory(Info<EmptyingRecipe> info) {
super(info);
}
public static void consumeRecipes(Consumer<EmptyingRecipe> consumer, IIngredientManager ingredientManager) {
for (ItemStack stack : ingredientManager.getAllIngredients(VanillaTypes.ITEM)) {
for (ItemStack stack : ingredientManager.getAllIngredients(VanillaTypes.ITEM_STACK)) {
if (stack.getItem() instanceof PotionItem) {
FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack);
Ingredient potion = Ingredient.of(stack);
@ -83,11 +82,6 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
}
}
@Override
public Class<? extends EmptyingRecipe> getRecipeClass() {
return EmptyingRecipe.class;
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, EmptyingRecipe recipe, IFocusGroup focuses) {
builder
@ -97,7 +91,7 @@ public class ItemDrainCategory extends CreateRecipeCategory<EmptyingRecipe> {
builder
.addSlot(RecipeIngredientRole.OUTPUT, 132, 8)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredient(VanillaTypes.FLUID, withImprovedVisibility(recipe.getResultingFluid()))
.addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getResultingFluid()))
.addTooltipCallback(addFluidTooltip(recipe.getResultingFluid().getAmount()));
builder
.addSlot(RecipeIngredientRole.OUTPUT, 132, 27)

View file

@ -9,7 +9,6 @@ import org.jetbrains.annotations.NotNull;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedCrafter;
import com.simibubi.create.foundation.gui.AllGuiTextures;
@ -37,8 +36,8 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRec
private final AnimatedCrafter crafter = new AnimatedCrafter();
public MechanicalCraftingCategory() {
super(itemIcon(AllBlocks.MECHANICAL_CRAFTER.get()), emptyBackground(177, 107));
public MechanicalCraftingCategory(Info<CraftingRecipe> info) {
super(info);
}
@Override
@ -59,7 +58,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRec
int yPosition = (int) (y + 1 + (i / getWidth(recipe)) * f);
builder.addSlot(RecipeIngredientRole.INPUT, xPosition, yPosition)
.setCustomRenderer(VanillaTypes.ITEM, renderer)
.setCustomRenderer(VanillaTypes.ITEM_STACK, renderer)
.addIngredients(ingredient);
i++;
@ -130,11 +129,6 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory<CraftingRec
matrixStack.popPose();
}
@Override
public Class<? extends CraftingRecipe> getRecipeClass() {
return CraftingRecipe.class;
}
private static final class CrafterIngredientRenderer implements IIngredientRenderer<ItemStack> {
private final CraftingRecipe recipe;

View file

@ -5,8 +5,6 @@ import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedMillstone;
import com.simibubi.create.content.contraptions.components.crusher.AbstractCrushingRecipe;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
@ -22,13 +20,8 @@ public class MillingCategory extends CreateRecipeCategory<AbstractCrushingRecipe
private final AnimatedMillstone millstone = new AnimatedMillstone();
public MillingCategory() {
super(doubleItemIcon(AllBlocks.MILLSTONE.get(), AllItems.WHEAT_FLOUR.get()), emptyBackground(177, 53));
}
@Override
public Class<? extends AbstractCrushingRecipe> getRecipeClass() {
return AbstractCrushingRecipe.class;
public MillingCategory(Info<AbstractCrushingRecipe> info) {
super(info);
}
@Override

View file

@ -3,16 +3,12 @@ package com.simibubi.create.compat.jei.category;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedBlazeBurner;
import com.simibubi.create.compat.jei.category.animations.AnimatedMixer;
import com.simibubi.create.content.contraptions.processing.BasinRecipe;
import com.simibubi.create.content.contraptions.processing.HeatCondition;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Blocks;
@ParametersAreNonnullByDefault
public class MixingCategory extends BasinCategory {
@ -22,24 +18,23 @@ public class MixingCategory extends BasinCategory {
MixingType type;
enum MixingType {
AUTO_SHAPELESS, MIXING, AUTO_BREWING
MIXING, AUTO_SHAPELESS, AUTO_BREWING
}
public static MixingCategory autoShapeless() {
return new MixingCategory(MixingType.AUTO_SHAPELESS, Items.CRAFTING_TABLE, 85);
public static MixingCategory standard(Info<BasinRecipe> info) {
return new MixingCategory(info, MixingType.MIXING);
}
public static MixingCategory standard() {
return new MixingCategory(MixingType.MIXING, AllBlocks.BASIN.get(), 103);
public static MixingCategory autoShapeless(Info<BasinRecipe> info) {
return new MixingCategory(info, MixingType.AUTO_SHAPELESS);
}
public static MixingCategory autoBrewing() {
return new MixingCategory(MixingType.AUTO_BREWING, Blocks.BREWING_STAND, 103);
public static MixingCategory autoBrewing(Info<BasinRecipe> info) {
return new MixingCategory(info, MixingType.AUTO_BREWING);
}
protected MixingCategory(MixingType type, ItemLike secondaryItem, int height) {
super(type != MixingType.AUTO_SHAPELESS, doubleItemIcon(AllBlocks.MECHANICAL_MIXER.get(), secondaryItem),
emptyBackground(177, height));
protected MixingCategory(Info<BasinRecipe> info, MixingType type) {
super(info, type != MixingType.AUTO_SHAPELESS);
this.type = type;
}

View file

@ -28,13 +28,8 @@ public class MysteriousItemConversionCategory extends CreateRecipeCategory<Conve
RECIPES.add(ConversionRecipe.create(AllItems.CHROMATIC_COMPOUND.asStack(), AllItems.REFINED_RADIANCE.asStack()));
}
public MysteriousItemConversionCategory() {
super(itemIcon(AllItems.CHROMATIC_COMPOUND.get()), emptyBackground(177, 50));
}
@Override
public Class<? extends ConversionRecipe> getRecipeClass() {
return ConversionRecipe.class;
public MysteriousItemConversionCategory(Info<ConversionRecipe> info) {
super(info);
}
@Override

View file

@ -3,7 +3,6 @@ package com.simibubi.create.compat.jei.category;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedBlazeBurner;
import com.simibubi.create.compat.jei.category.animations.AnimatedPress;
import com.simibubi.create.content.contraptions.processing.BasinRecipe;
@ -16,8 +15,6 @@ import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import net.minecraft.core.NonNullList;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Blocks;
@ParametersAreNonnullByDefault
public class PackingCategory extends BasinCategory {
@ -27,20 +24,19 @@ public class PackingCategory extends BasinCategory {
private final PackingType type;
enum PackingType {
AUTO_SQUARE, COMPACTING
COMPACTING, AUTO_SQUARE
}
public static PackingCategory standard() {
return new PackingCategory(PackingType.COMPACTING, AllBlocks.BASIN.get(), 103);
public static PackingCategory standard(Info<BasinRecipe> info) {
return new PackingCategory(info, PackingType.COMPACTING);
}
public static PackingCategory autoSquare() {
return new PackingCategory(PackingType.AUTO_SQUARE, Blocks.CRAFTING_TABLE, 85);
public static PackingCategory autoSquare(Info<BasinRecipe> info) {
return new PackingCategory(info, PackingType.AUTO_SQUARE);
}
protected PackingCategory(PackingType type, ItemLike icon, int height) {
super(type != PackingType.AUTO_SQUARE, doubleItemIcon(AllBlocks.MECHANICAL_PRESS.get(), icon),
emptyBackground(177, height));
protected PackingCategory(Info<BasinRecipe> info, PackingType type) {
super(info, type != PackingType.AUTO_SQUARE);
this.type = type;
}

View file

@ -23,16 +23,11 @@ public class PolishingCategory extends CreateRecipeCategory<SandPaperPolishingRe
private final ItemStack renderedSandpaper;
public PolishingCategory() {
super(itemIcon(AllItems.SAND_PAPER.get()), emptyBackground(177, 55));
public PolishingCategory(Info<SandPaperPolishingRecipe> info) {
super(info);
renderedSandpaper = AllItems.SAND_PAPER.asStack();
}
@Override
public Class<? extends SandPaperPolishingRecipe> getRecipeClass() {
return SandPaperPolishingRecipe.class;
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, SandPaperPolishingRecipe recipe, IFocusGroup focuses) {
builder

View file

@ -5,8 +5,6 @@ import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.category.animations.AnimatedPress;
import com.simibubi.create.content.contraptions.components.press.PressingRecipe;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
@ -22,13 +20,8 @@ public class PressingCategory extends CreateRecipeCategory<PressingRecipe> {
private final AnimatedPress press = new AnimatedPress(false);
public PressingCategory() {
super(doubleItemIcon(AllBlocks.MECHANICAL_PRESS.get(), AllItems.IRON_SHEET.get()), emptyBackground(177, 70));
}
@Override
public Class<? extends PressingRecipe> getRecipeClass() {
return PressingRecipe.class;
public PressingCategory(Info<PressingRecipe> info) {
super(info);
}
@Override

View file

@ -16,7 +16,6 @@ import com.simibubi.create.foundation.gui.AllGuiTextures;
import com.simibubi.create.foundation.utility.Lang;
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;
@ -28,12 +27,8 @@ public abstract class ProcessingViaFanCategory<T extends Recipe<?>> extends Crea
protected static final int SCALE = 24;
public ProcessingViaFanCategory(IDrawable icon) {
this(178, icon);
}
public ProcessingViaFanCategory(int width, IDrawable icon) {
super(icon, emptyBackground(width, 72));
public ProcessingViaFanCategory(Info<T> info) {
super(info);
}
public static Supplier<ItemStack> getFan(String name) {
@ -95,8 +90,8 @@ public abstract class ProcessingViaFanCategory<T extends Recipe<?>> extends Crea
public static abstract class MultiOutput<T extends ProcessingRecipe<?>> extends ProcessingViaFanCategory<T> {
public MultiOutput(IDrawable icon) {
super(icon);
public MultiOutput(Info<T> info) {
super(info);
}
@Override

View file

@ -5,7 +5,6 @@ import java.util.List;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.compat.jei.category.animations.AnimatedSaw;
import com.simibubi.create.content.contraptions.components.saw.CuttingRecipe;
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
@ -15,20 +14,14 @@ import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.IFocusGroup;
import mezz.jei.api.recipe.RecipeIngredientRole;
import net.minecraft.world.item.Items;
@ParametersAreNonnullByDefault
public class SawingCategory extends CreateRecipeCategory<CuttingRecipe> {
private final AnimatedSaw saw = new AnimatedSaw();
public SawingCategory() {
super(doubleItemIcon(AllBlocks.MECHANICAL_SAW.get(), Items.OAK_LOG), emptyBackground(177, 70));
}
@Override
public Class<? extends CuttingRecipe> getRecipeClass() {
return CuttingRecipe.class;
public SawingCategory(Info<CuttingRecipe> info) {
super(info);
}
@Override

View file

@ -10,8 +10,6 @@ import javax.annotation.ParametersAreNonnullByDefault;
import org.jetbrains.annotations.NotNull;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllItems;
import com.simibubi.create.compat.jei.EmptyBackground;
import com.simibubi.create.compat.jei.category.sequencedAssembly.SequencedAssemblySubCategory;
import com.simibubi.create.content.contraptions.itemAssembly.SequencedAssemblyRecipe;
import com.simibubi.create.content.contraptions.itemAssembly.SequencedRecipe;
@ -36,13 +34,8 @@ public class SequencedAssemblyCategory extends CreateRecipeCategory<SequencedAss
Map<ResourceLocation, SequencedAssemblySubCategory> subCategories = new HashMap<>();
public SequencedAssemblyCategory() {
super(itemIcon(AllItems.PRECISION_MECHANISM.get()), new EmptyBackground(180, 115));
}
@Override
public Class<? extends SequencedAssemblyRecipe> getRecipeClass() {
return SequencedAssemblyRecipe.class;
public SequencedAssemblyCategory(Info<SequencedAssemblyRecipe> info) {
super(info);
}
@Override

View file

@ -6,7 +6,6 @@ import java.util.function.Consumer;
import javax.annotation.ParametersAreNonnullByDefault;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.Create;
import com.simibubi.create.compat.jei.category.animations.AnimatedSpout;
import com.simibubi.create.content.contraptions.fluids.actors.FillingRecipe;
@ -17,6 +16,7 @@ import com.simibubi.create.foundation.fluid.FluidIngredient;
import com.simibubi.create.foundation.gui.AllGuiTextures;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.forge.ForgeTypes;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
import mezz.jei.api.recipe.IFocusGroup;
@ -36,16 +36,15 @@ import net.minecraftforge.fluids.capability.IFluidHandlerItem;
@ParametersAreNonnullByDefault
public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
private final AnimatedSpout spout;
private final AnimatedSpout spout = new AnimatedSpout();
public SpoutCategory() {
super(doubleItemIcon(AllBlocks.SPOUT.get(), Items.WATER_BUCKET), emptyBackground(177, 70));
spout = new AnimatedSpout();
public SpoutCategory(Info<FillingRecipe> info) {
super(info);
}
public static void consumeRecipes(Consumer<FillingRecipe> consumer, IIngredientManager ingredientManager) {
Collection<FluidStack> fluidStacks = ingredientManager.getAllIngredients(VanillaTypes.FLUID);
for (ItemStack stack : ingredientManager.getAllIngredients(VanillaTypes.ITEM)) {
Collection<FluidStack> fluidStacks = ingredientManager.getAllIngredients(ForgeTypes.FLUID_STACK);
for (ItemStack stack : ingredientManager.getAllIngredients(VanillaTypes.ITEM_STACK)) {
if (stack.getItem() instanceof PotionItem) {
FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack);
Ingredient bottle = Ingredient.of(Items.GLASS_BOTTLE);
@ -94,11 +93,6 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
}
}
@Override
public Class<? extends FillingRecipe> getRecipeClass() {
return FillingRecipe.class;
}
@Override
public void setRecipe(IRecipeLayoutBuilder builder, FillingRecipe recipe, IFocusGroup focuses) {
builder
@ -108,7 +102,7 @@ public class SpoutCategory extends CreateRecipeCategory<FillingRecipe> {
builder
.addSlot(RecipeIngredientRole.INPUT, 27, 32)
.setBackground(getRenderedSlot(), -1, -1)
.addIngredients(VanillaTypes.FLUID, withImprovedVisibility(recipe.getRequiredFluid().getMatchingFluidStacks()))
.addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getRequiredFluid().getMatchingFluidStacks()))
.addTooltipCallback(addFluidTooltip(recipe.getRequiredFluid().getRequiredAmount()));
builder
.addSlot(RecipeIngredientRole.OUTPUT, 132, 51)

View file

@ -11,7 +11,7 @@ import com.simibubi.create.content.contraptions.itemAssembly.SequencedRecipe;
import com.simibubi.create.foundation.fluid.FluidIngredient;
import com.simibubi.create.foundation.utility.Lang;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.forge.ForgeTypes;
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
import mezz.jei.api.gui.builder.IRecipeSlotBuilder;
import mezz.jei.api.recipe.IFocusGroup;
@ -73,7 +73,7 @@ public abstract class SequencedAssemblySubCategory {
builder
.addSlot(RecipeIngredientRole.INPUT, x + 4, 15)
.setBackground(CreateRecipeCategory.getRenderedSlot(), -1, -1)
.addIngredients(VanillaTypes.FLUID, CreateRecipeCategory.withImprovedVisibility(fluidIngredient.getMatchingFluidStacks()))
.addIngredients(ForgeTypes.FLUID_STACK, CreateRecipeCategory.withImprovedVisibility(fluidIngredient.getMatchingFluidStacks()))
.addTooltipCallback(CreateRecipeCategory.addFluidTooltip(fluidIngredient.getRequiredAmount()));
}

View file

@ -1,6 +1,7 @@
package com.simibubi.create.content.curiosities.deco;
import com.google.common.collect.ImmutableList;
import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes;
import com.simibubi.create.AllSoundEvents;
@ -201,9 +202,15 @@ public class PlacardBlock extends FaceAttachedHorizontalDirectionalBlock
@Override
public ItemRequirement getRequiredItems(BlockState state, BlockEntity te) {
ItemStack placardStack = AllBlocks.PLACARD.asStack();
if (te instanceof PlacardTileEntity pte && !pte.getHeldItem()
.isEmpty())
return new ItemRequirement(ItemUseType.CONSUME, ImmutableList.of(placardStack, pte.getHeldItem()));
if (te instanceof PlacardTileEntity pte) {
ItemStack heldItem = pte.getHeldItem();
if (!heldItem.isEmpty()) {
return new ItemRequirement(List.of(
new ItemRequirement.StackRequirement(placardStack, ItemUseType.CONSUME),
new ItemRequirement.StrictNbtStackRequirement(heldItem, ItemUseType.CONSUME)
));
}
}
return new ItemRequirement(ItemUseType.CONSUME, placardStack);
}

View file

@ -399,10 +399,10 @@ public class ClientEvents {
}
@SubscribeEvent
public static void loadCompleted(FMLLoadCompleteEvent event) {
public static void onLoadComplete(FMLLoadCompleteEvent event) {
ModContainer createContainer = ModList.get()
.getModContainerById(Create.ID)
.orElseThrow(() -> new IllegalStateException("Create Mod Container missing after loadCompleted"));
.orElseThrow(() -> new IllegalStateException("Create mod container missing on LoadComplete"));
createContainer.registerExtensionPoint(ConfigGuiHandler.ConfigGuiFactory.class,
() -> new ConfigGuiHandler.ConfigGuiFactory(
(mc, previousScreen) -> BaseConfigScreen.forCreate(previousScreen)));

View file

@ -13,6 +13,7 @@ import com.simibubi.create.content.curiosities.zapper.ZapperInteractionHandler;
import com.simibubi.create.content.curiosities.zapper.ZapperItem;
import com.simibubi.create.content.logistics.item.LinkedControllerServerHandler;
import com.simibubi.create.content.logistics.trains.entity.CarriageEntityHandler;
import com.simibubi.create.foundation.ModFilePackResources;
import com.simibubi.create.foundation.command.AllCommands;
import com.simibubi.create.foundation.fluid.FluidHelper;
import com.simibubi.create.foundation.utility.Iterate;
@ -24,6 +25,9 @@ import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackSource;
import net.minecraft.tags.FluidTags;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
@ -34,6 +38,7 @@ import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FluidState;
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
import net.minecraftforge.event.AddPackFindersEvent;
import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.OnDatapackSyncEvent;
@ -55,7 +60,10 @@ import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.forgespi.language.IModFileInfo;
import net.minecraftforge.forgespi.locating.IModFile;
@EventBusSubscriber
public class CommonEvents {
@ -223,6 +231,21 @@ public class CommonEvents {
event.register(CapabilityMinecartController.class);
}
@SubscribeEvent
public static void addPackFinders(AddPackFindersEvent event) {
if (event.getPackType() == PackType.CLIENT_RESOURCES) {
IModFileInfo modFileInfo = ModList.get().getModFileById(Create.ID);
if (modFileInfo == null) {
Create.LOGGER.error("Could not find Create mod file info; built-in resource packs will be missing!");
return;
}
IModFile modFile = modFileInfo.getFile();
event.addRepositorySource((consumer, constructor) -> {
consumer.accept(Pack.create(Create.asResource("legacy_copper").toString(), false, () -> new ModFilePackResources("Create Legacy Copper", modFile, "resourcepacks/legacy_copper"), constructor, Pack.Position.TOP, PackSource.DEFAULT));
});
}
}
}
}

View file

@ -0,0 +1,25 @@
package com.simibubi.create.foundation;
import java.nio.file.Path;
import net.minecraftforge.forgespi.locating.IModFile;
import net.minecraftforge.resource.PathResourcePack;
public class ModFilePackResources extends PathResourcePack {
protected final IModFile modFile;
protected final String sourcePath;
public ModFilePackResources(String name, IModFile modFile, String sourcePath) {
super(name, modFile.findResource(sourcePath));
this.modFile = modFile;
this.sourcePath = sourcePath;
}
@Override
protected Path resolve(String... paths) {
String[] allPaths = new String[paths.length + 1];
allPaths[0] = sourcePath;
System.arraycopy(paths, 0, allPaths, 1, paths.length);
return modFile.findResource(allPaths);
}
}

View file

@ -10,7 +10,6 @@ public class CKinetics extends ConfigBase {
public final ConfigInt maxMotorSpeed = i(256, 64, "maxMotorSpeed", Comments.rpm, Comments.maxMotorSpeed, ConfigAnnotations.RequiresRestart.BOTH.asComment());
public final ConfigInt waterWheelBaseSpeed = i(4, 1, "waterWheelBaseSpeed", Comments.rpm, Comments.waterWheelBaseSpeed);
public final ConfigInt waterWheelFlowSpeed = i(4, 1, "waterWheelFlowSpeed", Comments.rpm, Comments.waterWheelFlowSpeed);
public final ConfigInt furnaceEngineSpeed = i(16, 1, "furnaceEngineSpeed", Comments.rpm, Comments.furnaceEngineSpeed);
public final ConfigInt maxRotationSpeed = i(256, 64, "maxRotationSpeed", Comments.rpm, Comments.maxRotationSpeed);
public final ConfigEnum<DeployerAggroSetting> ignoreDeployerAttacks =
e(DeployerAggroSetting.CREEPERS, "ignoreDeployerAttacks", Comments.ignoreDeployerAttacks);
@ -27,7 +26,6 @@ public class CKinetics extends ConfigBase {
public final ConfigInt fanPullDistance = i(20, 5, "fanPullDistance", Comments.fanPullDistance);
public final ConfigInt fanBlockCheckRate = i(30, 10, "fanBlockCheckRate", Comments.fanBlockCheckRate);
public final ConfigInt fanRotationArgmax = i(256, 64, "fanRotationArgmax", Comments.rpm, Comments.fanRotationArgmax);
public final ConfigInt generatingFanSpeed = i(4, 0, "generatingFanSpeed", Comments.rpm, Comments.generatingFanSpeed);
public final ConfigInt inWorldProcessingTime = i(150, 0, "inWorldProcessingTime", Comments.inWorldProcessingTime);
public final ConfigGroup contraptions = group(1, "contraptions", "Moving Contraptions");
@ -71,7 +69,6 @@ public class CKinetics extends ConfigBase {
static String fanPullDistance = "Maximum distance in blocks from where Fans can pull entities.";
static String fanBlockCheckRate = "Game ticks between Fans checking for anything blocking their air flow.";
static String fanRotationArgmax = "Rotation speed at which the maximum stats of fans are reached.";
static String generatingFanSpeed = "Rotation speed generated by a vertical fan above fire.";
static String inWorldProcessingTime = "Game ticks required for a Fan-based processing recipe to take effect.";
static String crankHungerMultiplier =
"multiplier used for calculating exhaustion from speed when a crank is turned.";
@ -99,7 +96,6 @@ public class CKinetics extends ConfigBase {
static String waterWheelBaseSpeed = "Added rotation speed by a water wheel when at least one flow is present.";
static String waterWheelFlowSpeed =
"Rotation speed gained by a water wheel for each side with running fluids. (halved if not against blades)";
static String furnaceEngineSpeed = "Base rotation speed for the furnace engine generator";
static String disableStress = "Disable the Stress mechanic altogether.";
static String kineticValidationFrequency =
"Game ticks between Kinetic Blocks checking whether their source is still valid.";

View file

@ -1,33 +0,0 @@
package com.simibubi.create.foundation.utility;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Paths;
public class ShippedResourcePacks {
public static void extractFiles(String... packs) {
FilesHelper.createFolderIfMissing("resourcepacks");
for (String name : packs) {
InputStream folderInJar = ShippedResourcePacks.class.getResourceAsStream("/opt_in/" + name + ".zip");
try {
Files.copy(folderInJar, Paths.get("resourcepacks/" + name + ".zip"));
} catch (FileAlreadyExistsException e) {
} catch (IOException e) {
e.printStackTrace();
}
try {
folderInJar.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View file

@ -5,7 +5,8 @@ license="MIT"
[[mods]]
modId="create"
version="${version}"
# The Implementation-Version property in the jar's MANIFEST.MF file will be used as the mod version at runtime
version="${file.jarVersion}"
displayName="Create"
#updateJSONURL=""
displayURL="https://www.curseforge.com/minecraft/mc-mods/create"
@ -18,7 +19,7 @@ Technology that empowers the player.'''
[[dependencies.create]]
modId="forge"
mandatory=true
versionRange="[40.1.0,)"
versionRange="[40.1.60,)"
ordering="NONE"
side="BOTH"
@ -32,6 +33,6 @@ Technology that empowers the player.'''
[[dependencies.create]]
modId="flywheel"
mandatory=true
versionRange="[1.18-0.6.4,1.18-0.6.5)"
versionRange="[0.6.4,0.6.5)"
ordering="AFTER"
side="CLIENT"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 819 B

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 B

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 B

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 B

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 473 B

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 599 B

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 608 B

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 590 B

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 B

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show more