Skip to content

Commit

Permalink
fix primitive multis workable
Browse files Browse the repository at this point in the history
fix diamond composition
  • Loading branch information
serenibyss committed Aug 21, 2021
1 parent c50fdb2 commit 0672a79
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ public abstract class AbstractRecipeLogic extends MTETrait implements IWorkable

public final RecipeMap<?> recipeMap;

protected boolean forceRecipeRecheck;
@Deprecated protected ItemStack[] lastItemInputs;
@Deprecated protected FluidStack[] lastFluidInputs;
protected Recipe previousRecipe;
protected boolean allowOverclocking = true;
private long overclockVoltage = 0;
Expand Down Expand Up @@ -218,10 +215,6 @@ protected void trySearchNewRecipe() {
metaTileEntity.getNotifiedFluidInputList().clear();
}

public void forceRecipeRecheck() {
this.forceRecipeRecheck = true;
}

protected int getMinTankCapacity(IMultipleTankHandler tanks) {
if (tanks.getTanks() == 0) {
return 0;
Expand All @@ -237,18 +230,6 @@ protected Recipe findRecipe(long maxVoltage, IItemHandlerModifiable inputs, IMul
return recipeMap.findRecipe(maxVoltage, inputs, fluidInputs, getMinTankCapacity(getOutputTank()), mode);
}

/**
* @deprecated Use {@link #hasNotifiedInputs() } instead
* Left here for binary compatibility purposes
*/
@Deprecated
protected boolean checkRecipeInputsDirty(IItemHandler inputs, IMultipleTankHandler fluidInputs) {
boolean isDirty = this.hasNotifiedInputs();
metaTileEntity.getNotifiedItemInputList().clear();
metaTileEntity.getNotifiedFluidInputList().clear();
return isDirty;
}

protected static boolean areItemStacksEqual(ItemStack stackA, ItemStack stackB) {
return (stackA.isEmpty() && stackB.isEmpty()) ||
(ItemStack.areItemsEqual(stackA, stackB) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public void updateWorkable() {
* Used to reset cached values in the Recipe Logic on structure deform
*/
public void invalidate() {
lastItemInputs = null;
lastFluidInputs = null;
previousRecipe = null;
progressTime = 0;
maxProgressTime = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ protected int getOverclockingTier(long voltage) {
* Used to reset cached values in the Recipe Logic on structure deform
*/
public void invalidate() {
lastItemInputs = null;
lastFluidInputs = null;
previousRecipe = null;
progressTime = 0;
maxProgressTime = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@ protected boolean setupAndConsumeRecipeInputs(Recipe recipe) {
} else return false;
}

// Do this to casually ignore fluids from steam multiblocks
@Override
protected boolean checkRecipeInputsDirty(IItemHandler inputs, IMultipleTankHandler fluidInputs) {
return super.checkRecipeInputsDirty(inputs, new FluidTankList(false));
}

@Override
protected void completeRecipe() {
super.completeRecipe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import gregtech.api.recipes.RecipeMap;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.items.ItemStackHandler;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -21,19 +20,19 @@ public RecipeMapPrimitiveMultiblockController(ResourceLocation metaTileEntityId,

// just initialize inventories based on RecipeMap values by default
protected void initializeAbilities() {
this.importItems = new ItemStackHandler(recipeMapWorkable.recipeMap.getMaxInputs());
this.importFluids = new FluidTankList(true, makeFluidTanks(recipeMapWorkable.recipeMap.getMaxFluidInputs()));
this.exportItems = new ItemStackHandler(recipeMapWorkable.recipeMap.getMaxOutputs());
this.exportFluids = new FluidTankList(false, makeFluidTanks(recipeMapWorkable.recipeMap.getMaxFluidOutputs()));
this.importItems = new NotifiableItemStackHandler(recipeMapWorkable.recipeMap.getMaxInputs(), this, false);
this.importFluids = new FluidTankList(true, makeFluidTanks(recipeMapWorkable.recipeMap.getMaxFluidInputs(), false));
this.exportItems = new NotifiableItemStackHandler(recipeMapWorkable.recipeMap.getMaxOutputs(), this, true);
this.exportFluids = new FluidTankList(false, makeFluidTanks(recipeMapWorkable.recipeMap.getMaxFluidOutputs(), true));

this.itemInventory = new ItemHandlerProxy(this.importItems, this.exportItems);
this.fluidInventory = new FluidHandlerProxy(this.importFluids, this.exportFluids);
}

private List<FluidTank> makeFluidTanks(int length) {
private List<FluidTank> makeFluidTanks(int length, boolean isExport) {
List<FluidTank> fluidTankList = new ArrayList<>(length);
for (int i = 0; i < length; i++) {
fluidTankList.add(new FluidTank(32000));
fluidTankList.add(new NotifiableFluidTank(32000, this, isExport));
}
return fluidTankList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public static void register() {
.color(0xC8FFFF).iconSet(DIAMOND)
.flags(GENERATE_BOLT_SCREW, GENERATE_LENS, GENERATE_GEAR, NO_SMASHING, NO_SMELTING, FLAMMABLE,
HIGH_SIFTER_OUTPUT, DISABLE_DECOMPOSITION, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES)
.components(Carbon, 1)
.toolStats(8.0f, 3.0f, 1280, 15)
.build();

Expand Down

0 comments on commit 0672a79

Please sign in to comment.