Skip to content

Commit

Permalink
fix plans
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursivePineapple committed Dec 16, 2024
1 parent 820babc commit f87e8f0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public Pair<Boolean, List<BigItemStack>> tryConsumeItems(List<BigItemStack> item
}
}

if ((flags & CONSUME_SIMULATED) != 0) {
return Pair.of(true, extracted);
}

simulated = MMUtils.mapToList(items, BigItemStack::copy);
extracted.clear();

Expand Down Expand Up @@ -561,5 +565,4 @@ private void consumeItemsFromUplink(List<BigItemStack> requestedItems, List<BigI

if (result.right() != null) extractedItems.addAll(result.right());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ public boolean apply(IBlockApplyContext ctx) {
public boolean getRequiredItemsForExistingBlock(IBlockApplyContext context) {
TileEntity te = context.getTileEntity();

if (gt != null) {
if (!gt.getRequiredItemsForExistingBlock(context)) return false;
}

if (ae != null) {
if (!ae.getRequiredItemsForExistingBlock(context)) return false;
}

if (mInventory != null && te instanceof IInventory inventory) {
mInventory.apply(context, inventory, true, true);
}
Expand All @@ -114,6 +122,14 @@ public boolean getRequiredItemsForExistingBlock(IBlockApplyContext context) {
* @return True if this tile result is valid, false otherwise
*/
public boolean getRequiredItemsForNewBlock(IBlockApplyContext context) {
if (gt != null) {
if (!gt.getRequiredItemsForNewBlock(context)) return false;
}

if (ae != null) {
if (!ae.getRequiredItemsForNewBlock(context)) return false;
}

if (mInventory != null) {
for (IItemProvider item : mInventory.mItems) {
if (item != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,7 @@ public static void createPlanImpl(EntityPlayer player, MMState state, ItemMatter

if (stack.getStackSize() - available > 0) {
return String.format(
"%s%s%s: %s%d%s (%s%d%s missing)",
EnumChatFormatting.AQUA.toString(),
"%s%s: %s%d%s (%s%d%s missing)",
stack.getItemStack()
.getDisplayName(),
EnumChatFormatting.GRAY.toString(),
Expand All @@ -885,8 +884,7 @@ public static void createPlanImpl(EntityPlayer player, MMState state, ItemMatter
EnumChatFormatting.GRAY.toString());
} else {
return String.format(
"%s%s%s: %s%d%s",
EnumChatFormatting.AQUA.toString(),
"%s%s: %s%d%s",
stack.getItemStack()
.getDisplayName(),
EnumChatFormatting.GRAY.toString(),
Expand Down

0 comments on commit f87e8f0

Please sign in to comment.