@@ -7,6 +7,11 @@
|
||||
- Fixed Wireless Transmitter only working upright (Darkere)
|
||||
- Fixed Portable Grid not opening when pointing at a block (Darkere)
|
||||
- Fixed being able to circumvent locked slots by scrolling (Darkere)
|
||||
- Processing patterns now use the order of items/fluids specified in the pattern (Darkere, necauqua)
|
||||
- Fixed multiple bugs related to transferring recipes into the crafting grid (Darkere)
|
||||
- Fixed autocrafting task getting stuck if two tasks fulfilled each others requirements (Darkere)
|
||||
- Fixed fluid autocrafting breaking when using 2 stacks of the same fluid in a pattern (Darkere)
|
||||
- Amount specifying screen is now limited to valid values (Darkere)
|
||||
|
||||
### 1.9.16
|
||||
|
||||
|
||||
12
CHANGELOG.md
12
CHANGELOG.md
@@ -9,6 +9,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed multiple bugs related to transferring recipes into the Crafting Grid.
|
||||
- Processing patterns now use the order of items/fluids specified in the pattern
|
||||
by [@necauqua](https://github.com/necauqua) and [@Darkere](https://github.com/Darkere).
|
||||
- Fixed autocrafting task getting stuck if two tasks fulfilled each others requirements.
|
||||
- Fixed fluid autocrafting breaking when using 2 stacks of the same fluid in a pattern.
|
||||
- Amount specifying screen is now limited to valid values.
|
||||
- Fixed crash on servers when starting with latest Forge.
|
||||
|
||||
## [v1.10.0-beta.4] - 2021-12-28
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed client crash when hovering over a fluid in the Fluid Grid by [@jackodsteel](https://github.com/jackodsteel).
|
||||
- Fixed random client crashes when starting the game.
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ apply plugin: 'maven-publish'
|
||||
|
||||
group = 'com.refinedmods'
|
||||
archivesBaseName = 'refinedstorage'
|
||||
version = '1.10.0-beta.4'
|
||||
version = '1.10.0'
|
||||
|
||||
if (System.getenv('GITHUB_SHA') != null) {
|
||||
version += '+' + System.getenv('GITHUB_SHA').substring(0, 7)
|
||||
@@ -102,7 +102,7 @@ processResources {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft 'net.minecraftforge:forge:1.18.1-39.0.0'
|
||||
minecraft 'net.minecraftforge:forge:1.18.1-39.0.59'
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.41:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.41")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.refinedmods.refinedstorage.api.autocrafting;
|
||||
|
||||
import com.refinedmods.refinedstorage.api.util.Action;
|
||||
import com.refinedmods.refinedstorage.api.util.StackListEntry;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -152,7 +151,7 @@ public interface ICraftingPatternContainer {
|
||||
* @param action action to perform
|
||||
* @return whether insertion was successful
|
||||
*/
|
||||
default boolean insertItemsIntoInventory(Collection<StackListEntry<ItemStack>> toInsert, Action action) {
|
||||
default boolean insertItemsIntoInventory(Collection<ItemStack> toInsert, Action action) {
|
||||
IItemHandler dest = getConnectedInventory();
|
||||
|
||||
|
||||
@@ -164,11 +163,10 @@ public interface ICraftingPatternContainer {
|
||||
return false;
|
||||
}
|
||||
|
||||
Deque<StackListEntry<ItemStack>> stacks = new ArrayDeque<>(toInsert);
|
||||
Deque<ItemStack> stacks = new ArrayDeque<>(toInsert);
|
||||
|
||||
StackListEntry<ItemStack> currentEntry = stacks.poll();
|
||||
|
||||
ItemStack current = currentEntry != null ? currentEntry.getStack() : null;
|
||||
ItemStack current = stacks.poll();
|
||||
|
||||
List<Integer> availableSlots = IntStream.range(0, dest.getSlots()).boxed().collect(Collectors.toList());
|
||||
|
||||
@@ -189,9 +187,8 @@ public interface ICraftingPatternContainer {
|
||||
}
|
||||
|
||||
if (remainder.isEmpty()) { // If we inserted successfully, get a next stack.
|
||||
currentEntry = stacks.poll();
|
||||
current = stacks.poll();
|
||||
|
||||
current = currentEntry != null ? currentEntry.getStack() : null;
|
||||
} else if (current.getCount() == remainder.getCount()) { // If we didn't insert anything over ALL these slots, stop here.
|
||||
break;
|
||||
} else { // If we didn't insert all, continue with other slots and use our remainder.
|
||||
@@ -215,7 +212,7 @@ public interface ICraftingPatternContainer {
|
||||
* @param action action to perform
|
||||
* @return whether insertion was successful
|
||||
*/
|
||||
default boolean insertFluidsIntoInventory(Collection<StackListEntry<FluidStack>> toInsert, Action action) {
|
||||
default boolean insertFluidsIntoInventory(Collection<FluidStack> toInsert, Action action) {
|
||||
IFluidHandler dest = getConnectedFluidInventory();
|
||||
|
||||
if (toInsert.isEmpty()) {
|
||||
@@ -226,12 +223,12 @@ public interface ICraftingPatternContainer {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (StackListEntry<FluidStack> entry : toInsert) {
|
||||
int filled = dest.fill(entry.getStack(), action == Action.SIMULATE ? IFluidHandler.FluidAction.SIMULATE : IFluidHandler.FluidAction.EXECUTE);
|
||||
for (FluidStack stack : toInsert) {
|
||||
int filled = dest.fill(stack, action == Action.SIMULATE ? IFluidHandler.FluidAction.SIMULATE : IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
if (filled != entry.getStack().getAmount()) {
|
||||
if (filled != stack.getAmount()) {
|
||||
if (action == Action.PERFORM) {
|
||||
LogManager.getLogger().warn("Inventory unexpectedly didn't accept all of {}, the remainder has been voided!", entry.getStack().getTranslationKey());
|
||||
LogManager.getLogger().warn("Inventory unexpectedly didn't accept all of {}, the remainder has been voided!", stack.getTranslationKey());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.refinedmods.refinedstorage.api.util.Action;
|
||||
import com.refinedmods.refinedstorage.api.util.IComparer;
|
||||
import com.refinedmods.refinedstorage.api.util.IStackList;
|
||||
import com.refinedmods.refinedstorage.api.util.StackListEntry;
|
||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@@ -19,15 +18,15 @@ public final class IoUtil {
|
||||
private IoUtil() {
|
||||
}
|
||||
|
||||
public static IStackList<ItemStack> extractFromInternalItemStorage(IStackList<ItemStack> list, IStorageDisk<ItemStack> storage, Action action) {
|
||||
IStackList<ItemStack> extracted = API.instance().createItemStackList();
|
||||
public static List<ItemStack> extractFromInternalItemStorage(List<ItemStack> list, IStorageDisk<ItemStack> storage, Action action) {
|
||||
List<ItemStack> extracted = new ArrayList<>();
|
||||
|
||||
for (StackListEntry<ItemStack> entry : list.getStacks()) {
|
||||
ItemStack result = storage.extract(entry.getStack(), entry.getStack().getCount(), DEFAULT_EXTRACT_FLAGS, action);
|
||||
for (ItemStack stack : list) {
|
||||
ItemStack result = storage.extract(stack, stack.getCount(), DEFAULT_EXTRACT_FLAGS, action);
|
||||
|
||||
if (result.isEmpty() || result.getCount() != entry.getStack().getCount()) {
|
||||
if (result.isEmpty() || result.getCount() != stack.getCount()) {
|
||||
if (action == Action.PERFORM) {
|
||||
throw new IllegalStateException("The internal crafting inventory reported that " + entry.getStack() + " was available but we got " + result);
|
||||
throw new IllegalStateException("The internal crafting inventory reported that " + stack + " was available but we got " + result);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -39,15 +38,15 @@ public final class IoUtil {
|
||||
return extracted;
|
||||
}
|
||||
|
||||
public static IStackList<FluidStack> extractFromInternalFluidStorage(IStackList<FluidStack> list, IStorageDisk<FluidStack> storage, Action action) {
|
||||
IStackList<FluidStack> extracted = API.instance().createFluidStackList();
|
||||
public static List<FluidStack> extractFromInternalFluidStorage(List<FluidStack> list, IStorageDisk<FluidStack> storage, Action action) {
|
||||
List<FluidStack> extracted = new ArrayList<>();
|
||||
|
||||
for (StackListEntry<FluidStack> entry : list.getStacks()) {
|
||||
FluidStack result = storage.extract(entry.getStack(), entry.getStack().getAmount(), DEFAULT_EXTRACT_FLAGS, action);
|
||||
for (FluidStack stack : list) {
|
||||
FluidStack result = storage.extract(stack, stack.getAmount(), DEFAULT_EXTRACT_FLAGS, action);
|
||||
|
||||
if (result.isEmpty() || result.getAmount() != entry.getStack().getAmount()) {
|
||||
if (result.isEmpty() || result.getAmount() != stack.getAmount()) {
|
||||
if (action == Action.PERFORM) {
|
||||
throw new IllegalStateException("The internal crafting inventory reported that " + entry.getStack() + " was available but we got " + result);
|
||||
throw new IllegalStateException("The internal crafting inventory reported that " + stack + " was available but we got " + result);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -257,7 +257,7 @@ public class CraftingCalculator {
|
||||
FluidStack fromSelf = fluidResults.get(possibleInput, IComparer.COMPARE_NBT);
|
||||
FluidStack fromNetwork = fluidStorageSource.get(possibleInput, IComparer.COMPARE_NBT);
|
||||
|
||||
int remaining = possibleInput.getAmount() * qty;
|
||||
int remaining = ingredient.getCount() * qty;
|
||||
|
||||
if (remaining < 0) { // int overflow
|
||||
throw new CraftingCalculatorException(CalculationResultType.TOO_COMPLEX);
|
||||
|
||||
@@ -11,12 +11,10 @@ import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class NodeRequirements {
|
||||
private static final String NBT_ITEMS_TO_USE = "ItemsToUse";
|
||||
@@ -32,9 +30,9 @@ public class NodeRequirements {
|
||||
private final Map<Integer, Integer> fluidsNeededPerCraft = new LinkedHashMap<>();
|
||||
|
||||
@Nullable
|
||||
private IStackList<ItemStack> cachedSimulatedItemRequirementSet = null;
|
||||
private List<ItemStack> cachedSimulatedItemRequirementSet = null;
|
||||
@Nullable
|
||||
private IStackList<FluidStack> cachedSimulatedFluidRequirementSet = null;
|
||||
private List<FluidStack> cachedSimulatedFluidRequirementSet = null;
|
||||
|
||||
public void addItemRequirement(int ingredientNumber, ItemStack stack, int size, int perCraft) {
|
||||
if (!itemsNeededPerCraft.containsKey(ingredientNumber)) {
|
||||
@@ -56,13 +54,13 @@ public class NodeRequirements {
|
||||
cachedSimulatedFluidRequirementSet = null;
|
||||
}
|
||||
|
||||
public IStackList<ItemStack> getSingleItemRequirementSet(boolean simulate) {
|
||||
IStackList<ItemStack> cached = cachedSimulatedItemRequirementSet;
|
||||
public List<ItemStack> getSingleItemRequirementSet(boolean simulate) {
|
||||
List<ItemStack> cached = cachedSimulatedItemRequirementSet;
|
||||
if (simulate && cached != null) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
IStackList<ItemStack> toReturn = API.instance().createItemStackList();
|
||||
List<ItemStack> toReturn = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < itemRequirements.size(); i++) {
|
||||
int needed = itemsNeededPerCraft.get(i);
|
||||
@@ -78,7 +76,7 @@ public class NodeRequirements {
|
||||
itemRequirements.get(i).remove(toUse, needed);
|
||||
}
|
||||
|
||||
toReturn.add(toUse, needed);
|
||||
toReturn.add(ItemHandlerHelper.copyStackWithSize(toUse, needed));
|
||||
|
||||
needed = 0;
|
||||
} else {
|
||||
@@ -101,13 +99,13 @@ public class NodeRequirements {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public IStackList<FluidStack> getSingleFluidRequirementSet(boolean simulate) {
|
||||
IStackList<FluidStack> cached = cachedSimulatedFluidRequirementSet;
|
||||
public List<FluidStack> getSingleFluidRequirementSet(boolean simulate) {
|
||||
List<FluidStack> cached = cachedSimulatedFluidRequirementSet;
|
||||
if (simulate && cached != null) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
IStackList<FluidStack> toReturn = API.instance().createFluidStackList();
|
||||
List<FluidStack> toReturn = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < fluidRequirements.size(); i++) {
|
||||
int needed = fluidsNeededPerCraft.get(i);
|
||||
@@ -123,7 +121,9 @@ public class NodeRequirements {
|
||||
fluidRequirements.get(i).remove(toUse, needed);
|
||||
}
|
||||
|
||||
toReturn.add(toUse, needed);
|
||||
FluidStack stack = toUse.copy();
|
||||
stack.setAmount(needed);
|
||||
toReturn.add(stack);
|
||||
|
||||
needed = 0;
|
||||
} else {
|
||||
|
||||
@@ -11,11 +11,15 @@ import com.refinedmods.refinedstorage.api.util.StackListEntry;
|
||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||
import com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.IoUtil;
|
||||
import com.refinedmods.refinedstorage.apiimpl.autocrafting.task.v6.SerializationUtil;
|
||||
import com.refinedmods.refinedstorage.apiimpl.util.FluidStackList;
|
||||
import com.refinedmods.refinedstorage.apiimpl.util.ItemStackList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ProcessingNode extends Node {
|
||||
private static final String NBT_ITEMS_RECEIVED = "ItemsReceived";
|
||||
private static final String NBT_FLUIDS_RECEIVED = "FluidsReceived";
|
||||
@@ -69,7 +73,7 @@ public class ProcessingNode extends Node {
|
||||
@Override
|
||||
public void update(INetwork network, int ticks, NodeList nodes, IStorageDisk<ItemStack> internalStorage, IStorageDisk<FluidStack> internalFluidStorage, NodeListener listener) {
|
||||
if (getQuantity() <= 0) {
|
||||
if (state == ProcessingState.PROCESSED) {
|
||||
if (totalQuantity == quantityFinished) {
|
||||
listener.onAllDone(this);
|
||||
}
|
||||
return;
|
||||
@@ -117,8 +121,8 @@ public class ProcessingNode extends Node {
|
||||
|
||||
boolean hasAllRequirements = false;
|
||||
|
||||
IStackList<ItemStack> extractedItems = IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(true), internalStorage, Action.SIMULATE);
|
||||
IStackList<FluidStack> extractedFluids = null;
|
||||
List<ItemStack> extractedItems = IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(true), internalStorage, Action.SIMULATE);
|
||||
List<FluidStack> extractedFluids = null;
|
||||
if (extractedItems != null) {
|
||||
extractedFluids = IoUtil.extractFromInternalFluidStorage(requirements.getSingleFluidRequirementSet(true), internalFluidStorage, Action.SIMULATE);
|
||||
if (extractedFluids != null) {
|
||||
@@ -128,9 +132,9 @@ public class ProcessingNode extends Node {
|
||||
|
||||
boolean canInsertFullAmount = false;
|
||||
if (hasAllRequirements) {
|
||||
canInsertFullAmount = container.insertItemsIntoInventory(extractedItems.getStacks(), Action.SIMULATE);
|
||||
canInsertFullAmount = container.insertItemsIntoInventory(extractedItems, Action.SIMULATE);
|
||||
if (canInsertFullAmount) {
|
||||
canInsertFullAmount = container.insertFluidsIntoInventory(extractedFluids.getStacks(), Action.SIMULATE);
|
||||
canInsertFullAmount = container.insertFluidsIntoInventory(extractedFluids, Action.SIMULATE);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
@@ -151,8 +155,8 @@ public class ProcessingNode extends Node {
|
||||
extractedItems = IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(false), internalStorage, Action.PERFORM);
|
||||
extractedFluids = IoUtil.extractFromInternalFluidStorage(requirements.getSingleFluidRequirementSet(false), internalFluidStorage, Action.PERFORM);
|
||||
|
||||
container.insertItemsIntoInventory(extractedItems.getStacks(), Action.PERFORM);
|
||||
container.insertFluidsIntoInventory(extractedFluids.getStacks(), Action.PERFORM);
|
||||
container.insertItemsIntoInventory(extractedItems, Action.PERFORM);
|
||||
container.insertFluidsIntoInventory(extractedFluids, Action.PERFORM);
|
||||
|
||||
next();
|
||||
|
||||
@@ -239,18 +243,14 @@ public class ProcessingNode extends Node {
|
||||
}
|
||||
|
||||
this.quantityFinished = tempQuantityFinished;
|
||||
|
||||
if (this.quantityFinished == this.totalQuantity) {
|
||||
this.state = ProcessingState.PROCESSED;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculationFinished() {
|
||||
super.onCalculationFinished();
|
||||
|
||||
this.singleItemSetToRequire = requirements.getSingleItemRequirementSet(true);
|
||||
this.singleFluidSetToRequire = requirements.getSingleFluidRequirementSet(true);
|
||||
this.singleItemSetToRequire = new ItemStackList(requirements.getSingleItemRequirementSet(true));
|
||||
this.singleFluidSetToRequire = new FluidStackList(requirements.getSingleFluidRequirementSet(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -210,7 +210,7 @@ public class CraftingGridBehavior implements ICraftingGridBehavior {
|
||||
// If we are connected, first try to get the possibilities from the network
|
||||
if (network != null && grid.isGridActive()) {
|
||||
for (ItemStack possibility : possibilities) {
|
||||
ItemStack took = network.extractItem(possibility, 1, IComparer.COMPARE_NBT, Action.PERFORM);
|
||||
ItemStack took = network.extractItem(possibility, possibility.getCount(), IComparer.COMPARE_NBT, Action.PERFORM);
|
||||
|
||||
if (!took.isEmpty()) {
|
||||
grid.getCraftingMatrix().setItem(i, took);
|
||||
|
||||
@@ -19,6 +19,15 @@ public class FluidStackList implements IStackList<FluidStack> {
|
||||
private final ArrayListMultimap<Fluid, StackListEntry<FluidStack>> stacks = ArrayListMultimap.create();
|
||||
private final Map<UUID, FluidStack> index = new HashMap<>();
|
||||
|
||||
public FluidStackList() {
|
||||
}
|
||||
|
||||
public FluidStackList(Iterable<FluidStack> stacks) {
|
||||
for (FluidStack stack : stacks) {
|
||||
add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StackListResult<FluidStack> add(@Nonnull FluidStack stack, int size) {
|
||||
if (stack.isEmpty() || size <= 0) {
|
||||
|
||||
@@ -20,6 +20,15 @@ public class ItemStackList implements IStackList<ItemStack> {
|
||||
private final ArrayListMultimap<Item, StackListEntry<ItemStack>> stacks = ArrayListMultimap.create();
|
||||
private final Map<UUID, ItemStack> index = new HashMap<>();
|
||||
|
||||
public ItemStackList() {
|
||||
}
|
||||
|
||||
public ItemStackList(Iterable<ItemStack> stacks) {
|
||||
for (ItemStack stack : stacks) {
|
||||
add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StackListResult<ItemStack> add(@Nonnull ItemStack stack, int size) {
|
||||
if (stack.isEmpty() || size <= 0) {
|
||||
|
||||
@@ -151,14 +151,15 @@ public class GridRecipeTransferHandler implements IRecipeTransferHandler<GridCon
|
||||
if (gridContainer.getGrid().getGridType() == GridType.PATTERN && !(recipe instanceof CraftingRecipe)) {
|
||||
moveForProcessing(recipeLayout, tracker);
|
||||
} else {
|
||||
move(gridContainer, recipeLayout);
|
||||
move(gridContainer, recipeLayout, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
private void move(GridContainerMenu gridContainer, IRecipeLayout recipeLayout) {
|
||||
private void move(GridContainerMenu gridContainer, IRecipeLayout recipeLayout, Object recipe) {
|
||||
RS.NETWORK_HANDLER.sendToServer(new GridTransferMessage(
|
||||
recipeLayout.getItemStacks().getGuiIngredients(),
|
||||
gridContainer.slots.stream().filter(s -> s.container instanceof CraftingContainer).collect(Collectors.toList())
|
||||
gridContainer.slots.stream().filter(s -> s.container instanceof CraftingContainer).collect(Collectors.toList()),
|
||||
recipe instanceof CraftingRecipe
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PatternItem extends Item implements ICraftingPatternProvider, IItemRenderProperties {
|
||||
public class PatternItem extends Item implements ICraftingPatternProvider {
|
||||
private static final Map<ItemStackKey, ICraftingPattern> CACHE = new HashMap<>();
|
||||
|
||||
private static final String NBT_VERSION = "Version";
|
||||
|
||||
@@ -20,13 +20,15 @@ public class GridTransferMessage {
|
||||
private final ItemStack[][] recipe = new ItemStack[9][];
|
||||
private Map<Integer, ? extends IGuiIngredient<ItemStack>> inputs;
|
||||
private List<Slot> slots;
|
||||
boolean isCraftingRecipe;
|
||||
|
||||
public GridTransferMessage() {
|
||||
}
|
||||
|
||||
public GridTransferMessage(Map<Integer, ? extends IGuiIngredient<ItemStack>> inputs, List<Slot> slots) {
|
||||
public GridTransferMessage(Map<Integer, ? extends IGuiIngredient<ItemStack>> inputs, List<Slot> slots, boolean isCraftingRecipe) {
|
||||
this.inputs = inputs;
|
||||
this.slots = slots;
|
||||
this.isCraftingRecipe = isCraftingRecipe;
|
||||
}
|
||||
|
||||
public static GridTransferMessage decode(FriendlyByteBuf buf) {
|
||||
@@ -51,7 +53,7 @@ public class GridTransferMessage {
|
||||
buf.writeInt(message.slots.size());
|
||||
|
||||
for (Slot slot : message.slots) {
|
||||
IGuiIngredient<ItemStack> ingredient = message.inputs.get(slot.getSlotIndex() + 1);
|
||||
IGuiIngredient<ItemStack> ingredient = message.inputs.get(slot.getSlotIndex() + (message.isCraftingRecipe ? 1 : 0));
|
||||
|
||||
List<ItemStack> ingredients = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -64,6 +64,18 @@ public abstract class AmountSpecifyingScreen<T extends AbstractContainerMenu> ex
|
||||
amountField.setTextColor(RenderSettings.INSTANCE.getSecondaryColor());
|
||||
amountField.setCanLoseFocus(false);
|
||||
amountField.changeFocus(true);
|
||||
amountField.setResponder(text -> {
|
||||
int amount = 0;
|
||||
try {
|
||||
amount = Integer.parseInt(amountField.getValue());
|
||||
} catch (NumberFormatException e) {
|
||||
// NO OP
|
||||
}
|
||||
|
||||
if (amount > getMaxAmount()) {
|
||||
amountField.setValue(String.valueOf(getMaxAmount()));
|
||||
}
|
||||
});
|
||||
|
||||
addRenderableWidget(amountField);
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ public abstract class BaseScreen<T extends AbstractContainerMenu> extends Abstra
|
||||
minecraft.player,
|
||||
slot.index,
|
||||
slot.getItem(),
|
||||
slot.getMaxStackSize(),
|
||||
Math.min(slot.getMaxStackSize(), slot.getItem().getMaxStackSize()),
|
||||
((FilterSlot) slot).isAlternativesAllowed() ? (parent -> new AlternativesScreen(
|
||||
parent,
|
||||
minecraft.player,
|
||||
|
||||
@@ -320,7 +320,7 @@ public class GridScreen extends BaseScreen<GridContainerMenu> implements IScreen
|
||||
return RenderUtils.inBounds(82, y, 7, 7, mouseX, mouseY);
|
||||
case PATTERN:
|
||||
if (((GridNetworkNode) grid).isProcessingPattern()) {
|
||||
return RenderUtils.inBounds(154, y, 7, 7, mouseX, mouseY);
|
||||
return RenderUtils.inBounds(149, y, 7, 7, mouseX, mouseY);
|
||||
}
|
||||
|
||||
return RenderUtils.inBounds(82, y, 7, 7, mouseX, mouseY);
|
||||
|
||||
Reference in New Issue
Block a user