mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-15 15:23:13 +00:00
parent
755f8eff93
commit
a2e3d9d9bd
@ -158,8 +158,9 @@ dependencies {
|
||||
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
|
||||
annotationProcessor 'org.spongepowered:mixin:0.8.4:processor'
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.4.1.116:api")
|
||||
// runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.4.1.116")
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.19-forge-api:11.0.0.206")
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.19-common-api:11.0.0.206")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.19-forge:11.0.0.206")
|
||||
|
||||
shade 'org.squiddev:Cobalt:0.5.5'
|
||||
shade('io.netty:netty-codec-http:4.1.76.Final') {
|
||||
|
@ -6,5 +6,5 @@ mod_version=1.100.7
|
||||
# Minecraft properties (update mods.toml when changing)
|
||||
mc_version=1.19
|
||||
mapping_version=2022.03.13
|
||||
forge_version=41.0.16
|
||||
forge_version=41.0.35
|
||||
# NO SERIOUSLY, UPDATE mods.toml WHEN CHANGING
|
||||
|
@ -20,21 +20,22 @@ import dan200.computercraft.shared.turtle.items.ITurtleItem;
|
||||
import dan200.computercraft.shared.turtle.items.TurtleItemFactory;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.JeiPlugin;
|
||||
import mezz.jei.api.constants.VanillaRecipeCategoryUid;
|
||||
import mezz.jei.api.constants.RecipeTypes;
|
||||
import mezz.jei.api.constants.VanillaTypes;
|
||||
import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter;
|
||||
import mezz.jei.api.recipe.IRecipeLookup;
|
||||
import mezz.jei.api.recipe.IRecipeManager;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import mezz.jei.api.registration.IAdvancedRegistration;
|
||||
import mezz.jei.api.registration.ISubtypeRegistration;
|
||||
import mezz.jei.api.runtime.IJeiRuntime;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static dan200.computercraft.shared.integration.jei.RecipeResolver.MAIN_FAMILIES;
|
||||
@ -52,13 +53,13 @@ public class JEIComputerCraft implements IModPlugin
|
||||
@Override
|
||||
public void registerItemSubtypes( ISubtypeRegistration subtypeRegistry )
|
||||
{
|
||||
subtypeRegistry.registerSubtypeInterpreter( Registry.ModItems.TURTLE_NORMAL.get(), turtleSubtype );
|
||||
subtypeRegistry.registerSubtypeInterpreter( Registry.ModItems.TURTLE_ADVANCED.get(), turtleSubtype );
|
||||
subtypeRegistry.registerSubtypeInterpreter( VanillaTypes.ITEM_STACK, Registry.ModItems.TURTLE_NORMAL.get(), turtleSubtype );
|
||||
subtypeRegistry.registerSubtypeInterpreter( VanillaTypes.ITEM_STACK, Registry.ModItems.TURTLE_ADVANCED.get(), turtleSubtype );
|
||||
|
||||
subtypeRegistry.registerSubtypeInterpreter( Registry.ModItems.POCKET_COMPUTER_NORMAL.get(), pocketSubtype );
|
||||
subtypeRegistry.registerSubtypeInterpreter( Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(), pocketSubtype );
|
||||
subtypeRegistry.registerSubtypeInterpreter( VanillaTypes.ITEM_STACK, Registry.ModItems.POCKET_COMPUTER_NORMAL.get(), pocketSubtype );
|
||||
subtypeRegistry.registerSubtypeInterpreter( VanillaTypes.ITEM_STACK, Registry.ModItems.POCKET_COMPUTER_ADVANCED.get(), pocketSubtype );
|
||||
|
||||
subtypeRegistry.registerSubtypeInterpreter( Registry.ModItems.DISK.get(), diskSubtype );
|
||||
subtypeRegistry.registerSubtypeInterpreter( VanillaTypes.ITEM_STACK, Registry.ModItems.DISK.get(), diskSubtype );
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -89,27 +90,22 @@ public class JEIComputerCraft implements IModPlugin
|
||||
|
||||
if( !upgradeItems.isEmpty() )
|
||||
{
|
||||
runtime.getIngredientManager().addIngredientsAtRuntime( VanillaTypes.ITEM, upgradeItems );
|
||||
runtime.getIngredientManager().addIngredientsAtRuntime( VanillaTypes.ITEM_STACK, upgradeItems );
|
||||
}
|
||||
|
||||
// Hide all upgrade recipes
|
||||
IRecipeCategory<?> category = registry.getRecipeCategory( VanillaRecipeCategoryUid.CRAFTING, false );
|
||||
if( category != null )
|
||||
{
|
||||
for( Object wrapper : registry.getRecipes( category, List.of(), false ) )
|
||||
{
|
||||
if( !(wrapper instanceof Recipe) ) continue;
|
||||
ResourceLocation id = ((Recipe<?>) wrapper).getId();
|
||||
if( !id.getNamespace().equals( ComputerCraft.MOD_ID ) ) continue;
|
||||
IRecipeLookup<CraftingRecipe> category = registry.createRecipeLookup( RecipeTypes.CRAFTING );
|
||||
category.get().forEach( wrapper -> {
|
||||
ResourceLocation id = wrapper.getId();
|
||||
if( !id.getNamespace().equals( ComputerCraft.MOD_ID ) ) return;
|
||||
|
||||
String path = id.getPath();
|
||||
if( path.startsWith( "turtle_normal/" ) || path.startsWith( "turtle_advanced/" )
|
||||
|| path.startsWith( "pocket_normal/" ) || path.startsWith( "pocket_advanced/" ) )
|
||||
{
|
||||
registry.hideRecipe( wrapper, VanillaRecipeCategoryUid.CRAFTING );
|
||||
}
|
||||
String path = id.getPath();
|
||||
if( path.startsWith( "turtle_normal/" ) || path.startsWith( "turtle_advanced/" )
|
||||
|| path.startsWith( "pocket_normal/" ) || path.startsWith( "pocket_advanced/" ) )
|
||||
{
|
||||
registry.hideRecipes( RecipeTypes.CRAFTING, Collections.singleton( wrapper ) );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,10 +6,10 @@
|
||||
package dan200.computercraft.shared.integration.jei;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.upgrades.IUpgradeBase;
|
||||
import dan200.computercraft.api.pocket.IPocketUpgrade;
|
||||
import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
||||
import dan200.computercraft.api.turtle.TurtleSide;
|
||||
import dan200.computercraft.api.upgrades.IUpgradeBase;
|
||||
import dan200.computercraft.shared.PocketUpgrades;
|
||||
import dan200.computercraft.shared.TurtleUpgrades;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
@ -17,8 +17,9 @@ import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
|
||||
import dan200.computercraft.shared.pocket.items.PocketComputerItemFactory;
|
||||
import dan200.computercraft.shared.turtle.items.ITurtleItem;
|
||||
import dan200.computercraft.shared.turtle.items.TurtleItemFactory;
|
||||
import mezz.jei.api.constants.VanillaRecipeCategoryUid;
|
||||
import mezz.jei.api.constants.RecipeTypes;
|
||||
import mezz.jei.api.recipe.IFocus;
|
||||
import mezz.jei.api.recipe.RecipeType;
|
||||
import mezz.jei.api.recipe.advanced.IRecipeManagerPlugin;
|
||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||
import net.minecraft.core.NonNullList;
|
||||
@ -95,7 +96,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public <V> List<ResourceLocation> getRecipeCategoryUids( @Nonnull IFocus<V> focus )
|
||||
public <V> List<RecipeType<?>> getRecipeTypes( @Nonnull IFocus<V> focus )
|
||||
{
|
||||
V value = focus.getTypedValue().getIngredient();
|
||||
if( !(value instanceof ItemStack stack) ) return Collections.emptyList();
|
||||
@ -105,11 +106,11 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
case INPUT:
|
||||
return stack.getItem() instanceof ITurtleItem || stack.getItem() instanceof ItemPocketComputer ||
|
||||
hasUpgrade( stack )
|
||||
? Collections.singletonList( VanillaRecipeCategoryUid.CRAFTING )
|
||||
? Collections.singletonList( RecipeTypes.CRAFTING )
|
||||
: Collections.emptyList();
|
||||
case OUTPUT:
|
||||
return stack.getItem() instanceof ITurtleItem || stack.getItem() instanceof ItemPocketComputer
|
||||
? Collections.singletonList( VanillaRecipeCategoryUid.CRAFTING )
|
||||
? Collections.singletonList( RecipeTypes.CRAFTING )
|
||||
: Collections.emptyList();
|
||||
default:
|
||||
return Collections.emptyList();
|
||||
@ -120,7 +121,7 @@ class RecipeResolver implements IRecipeManagerPlugin
|
||||
@Override
|
||||
public <T, V> List<T> getRecipes( @Nonnull IRecipeCategory<T> recipeCategory, @Nonnull IFocus<V> focus )
|
||||
{
|
||||
if( !(focus.getTypedValue().getIngredient() instanceof ItemStack stack) || !recipeCategory.getUid().equals( VanillaRecipeCategoryUid.CRAFTING ) )
|
||||
if( !(focus.getTypedValue().getIngredient() instanceof ItemStack stack) || recipeCategory.getRecipeType() != RecipeTypes.CRAFTING )
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user