mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 23:47:38 +01:00
Merge pull request #6385 from Attack8/mc1.18/ManualOnly
Respect Manual Only Recipes
This commit is contained in:
commit
649a5936ec
3 changed files with 32 additions and 10 deletions
|
@ -143,6 +143,7 @@ public class CreateJEI implements IModPlugin {
|
|||
|
||||
smoking = builder(SmokingRecipe.class)
|
||||
.addTypedRecipes(() -> RecipeType.SMOKING)
|
||||
.removeNonAutomation()
|
||||
.catalystStack(ProcessingViaFanCategory.getFan("fan_smoking"))
|
||||
.doubleItemIcon(AllItems.PROPELLER.get(), Items.CAMPFIRE)
|
||||
.emptyBackground(178, 72)
|
||||
|
@ -152,6 +153,7 @@ public class CreateJEI implements IModPlugin {
|
|||
.addTypedRecipesExcluding(() -> RecipeType.SMELTING, () -> RecipeType.BLASTING)
|
||||
.addTypedRecipes(() -> RecipeType.BLASTING)
|
||||
.removeRecipes(() -> RecipeType.SMOKING)
|
||||
.removeNonAutomation()
|
||||
.catalystStack(ProcessingViaFanCategory.getFan("fan_blasting"))
|
||||
.doubleItemIcon(AllItems.PROPELLER.get(), Items.LAVA_BUCKET)
|
||||
.emptyBackground(178, 72)
|
||||
|
@ -257,6 +259,7 @@ public class CreateJEI implements IModPlugin {
|
|||
.addTypedRecipes(AllRecipeTypes.DEPLOYING)
|
||||
.addTypedRecipes(AllRecipeTypes.SANDPAPER_POLISHING::getType, DeployerApplicationRecipe::convert)
|
||||
.addTypedRecipes(AllRecipeTypes.ITEM_APPLICATION::getType, ManualApplicationRecipe::asDeploying)
|
||||
.removeNonAutomation()
|
||||
.catalyst(AllBlocks.DEPLOYER::get)
|
||||
.catalyst(AllBlocks.DEPOT::get)
|
||||
.catalyst(AllItems.BELT_CONNECTOR::get)
|
||||
|
@ -464,6 +467,11 @@ public class CreateJEI implements IModPlugin {
|
|||
});
|
||||
}
|
||||
|
||||
public CategoryBuilder<T> removeNonAutomation() {
|
||||
return addRecipeListConsumer(recipes -> recipes.removeIf(recipe ->
|
||||
recipe.getId().getPath().contains("_manual_only")));
|
||||
}
|
||||
|
||||
public CategoryBuilder<T> catalystStack(Supplier<ItemStack> supplier) {
|
||||
catalysts.add(supplier);
|
||||
return this;
|
||||
|
|
|
@ -5,6 +5,7 @@ import static com.simibubi.create.content.kinetics.base.DirectionalKineticBlock.
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -46,9 +47,11 @@ import net.minecraft.world.InteractionHand;
|
|||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.ClipContext.Block;
|
||||
import net.minecraft.world.level.ClipContext.Fluid;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -547,8 +550,10 @@ public class DeployerBlockEntity extends KineticBlockEntity {
|
|||
ItemStack heldItemMainhand = player.getMainHandItem();
|
||||
if (heldItemMainhand.getItem() instanceof SandPaperItem) {
|
||||
sandpaperInv.setItem(0, stack);
|
||||
return AllRecipeTypes.SANDPAPER_POLISHING.find(sandpaperInv, level)
|
||||
.orElse(null);
|
||||
Optional<Recipe<SandPaperInv>> sandPaperRecipe = AllRecipeTypes.SANDPAPER_POLISHING.find(sandpaperInv, level);
|
||||
if (sandPaperRecipe.isPresent() && !sandPaperRecipe.get().getId().getPath().endsWith("_manual_only"))
|
||||
return sandPaperRecipe.get();
|
||||
return null;
|
||||
}
|
||||
|
||||
recipeInv.setItem(0, stack);
|
||||
|
@ -558,13 +563,20 @@ public class DeployerBlockEntity extends KineticBlockEntity {
|
|||
|
||||
event.addRecipe(() -> SequencedAssemblyRecipe.getRecipe(level, event.getInventory(),
|
||||
AllRecipeTypes.DEPLOYING.getType(), DeployerApplicationRecipe.class), 100);
|
||||
event.addRecipe(() -> AllRecipeTypes.DEPLOYING.find(event.getInventory(), level), 50);
|
||||
event.addRecipe(() -> AllRecipeTypes.ITEM_APPLICATION.find(event.getInventory(), level), 50);
|
||||
event.addRecipe(() -> checkRecipe(AllRecipeTypes.DEPLOYING, event.getInventory(), level), 50);
|
||||
event.addRecipe(() -> checkRecipe(AllRecipeTypes.ITEM_APPLICATION, event.getInventory(), level), 50);
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getRecipe();
|
||||
}
|
||||
|
||||
private Optional<? extends Recipe<? extends Container>> checkRecipe(AllRecipeTypes type, RecipeWrapper inv, Level level) {
|
||||
Optional<? extends Recipe<? extends Container>> opt = type.find(inv, level);
|
||||
if (opt.isPresent() && !opt.get().getId().getPath().contains("_manual_only"))
|
||||
return opt;
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public DeployerFakePlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
|
|
@ -162,15 +162,17 @@ public class AllFanProcessingTypes {
|
|||
Optional<SmeltingRecipe> smeltingRecipe = level.getRecipeManager()
|
||||
.getRecipeFor(RecipeType.SMELTING, RECIPE_WRAPPER, level);
|
||||
|
||||
if (smeltingRecipe.isPresent())
|
||||
return true;
|
||||
if (smeltingRecipe.isPresent()) {
|
||||
return !smeltingRecipe.get().getId().getPath().endsWith("_manual_only");
|
||||
}
|
||||
|
||||
RECIPE_WRAPPER.setItem(0, stack);
|
||||
Optional<BlastingRecipe> blastingRecipe = level.getRecipeManager()
|
||||
.getRecipeFor(RecipeType.BLASTING, RECIPE_WRAPPER, level);
|
||||
|
||||
if (blastingRecipe.isPresent())
|
||||
return true;
|
||||
if (blastingRecipe.isPresent()) {
|
||||
return !blastingRecipe.get().getId().getPath().endsWith("_manual_only");
|
||||
}
|
||||
|
||||
return !stack.getItem()
|
||||
.isFireResistant();
|
||||
|
@ -390,7 +392,7 @@ public class AllFanProcessingTypes {
|
|||
RECIPE_WRAPPER.setItem(0, stack);
|
||||
Optional<SmokingRecipe> recipe = level.getRecipeManager()
|
||||
.getRecipeFor(RecipeType.SMOKING, RECIPE_WRAPPER, level);
|
||||
return recipe.isPresent();
|
||||
return recipe.isPresent() && !recipe.get().getId().getPath().endsWith("_manual_only");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue