Class DifferenceIngredient
java.lang.Object
net.minecraft.world.item.crafting.Ingredient
net.neoforged.neoforge.common.crafting.DifferenceIngredient
Ingredient that matches everything from the first ingredient that is not included in the second ingredient
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static final record
Nested classes/interfaces inherited from class net.minecraft.world.item.crafting.Ingredient
Ingredient.ItemValue, Ingredient.TagValue, Ingredient.Value
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Ingredient
static final com.mojang.serialization.Codec<DifferenceIngredient>
static final com.mojang.serialization.Codec<DifferenceIngredient>
private final Ingredient
Fields inherited from class net.minecraft.world.item.crafting.Ingredient
EMPTY, LIST_CODEC, LIST_CODEC_NONEMPTY, values, VANILLA_CODEC, VANILLA_CODEC_NONEMPTY
-
Constructor Summary
ModifierConstructorDescriptionprotected
DifferenceIngredient
(Ingredient base, Ingredient subtracted) -
Method Summary
Modifier and TypeMethodDescriptiongetBase()
getItems()
it.unimi.dsi.fastutil.ints.IntList
boolean
isSimple()
static DifferenceIngredient
of
(Ingredient base, Ingredient subtracted) Gets the difference from the two ingredientsboolean
Returns iftrue
, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via thecodec
.boolean
Methods inherited from class net.minecraft.world.item.crafting.Ingredient
areStacksEqual, equals, fromJson, fromNetwork, fromValues, getType, getValues, isEmpty, of, of, of, of, of, toJson, toNetwork
-
Field Details
-
CODEC
-
CODEC_NONEMPTY
-
base
-
subtracted
-
-
Constructor Details
-
DifferenceIngredient
-
-
Method Details
-
getBase
-
getSubtracted
-
isSimple
public boolean isSimple()- Overrides:
isSimple
in classIngredient
-
getItems
- Overrides:
getItems
in classIngredient
-
test
- Specified by:
test
in interfacePredicate<ItemStack>
- Overrides:
test
in classIngredient
-
getStackingIds
public it.unimi.dsi.fastutil.ints.IntList getStackingIds()- Overrides:
getStackingIds
in classIngredient
-
synchronizeWithContents
public boolean synchronizeWithContents()Description copied from class:Ingredient
Returns iftrue
, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via thecodec
.- Overrides:
synchronizeWithContents
in classIngredient
- Returns:
- if
true
, this ingredient will be synchronized using its contents, as in vanilla, otherwise it will be synchronized via thecodec
-
of
Gets the difference from the two ingredients- Parameters:
base
- Ingredient the item must matchsubtracted
- Ingredient the item must not match- Returns:
- Ingredient that
base
anything in base that is not insubtracted
-