diff --git a/pom.xml b/pom.xml index 39949756..c9e7322c 100644 --- a/pom.xml +++ b/pom.xml @@ -171,7 +171,7 @@ org.projectlombok lombok - 1.18.32 + 1.18.34 provided @@ -209,7 +209,7 @@ com.gmail.nossr50.mcMMO mcMMO - 2.2.012 + 2.2.017 provided diff --git a/src/main/java/io/github/sefiraat/networks/Networks.java b/src/main/java/io/github/sefiraat/networks/Networks.java index efede62b..3fd1599a 100644 --- a/src/main/java/io/github/sefiraat/networks/Networks.java +++ b/src/main/java/io/github/sefiraat/networks/Networks.java @@ -3,8 +3,8 @@ import io.github.sefiraat.networks.commands.NetworksMain; import io.github.sefiraat.networks.managers.ListenerManager; import io.github.sefiraat.networks.managers.SupportedPluginManager; -import io.github.sefiraat.networks.slimefun.HudCallbacks; -import io.github.sefiraat.networks.slimefun.NetheoPlants; +import io.github.sefiraat.networks.integrations.HudCallbacks; +import io.github.sefiraat.networks.integrations.NetheoPlants; import io.github.sefiraat.networks.slimefun.NetworkSlimefunItems; import io.github.sefiraat.networks.slimefun.network.NetworkController; import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon; diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/HudCallbacks.java b/src/main/java/io/github/sefiraat/networks/integrations/HudCallbacks.java similarity index 98% rename from src/main/java/io/github/sefiraat/networks/slimefun/HudCallbacks.java rename to src/main/java/io/github/sefiraat/networks/integrations/HudCallbacks.java index fcd4282e..6dba97d9 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/HudCallbacks.java +++ b/src/main/java/io/github/sefiraat/networks/integrations/HudCallbacks.java @@ -1,4 +1,4 @@ -package io.github.sefiraat.networks.slimefun; +package io.github.sefiraat.networks.integrations; import io.github.schntgaispock.slimehud.SlimeHUD; import io.github.schntgaispock.slimehud.util.HudBuilder; diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/NetheoPlants.java b/src/main/java/io/github/sefiraat/networks/integrations/NetheoPlants.java similarity index 97% rename from src/main/java/io/github/sefiraat/networks/slimefun/NetheoPlants.java rename to src/main/java/io/github/sefiraat/networks/integrations/NetheoPlants.java index 41476475..babb00ae 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/NetheoPlants.java +++ b/src/main/java/io/github/sefiraat/networks/integrations/NetheoPlants.java @@ -1,4 +1,4 @@ -package io.github.sefiraat.networks.slimefun; +package io.github.sefiraat.networks.integrations; import dev.sefiraat.netheopoiesis.api.items.DoNothingSeed; import dev.sefiraat.netheopoiesis.api.items.HarvestableSeed; @@ -9,6 +9,7 @@ import dev.sefiraat.netheopoiesis.utils.Skulls; import dev.sefiraat.netheopoiesis.utils.Theme; import io.github.sefiraat.networks.Networks; +import io.github.sefiraat.networks.slimefun.NetworksSlimefunItemStacks; import io.github.sefiraat.networks.utils.StackUtils; import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack; import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems; diff --git a/src/main/java/io/github/sefiraat/networks/network/NetworkRoot.java b/src/main/java/io/github/sefiraat/networks/network/NetworkRoot.java index dec906c8..766a9d0f 100644 --- a/src/main/java/io/github/sefiraat/networks/network/NetworkRoot.java +++ b/src/main/java/io/github/sefiraat/networks/network/NetworkRoot.java @@ -45,18 +45,18 @@ public class NetworkRoot extends NetworkNode { private final Set wipers = ConcurrentHashMap.newKeySet(); private final Set grabbers = ConcurrentHashMap.newKeySet(); private final Set pushers = ConcurrentHashMap.newKeySet(); + private final Set cutters = ConcurrentHashMap.newKeySet(); + private final Set pasters = ConcurrentHashMap.newKeySet(); + private final Set vacuums = ConcurrentHashMap.newKeySet(); private final Set purgers = ConcurrentHashMap.newKeySet(); private final Set crafters = ConcurrentHashMap.newKeySet(); private final Set powerNodes = ConcurrentHashMap.newKeySet(); + private final Set powerOutlets = ConcurrentHashMap.newKeySet(); private final Set powerDisplays = ConcurrentHashMap.newKeySet(); private final Set encoders = ConcurrentHashMap.newKeySet(); private final Set greedyBlocks = ConcurrentHashMap.newKeySet(); - private final Set cutters = ConcurrentHashMap.newKeySet(); - private final Set pasters = ConcurrentHashMap.newKeySet(); - private final Set vacuums = ConcurrentHashMap.newKeySet(); private final Set wirelessTransmitters = ConcurrentHashMap.newKeySet(); private final Set wirelessReceivers = ConcurrentHashMap.newKeySet(); - private final Set powerOutlets = ConcurrentHashMap.newKeySet(); private Set barrels = null; @@ -87,18 +87,18 @@ public void registerNode(@Nonnull Location location, @Nonnull NodeType type) { case WIPER -> wipers.add(location); case GRABBER -> grabbers.add(location); case PUSHER -> pushers.add(location); + case CUTTER -> cutters.add(location); + case PASTER -> pasters.add(location); + case VACUUM -> vacuums.add(location); case PURGER -> purgers.add(location); case CRAFTER -> crafters.add(location); case POWER_NODE -> powerNodes.add(location); + case POWER_OUTLET -> powerOutlets.add(location); case POWER_DISPLAY -> powerDisplays.add(location); case ENCODER -> encoders.add(location); case GREEDY_BLOCK -> greedyBlocks.add(location); - case CUTTER -> cutters.add(location); - case PASTER -> pasters.add(location); - case VACUUM -> vacuums.add(location); case WIRELESS_TRANSMITTER -> wirelessTransmitters.add(location); case WIRELESS_RECEIVER -> wirelessReceivers.add(location); - case POWER_OUTLET -> powerOutlets.add(location); } } @@ -168,6 +168,18 @@ public Set getPushers() { return this.pushers; } + public Set getCutters() { + return this.cutters; + } + + public Set getPasters() { + return this.pasters; + } + + public Set getVacuums() { + return this.vacuums; + } + public Set getPurgers() { return this.purgers; } @@ -180,6 +192,10 @@ public Set getPowerNodes() { return this.powerNodes; } + public Set getPowerOutlets() { + return this.powerOutlets; + } + public Set getPowerDisplays() { return this.powerDisplays; } @@ -188,16 +204,8 @@ public Set getEncoders() { return this.encoders; } - public Set getCutters() { - return this.cutters; - } - - public Set getPasters() { - return this.pasters; - } - - public Set getVacuums() { - return this.vacuums; + public Set getGreedyBlockLocations() { + return this.greedyBlocks; } public Set getWirelessTransmitters() { @@ -208,10 +216,6 @@ public Set getWirelessReceivers() { return this.wirelessReceivers; } - public Set getPowerOutlets() { - return this.powerOutlets; - } - @Nonnull public Map getAllNetworkItems() { final Map itemStacks = new HashMap<>(); diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/NetworkSlimefunItems.java b/src/main/java/io/github/sefiraat/networks/slimefun/NetworkSlimefunItems.java index 149e5f45..9de83a07 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/NetworkSlimefunItems.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/NetworkSlimefunItems.java @@ -73,7 +73,7 @@ public class NetworkSlimefunItems { public static final NetworkVanillaPusher NETWORK_VANILLA_PUSHER; public static final NetworkWirelessTransmitter NETWORK_WIRELESS_TRANSMITTER; public static final NetworkWirelessReceiver NETWORK_WIRELESS_RECEIVER; - public static final NetworkPurger NETWORK_TRASH; + public static final NetworkPurger NETWORK_PURGER; public static final NetworkGrid NETWORK_GRID; public static final NetworkCraftingGrid NETWORK_CRAFTING_GRID; public static final NetworkCell NETWORK_CELL; @@ -404,7 +404,7 @@ public class NetworkSlimefunItems { } ); - NETWORK_TRASH = new NetworkPurger( + NETWORK_PURGER = new NetworkPurger( NetworksItemGroups.NETWORK_ITEMS, NetworksSlimefunItemStacks.NETWORK_PURGER, RecipeType.ENHANCED_CRAFTING_TABLE, @@ -863,7 +863,7 @@ public static void setup() { NETWORK_VANILLA_PUSHER.register(plugin); NETWORK_WIRELESS_TRANSMITTER.register(plugin); NETWORK_WIRELESS_RECEIVER.register(plugin); - NETWORK_TRASH.register(plugin); + NETWORK_PURGER.register(plugin); NETWORK_GRID.register(plugin); NETWORK_CRAFTING_GRID.register(plugin); NETWORK_CELL.register(plugin); diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkCell.java b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkCell.java index 54dffab8..df1aece9 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkCell.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkCell.java @@ -54,7 +54,7 @@ public boolean canOpen(@Nonnull Block block, @Nonnull Player player) { @Override public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { - return new int[]{0}; + return new int[0]; } }; diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkGreedyBlock.java b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkGreedyBlock.java index 58b209bd..b6f20bf2 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkGreedyBlock.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkGreedyBlock.java @@ -61,7 +61,7 @@ public void init() { @Override public boolean canOpen(@Nonnull Block block, @Nonnull Player player) { - return NetworkSlimefunItems.NETWORK_CELL.canUse(player, false) + return NetworkSlimefunItems.NETWORK_GREEDY_BLOCK.canUse(player, false) && Slimefun.getProtectionManager() .hasPermission(player, block.getLocation(), Interaction.INTERACT_BLOCK); } @@ -71,7 +71,7 @@ public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { if (flow == ItemTransportFlow.INSERT) { return new int[]{INPUT_SLOT}; } - return new int[]{0}; + return new int[0]; } }; diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkPurger.java b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkPurger.java index 946eef4e..0f70aee5 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkPurger.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkPurger.java @@ -125,7 +125,7 @@ public void init() { @Override public boolean canOpen(@Nonnull Block block, @Nonnull Player player) { - return NetworkSlimefunItems.NETWORK_GRID.canUse(player, false) + return NetworkSlimefunItems.NETWORK_PURGER.canUse(player, false) && Slimefun.getProtectionManager().hasPermission(player, block.getLocation(), Interaction.INTERACT_BLOCK); } diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkVacuum.java b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkVacuum.java index 44ad947f..fc70047d 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkVacuum.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkVacuum.java @@ -132,7 +132,7 @@ public void init() { @Override public boolean canOpen(@Nonnull Block block, @Nonnull Player player) { - return NetworkSlimefunItems.NETWORK_GRID.canUse(player, false) + return NetworkSlimefunItems.NETWORK_VACUUM.canUse(player, false) && Slimefun.getProtectionManager() .hasPermission(player, block.getLocation(), Interaction.INTERACT_BLOCK); } diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkVanillaPusher.java b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkVanillaPusher.java index 381f2185..baafe8c0 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkVanillaPusher.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkVanillaPusher.java @@ -122,14 +122,10 @@ private void tryPushItem(@Nonnull BlockMenu blockMenu) { } private void handleFurnace(@Nonnull ItemStack stack, @Nonnull FurnaceInventory furnace) { - if (stack.getType().isFuel() - && (furnace.getFuel() == null || furnace.getFuel().getType() == Material.AIR) - ) { + if (stack.getType().isFuel() && (furnace.getFuel() == null || furnace.getFuel().getType() == Material.AIR)) { furnace.setFuel(stack.clone()); stack.setAmount(0); - } else if (!stack.getType().isFuel() - && (furnace.getSmelting() == null || furnace.getSmelting().getType() == Material.AIR) - ) { + } else if (!stack.getType().isFuel() && (furnace.getSmelting() == null || furnace.getSmelting().getType() == Material.AIR)) { furnace.setSmelting(stack.clone()); stack.setAmount(0); } @@ -140,6 +136,9 @@ private void handleBrewingStand(@Nonnull ItemStack stack, @Nonnull BrewerInvento if (brewer.getFuel() == null || brewer.getFuel().getType() == Material.AIR) { brewer.setFuel(stack.clone()); stack.setAmount(0); + } else if (brewer.getIngredient() == null || brewer.getIngredient().getType() == Material.AIR) { + brewer.setIngredient(stack.clone()); + stack.setAmount(0); } } else if (stack.getType() == Material.POTION) { for (int i = 0; i < 3; i++) { diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkWirelessReceiver.java b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkWirelessReceiver.java index b6416ab6..070c6eee 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkWirelessReceiver.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkWirelessReceiver.java @@ -97,14 +97,14 @@ public void init() { @Override public boolean canOpen(@Nonnull Block block, @Nonnull Player player) { - return NetworkSlimefunItems.NETWORK_CELL.canUse(player, false) + return NetworkSlimefunItems.NETWORK_WIRELESS_RECEIVER.canUse(player, false) && Slimefun.getProtectionManager() .hasPermission(player, block.getLocation(), Interaction.INTERACT_BLOCK); } @Override public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { - return new int[]{0}; + return new int[0]; } }; diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkWirelessTransmitter.java b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkWirelessTransmitter.java index b43de21f..e3d3de98 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkWirelessTransmitter.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/network/NetworkWirelessTransmitter.java @@ -195,14 +195,14 @@ public void init() { @Override public boolean canOpen(@Nonnull Block block, @Nonnull Player player) { - return NetworkSlimefunItems.NETWORK_CELL.canUse(player, false) + return NetworkSlimefunItems.NETWORK_WIRELESS_TRANSMITTER.canUse(player, false) && Slimefun.getProtectionManager() .hasPermission(player, block.getLocation(), Interaction.INTERACT_BLOCK); } @Override public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { - return new int[]{0}; + return new int[0]; } }; diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkProbe.java b/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkProbe.java index 9261c5ea..411d187a 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkProbe.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkProbe.java @@ -68,18 +68,19 @@ private void displayToPlayer(@Nonnull Block block, @Nonnull Player player) { final int wipers = root.getWipers().size(); final int grabbers = root.getGrabbers().size(); final int pushers = root.getPushers().size(); + final int cutters = root.getCutters().size(); + final int pasters = root.getPasters().size(); + final int vacuums = root.getVacuums().size(); final int purgers = root.getPurgers().size(); final int crafters = root.getCrafters().size(); final int powerNodes = root.getPowerNodes().size(); + final int powerOutlets = root.getPowerOutlets().size(); final int powerDisplays = root.getPowerDisplays().size(); final int encoders = root.getEncoders().size(); - final int cutters = root.getCutters().size(); - final int pasters = root.getPasters().size(); - final int vacuums = root.getVacuums().size(); + final int greedyBlocks = root.getGreedyBlockLocations().size(); final int wirelessTransmitters = root.getWirelessTransmitters().size(); final int wirelessReceivers = root.getWirelessReceivers().size(); - final int powerOutlets = root.getPowerOutlets().size(); - final int greedyBlocks = root.getGreedyBlocks().size(); + final long rootPower = root.getRootPower(); final Map allNetworkItems = root.getAllNetworkItems(); final int distinctItems = allNetworkItems.size(); @@ -105,21 +106,26 @@ private void displayToPlayer(@Nonnull Block block, @Nonnull Player player) { player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络内存清除器", p, wipers}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络抓取器", p, grabbers}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络推送器", p, pushers}, new StringBuffer(), null).toString()); + player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络剪切器", p, cutters}, new StringBuffer(), null).toString()); + player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络粘贴器", p, pasters}, new StringBuffer(), null).toString()); + player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络吸尘器", p, vacuums}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络清除器", p, purgers}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络自动合成机", p, crafters}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络能源节点", p, powerNodes}, new StringBuffer(), null).toString()); + player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络插口", p, powerOutlets}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络电表", p, powerDisplays}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络配方编码器", p, encoders}, new StringBuffer(), null).toString()); - player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络剪切器", p, cutters}, new StringBuffer(), null).toString()); - player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络粘贴器", p, pasters}, new StringBuffer(), null).toString()); - player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络吸尘器", p, vacuums}, new StringBuffer(), null).toString()); + player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络阻断器", p, greedyBlocks}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络无线发射器", p, wirelessTransmitters}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络无线接收器", p, wirelessReceivers}, new StringBuffer(), null).toString()); - player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络插口", p, powerOutlets}, new StringBuffer(), null).toString()); - player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络阻断器", p, greedyBlocks}, new StringBuffer(), null).toString()); + + player.sendMessage("------------------------------"); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "物品类型数量", p, distinctItems}, new StringBuffer(), null).toString()); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "累计物品数量", p, totalItems}, new StringBuffer(), null).toString()); + player.sendMessage("------------------------------"); + player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "总电量", p, rootPower}, new StringBuffer(), null).toString()); + player.sendMessage("------------------------------"); player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "累计节点", p, nodeCount + "/" + root.getMaxNodes()}, new StringBuffer(), null).toString()); if (root.isOverburdened()) { diff --git a/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkRake.java b/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkRake.java index a92a3664..8a8269b3 100644 --- a/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkRake.java +++ b/src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkRake.java @@ -7,8 +7,16 @@ import io.github.sefiraat.networks.slimefun.network.NetworkGrabber; import io.github.sefiraat.networks.slimefun.network.NetworkImport; import io.github.sefiraat.networks.slimefun.network.NetworkMonitor; +import io.github.sefiraat.networks.slimefun.network.NetworkVanillaGrabber; +import io.github.sefiraat.networks.slimefun.network.NetworkVanillaPusher; +import io.github.sefiraat.networks.slimefun.network.NetworkWirelessReceiver; +import io.github.sefiraat.networks.slimefun.network.NetworkWirelessTransmitter; import io.github.sefiraat.networks.slimefun.network.NetworkObject; import io.github.sefiraat.networks.slimefun.network.NetworkPusher; +import io.github.sefiraat.networks.slimefun.network.NetworkVanillaGrabber; +import io.github.sefiraat.networks.slimefun.network.NetworkVanillaPusher; +import io.github.sefiraat.networks.slimefun.network.NetworkWirelessReceiver; +import io.github.sefiraat.networks.slimefun.network.NetworkWirelessTransmitter; import io.github.sefiraat.networks.utils.Keys; import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent; import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup; @@ -49,6 +57,10 @@ public NetworkRake(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recip viableObjects.add(NetworkGrabber.class); viableObjects.add(NetworkImport.class); viableObjects.add(NetworkExport.class); + viableObjects.add(NetworkVanillaGrabber.class); + viableObjects.add(NetworkVanillaPusher.class); + viableObjects.add(NetworkWirelessTransmitter.class); + viableObjects.add(NetworkWirelessReceiver.class); } @Override