-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63e32bf
commit ae98b03
Showing
14 changed files
with
165 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/dev/latvian/mods/kubejs/core/SizedFluidIngredientKJS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package dev.latvian.mods.kubejs.core; | ||
|
||
import dev.latvian.mods.kubejs.fluid.FluidWrapper; | ||
import dev.latvian.mods.kubejs.recipe.match.FluidMatch; | ||
import dev.latvian.mods.kubejs.recipe.match.Replaceable; | ||
import dev.latvian.mods.kubejs.util.RegistryAccessContainer; | ||
import dev.latvian.mods.rhino.Context; | ||
import dev.latvian.mods.rhino.util.RemapPrefixForJS; | ||
import net.neoforged.neoforge.fluids.FluidStack; | ||
import net.neoforged.neoforge.fluids.crafting.FluidIngredient; | ||
import net.neoforged.neoforge.fluids.crafting.SizedFluidIngredient; | ||
|
||
@RemapPrefixForJS("kjs$") | ||
public interface SizedFluidIngredientKJS extends Replaceable, FluidMatch { | ||
default SizedFluidIngredient kjs$self() { | ||
return (SizedFluidIngredient) (Object) this; | ||
} | ||
|
||
@Override | ||
default Object replaceThisWith(Context cx, Object with) { | ||
var ingredient = FluidWrapper.wrapIngredient(RegistryAccessContainer.of(cx), with); | ||
|
||
if (!ingredient.equals(kjs$self().ingredient())) { | ||
return new SizedFluidIngredient(ingredient, kjs$self().amount()); | ||
} | ||
|
||
return this; | ||
} | ||
|
||
@Override | ||
default boolean matches(Context cx, FluidStack s, boolean exact) { | ||
return ((FluidMatch) kjs$self().ingredient()).matches(cx, s, exact); | ||
} | ||
|
||
@Override | ||
default boolean matches(Context cx, FluidIngredient in, boolean exact) { | ||
return ((FluidMatch) kjs$self().ingredient()).matches(cx, in, exact); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/dev/latvian/mods/kubejs/core/mixin/FluidIngredientMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.latvian.mods.kubejs.core.mixin; | ||
|
||
import dev.latvian.mods.kubejs.core.FluidIngredientKJS; | ||
import dev.latvian.mods.rhino.util.RemapPrefixForJS; | ||
import net.neoforged.neoforge.fluids.crafting.FluidIngredient; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(value = FluidIngredient.class, remap = false) | ||
@RemapPrefixForJS("kjs$") | ||
public abstract class FluidIngredientMixin implements FluidIngredientKJS { | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/dev/latvian/mods/kubejs/core/mixin/SizedFluidIngredientMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.latvian.mods.kubejs.core.mixin; | ||
|
||
import dev.latvian.mods.kubejs.core.SizedFluidIngredientKJS; | ||
import dev.latvian.mods.rhino.util.RemapPrefixForJS; | ||
import net.neoforged.neoforge.fluids.crafting.SizedFluidIngredient; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(value = SizedFluidIngredient.class, remap = false) | ||
@RemapPrefixForJS("kjs$") | ||
public abstract class SizedFluidIngredientMixin implements SizedFluidIngredientKJS { | ||
} |
56 changes: 0 additions & 56 deletions
56
src/main/java/dev/latvian/mods/kubejs/recipe/match/IngredientMatch.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.