Skip to content

Commit

Permalink
Cherrypick 475 (#478)
Browse files Browse the repository at this point in the history
* 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
mikerooni and screret authored Oct 16, 2023
1 parent 0591fc5 commit f9555ca
Show file tree
Hide file tree
Showing 14 changed files with 394 additions and 216 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ classes/
.architectury-transformer/debug.log
forge/src/generated/resources/.cache/
fabric/src/generated/resources/.cache/

*.patch
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,12 @@
* fix fluid pipe throughput being too low
* fix super tank & quantum tank amount being displayed incorrectly on fabric
* fix wires not being colored
* fix large boiler not resuming work after being unloaded
* fix large boiler not resuming work after being unloaded
* fix large distillery and some GCyM machines not forming
* fix some missing / unnecessary mixer recipes, glass vial material amount, melon maceration
* fix server crashes on multiblock recipe map modification
* fix distinct bus mode not working with circuits config
* fix placement issues when using the terminal to build a multiblock
* fix cherry and bamboo recipes not being affected by the harderWoodRecipes config
* fix spray cans being unable to color vanilla blocks
* add KubeJS bindings for GTFluidStorageKeys, GTFluidState, PropertyKey
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.gregtechceu.gtceu.api.gui.GuiTextures;
import com.gregtechceu.gtceu.api.gui.fancy.IFancyConfigurator;
import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine;
import com.gregtechceu.gtceu.utils.FormattingUtil;
import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture;
import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture;
import com.lowdragmc.lowdraglib.gui.widget.SelectorWidget;
Expand Down Expand Up @@ -71,7 +70,7 @@ public void initWidget() {
setBackground(GuiTextures.BACKGROUND_INVERSE);
addWidget(new SelectorWidget(2, 2, 136, 15, recipeTypeNames, -1).setOnChanged(
rt -> {
machine.setActiveRecipeType(recipeTypeNames.indexOf(rt));
machine.setActiveRecipeType(Math.max(recipeTypeNames.indexOf(rt), 0));
machine.getRecipeLogic().resetRecipeLogic();
}).setSupplier(() -> {
var index = recipeTypeNames.indexOf(Component.translatable(machine.getRecipeType().registryName.toLanguageKey()).getString());
Expand Down
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;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.gregtechceu.gtceu.api.pattern;

import com.gregtechceu.gtceu.api.block.ActiveBlock;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart;
import com.gregtechceu.gtceu.api.pattern.error.PatternError;
import com.gregtechceu.gtceu.api.pattern.error.SinglePredicateError;
import com.gregtechceu.gtceu.api.block.MetaMachineBlock;
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.api.machine.MetaMachine;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController;
import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart;
import com.gregtechceu.gtceu.api.pattern.error.PatternError;
import com.gregtechceu.gtceu.api.pattern.error.PatternStringError;
import com.gregtechceu.gtceu.api.pattern.error.SinglePredicateError;
import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate;
import com.gregtechceu.gtceu.api.pattern.util.PatternMatchContext;
import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection;
Expand Down Expand Up @@ -492,9 +492,9 @@ public BlockInfo[][][] getPreview(int[] repetition) {

private void resetFacing(BlockPos pos, BlockState blockState, Direction facing, BiFunction<BlockPos, Direction, Boolean> checker, Consumer<BlockState> consumer) {
if (blockState.hasProperty(BlockStateProperties.FACING)) {
tryFacings(blockState, pos, checker, consumer, BlockStateProperties.FACING, facing == null ? FACINGS : ArrayUtils.add(FACINGS, facing));
tryFacings(blockState, pos, checker, consumer, BlockStateProperties.FACING, facing == null ? FACINGS : ArrayUtils.addAll(new Direction[]{facing}, FACINGS));
} else if (blockState.hasProperty(BlockStateProperties.HORIZONTAL_FACING)) {
tryFacings(blockState, pos, checker, consumer, BlockStateProperties.HORIZONTAL_FACING, facing == null || facing.getAxis() == Direction.Axis.Y ? FACINGS_H : ArrayUtils.add(FACINGS_H, facing));
tryFacings(blockState, pos, checker, consumer, BlockStateProperties.HORIZONTAL_FACING, facing == null || facing.getAxis() == Direction.Axis.Y ? FACINGS_H : ArrayUtils.addAll(new Direction[]{facing}, FACINGS_H));
}
}

Expand Down
Loading

0 comments on commit f9555ca

Please sign in to comment.