Skip to content

Commit

Permalink
Merge pull request Sefiraat#200 from balugaq/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
balugaq authored Jan 21, 2025
2 parents 3a1a9ce + 8a73e6b commit fb6f277
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 611 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ytdd9527.networksexpansion</groupId>
<artifactId>NetworksExpansion</artifactId>
<version>Special-Version-1</version>
<version>Special-Version-2</version>

<distributionManagement>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,11 @@ public class ExpansionItemStacks {
Networks.getLocalizationService().getItem("NTW_EXPANSION_ANNOUNCE_9", Material.BOOK),
Theme.GUIDE
);

public static final SlimefunItemStack NTW_EXPANSION_ANNOUNCE_10 = Theme.themedSlimefunItemStack(
Networks.getLocalizationService().getItem("NTW_EXPANSION_ANNOUNCE_10", Material.BOOK),
Theme.GUIDE
);
public static final SlimefunItemStack NETWORK_CRAFTING_GRID_NEW_STYLE = Theme.themedSlimefunItemStack(
Networks.getLocalizationService().getItem("NTW_EXPANSION_CRAFTING_GRID_NEW_STYLE", Material.CRAFTING_TABLE),
Theme.MACHINE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,14 @@ public class ExpansionItems {
RecipeType.NULL,
ExpansionRecipes.NULL
);

public static final UnusableSlimefunItem NTW_EXPANSION_ANNOUNCE_10 = new UnusableSlimefunItem(
ExpansionItemsMenus.MENU_TROPHY,
ExpansionItemStacks.NTW_EXPANSION_ANNOUNCE_10,
RecipeType.NULL,
ExpansionRecipes.NULL
);

public static final NetworkCraftingGridNewStyle NETWORK_CRAFTING_GRID_NEW_STYLE = new NetworkCraftingGridNewStyle(
ExpansionItemsMenus.MENU_FUNCTIONAL_MACHINE,
ExpansionItemStacks.NETWORK_CRAFTING_GRID_NEW_STYLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static io.github.sefiraat.networks.slimefun.NetworkSlimefunItems.*;

public class ExpansionRecipes {
public static final ItemStack hopper = new ItemStack(Material.HOPPER);

public static final ItemStack[] NULL = new ItemStack[]{
null, null, null,
Expand Down Expand Up @@ -1029,9 +1030,9 @@ SlimefunItems.BASIC_CIRCUIT_BOARD, new ItemStack(Material.NETHER_BRICK_FENCE), S
};

public static final ItemStack[] OFFSETTER = new ItemStack[]{
OPTIC_STAR.getItem(), OPTIC_CABLE.getItem(), OPTIC_STAR.getItem(),
OPTIC_CABLE.getItem(), ExpansionItemStacks.TRANSFER, OPTIC_CABLE.getItem(),
OPTIC_STAR.getItem(), OPTIC_CABLE.getItem(), OPTIC_STAR.getItem()
null, OPTIC_CABLE.getItem(), null,
hopper, NETWORK_MONITOR.getItem(), hopper,
null, OPTIC_CABLE.getItem(), null
};

public static final ItemStack[] BETTER_GRABBER = new ItemStack[]{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ public static void setupItem() {
ExpansionItems.NTW_EXPANSION_ANNOUNCE_6.registerThis(),
ExpansionItems.NTW_EXPANSION_ANNOUNCE_7.registerThis(),
ExpansionItems.NTW_EXPANSION_ANNOUNCE_8.registerThis(),
ExpansionItems.NTW_EXPANSION_ANNOUNCE_9.registerThis()
ExpansionItems.NTW_EXPANSION_ANNOUNCE_9.registerThis(),
ExpansionItems.NTW_EXPANSION_ANNOUNCE_10.registerThis()
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package io.github.sefiraat.networks.integrations;

import com.xzavier0722.mc.plugin.slimefun4.storage.util.StorageCacheUtils;
import com.ytdd9527.networksexpansion.implementation.machines.networks.advanced.AdvancedGreedyBlock;
import io.github.schntgaispock.slimehud.SlimeHUD;
import io.github.schntgaispock.slimehud.util.HudBuilder;
import io.github.schntgaispock.slimehud.waila.HudController;
import io.github.sefiraat.networks.Networks;
import io.github.sefiraat.networks.network.stackcaches.QuantumCache;
import io.github.sefiraat.networks.slimefun.network.NetworkGreedyBlock;
import io.github.sefiraat.networks.slimefun.network.NetworkQuantumStorage;
import io.github.sefiraat.networks.utils.StackUtils;
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import org.bukkit.Location;
Expand Down Expand Up @@ -45,9 +47,34 @@ public static void setup() {
}

ItemStack itemStack = menu.getItemInSlot(NetworkGreedyBlock.INPUT_SLOT);
// Only check type to improve performance
int amount = itemStack == null || itemStack.getType() != templateStack.getType() ? 0 : itemStack.getAmount();
return format(templateStack, amount, templateStack.getMaxStackSize());
});

controller.registerCustomHandler(AdvancedGreedyBlock.class, request -> {
Location location = request.getLocation();
BlockMenu menu = StorageCacheUtils.getMenu(location);
if (menu == null) {
return EMPTY;
}

ItemStack templateStack = menu.getItemInSlot(AdvancedGreedyBlock.TEMPLATE_SLOT);
if (templateStack == null || templateStack.getType() == Material.AIR) {
return EMPTY;
}

int amount = 0;
for (int i : AdvancedGreedyBlock.INPUT_SLOTS) {
ItemStack itemStack = menu.getItemInSlot(i);
// Only check type to improve performance
if (itemStack.getType() == templateStack.getType()) {
amount += itemStack.getAmount();
}
}

return format(templateStack, amount, templateStack.getMaxStackSize());
});
}

private static String format(ItemStack itemStack, long amount, int limit) {
Expand Down
Loading

0 comments on commit fb6f277

Please sign in to comment.