mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 02:53:42 +01:00
Not a magic mod
- Fixed Auto-Compacting picking up special gated recipes from the mod Occultism #2070
This commit is contained in:
parent
a6f893da7e
commit
9f558cf419
2 changed files with 19 additions and 4 deletions
|
@ -123,7 +123,7 @@ public class CreateJEI implements IModPlugin {
|
|||
|
||||
autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless)
|
||||
.recipes(r -> r.getSerializer() == IRecipeSerializer.SHAPELESS_RECIPE && r.getIngredients()
|
||||
.size() > 1 && !MechanicalPressTileEntity.canCompress(r.getIngredients()),
|
||||
.size() > 1 && !MechanicalPressTileEntity.canCompress(r),
|
||||
BasinRecipe::convertShapeless)
|
||||
.catalyst(AllBlocks.MECHANICAL_MIXER::get)
|
||||
.catalyst(AllBlocks.BASIN::get)
|
||||
|
@ -160,7 +160,7 @@ public class CreateJEI implements IModPlugin {
|
|||
.build(),
|
||||
|
||||
autoSquare = register("automatic_packing", PackingCategory::autoSquare)
|
||||
.recipes(r -> (r instanceof ICraftingRecipe) && MechanicalPressTileEntity.canCompress(r.getIngredients()),
|
||||
.recipes(r -> (r instanceof ICraftingRecipe) && MechanicalPressTileEntity.canCompress(r),
|
||||
BasinRecipe::convertShapeless)
|
||||
.catalyst(AllBlocks.MECHANICAL_PRESS::get)
|
||||
.catalyst(AllBlocks.BASIN::get)
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
|
@ -31,12 +32,14 @@ import net.minecraft.inventory.IInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ICraftingRecipe;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.particles.ItemParticleData;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
@ -339,7 +342,19 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
|||
return AllRecipeTypes.PRESSING.find(pressingInv, level);
|
||||
}
|
||||
|
||||
public static boolean canCompress(NonNullList<Ingredient> ingredients) {
|
||||
private static final List<ResourceLocation> RECIPE_DENY_LIST =
|
||||
ImmutableList.of(new ResourceLocation("occultism", "spirit_trade"));
|
||||
|
||||
public static <C extends IInventory> boolean canCompress(IRecipe<C> recipe) {
|
||||
NonNullList<Ingredient> ingredients = recipe.getIngredients();
|
||||
if (!(recipe instanceof ICraftingRecipe))
|
||||
return false;
|
||||
|
||||
IRecipeSerializer<?> serializer = recipe.getSerializer();
|
||||
for (ResourceLocation denied : RECIPE_DENY_LIST)
|
||||
if (serializer != null && denied.equals(serializer.getRegistryName()))
|
||||
return false;
|
||||
|
||||
return AllConfigs.SERVER.recipes.allowShapedSquareInPress.get()
|
||||
&& (ingredients.size() == 4 || ingredients.size() == 9) && ItemHelper.condenseIngredients(ingredients)
|
||||
.size() == 1;
|
||||
|
@ -347,7 +362,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
|||
|
||||
@Override
|
||||
protected <C extends IInventory> boolean matchStaticFilters(IRecipe<C> recipe) {
|
||||
return (recipe instanceof ICraftingRecipe && canCompress(recipe.getIngredients()))
|
||||
return (recipe instanceof ICraftingRecipe && canCompress(recipe))
|
||||
|| recipe.getType() == AllRecipeTypes.COMPACTING.getType();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue