-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixes (#475) * fix: totally wrong casing requirements, RHF not forming * fix: these shouldn't have mixer recipes, actually + manual ABS recipes * fix #462 * chore: ignore patch files * fix glass vial material amount * fix: melon maceration * fix #470 * fix #459 * fix #447 * actually fix large distillery * fix #333 * chore: update changelog * fix: remove bamboo and cherry recipe modification on 1.19 * chore: more KJS bindings (#471) --------- Co-authored-by: screret <[email protected]>
- Loading branch information
Showing
14 changed files
with
394 additions
and
216 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
62 changes: 62 additions & 0 deletions
62
...on/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyRecipeTrait.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,62 @@ | ||
package com.gregtechceu.gtceu.api.machine.trait; | ||
|
||
import com.gregtechceu.gtceu.api.capability.recipe.IO; | ||
import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler; | ||
import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; | ||
import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; | ||
import com.gregtechceu.gtceu.api.machine.MetaMachine; | ||
import com.gregtechceu.gtceu.api.recipe.GTRecipe; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import net.minecraft.world.item.crafting.Ingredient; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
public class ItemHandlerProxyRecipeTrait extends NotifiableRecipeHandlerTrait<Ingredient> implements ICapabilityTrait { | ||
@Getter | ||
public final IO handlerIO; | ||
@Getter | ||
public final IO capabilityIO; | ||
@Getter @Setter | ||
private long timeStamp; | ||
private boolean enabled; | ||
|
||
@Getter | ||
private final Collection<NotifiableRecipeHandlerTrait<Ingredient>> handlers; | ||
|
||
public ItemHandlerProxyRecipeTrait(MetaMachine machine, Collection<NotifiableRecipeHandlerTrait<Ingredient>> handlers, IO handlerIO, IO capabilityIO) { | ||
super(machine); | ||
this.timeStamp = Long.MIN_VALUE; | ||
this.handlerIO = handlerIO; | ||
this.capabilityIO = capabilityIO; | ||
this.handlers = handlers; | ||
} | ||
|
||
@Override | ||
public List<Ingredient> handleRecipeInner(IO io, GTRecipe recipe, List<Ingredient> left, @Nullable String slotName, boolean simulate) { | ||
if (!enabled) return left; | ||
for (IRecipeHandler<Ingredient> handler : handlers) { | ||
handler.handleRecipeInner(io, recipe, left, slotName, simulate); | ||
if (left.isEmpty()) return null; | ||
} | ||
return left; | ||
} | ||
|
||
@Override | ||
public RecipeCapability<Ingredient> getCapability() { | ||
return ItemRecipeCapability.CAP; | ||
} | ||
|
||
@Override | ||
public boolean isDistinct() { | ||
return handlers.stream().allMatch(NotifiableRecipeHandlerTrait::isDistinct); | ||
} | ||
|
||
@Override | ||
public void setDistinct(boolean distinct) { | ||
handlers.stream().forEach(handler -> handler.setDistinct(distinct)); | ||
this.enabled = distinct; | ||
} | ||
} |
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.