Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/upstream/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/io/github/sefiraat/networks/Networks.java
#	src/main/java/io/github/sefiraat/networks/network/NetworkRoot.java
#	src/main/java/io/github/sefiraat/networks/slimefun/tools/NetworkProbe.java
  • Loading branch information
ybw0014 committed Jul 21, 2024
2 parents 481b77b + bb71d96 commit 284c2a5
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 56 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.32</version>
<version>1.18.34</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -209,7 +209,7 @@
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.2.012</version>
<version>2.2.017</version>
<scope>provided</scope>
</dependency>

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/sefiraat/networks/Networks.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down
48 changes: 26 additions & 22 deletions src/main/java/io/github/sefiraat/networks/network/NetworkRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ public class NetworkRoot extends NetworkNode {
private final Set<Location> wipers = ConcurrentHashMap.newKeySet();
private final Set<Location> grabbers = ConcurrentHashMap.newKeySet();
private final Set<Location> pushers = ConcurrentHashMap.newKeySet();
private final Set<Location> cutters = ConcurrentHashMap.newKeySet();
private final Set<Location> pasters = ConcurrentHashMap.newKeySet();
private final Set<Location> vacuums = ConcurrentHashMap.newKeySet();
private final Set<Location> purgers = ConcurrentHashMap.newKeySet();
private final Set<Location> crafters = ConcurrentHashMap.newKeySet();
private final Set<Location> powerNodes = ConcurrentHashMap.newKeySet();
private final Set<Location> powerOutlets = ConcurrentHashMap.newKeySet();
private final Set<Location> powerDisplays = ConcurrentHashMap.newKeySet();
private final Set<Location> encoders = ConcurrentHashMap.newKeySet();
private final Set<Location> greedyBlocks = ConcurrentHashMap.newKeySet();
private final Set<Location> cutters = ConcurrentHashMap.newKeySet();
private final Set<Location> pasters = ConcurrentHashMap.newKeySet();
private final Set<Location> vacuums = ConcurrentHashMap.newKeySet();
private final Set<Location> wirelessTransmitters = ConcurrentHashMap.newKeySet();
private final Set<Location> wirelessReceivers = ConcurrentHashMap.newKeySet();
private final Set<Location> powerOutlets = ConcurrentHashMap.newKeySet();

private Set<BarrelIdentity> barrels = null;

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -168,6 +168,18 @@ public Set<Location> getPushers() {
return this.pushers;
}

public Set<Location> getCutters() {
return this.cutters;
}

public Set<Location> getPasters() {
return this.pasters;
}

public Set<Location> getVacuums() {
return this.vacuums;
}

public Set<Location> getPurgers() {
return this.purgers;
}
Expand All @@ -180,6 +192,10 @@ public Set<Location> getPowerNodes() {
return this.powerNodes;
}

public Set<Location> getPowerOutlets() {
return this.powerOutlets;
}

public Set<Location> getPowerDisplays() {
return this.powerDisplays;
}
Expand All @@ -188,16 +204,8 @@ public Set<Location> getEncoders() {
return this.encoders;
}

public Set<Location> getCutters() {
return this.cutters;
}

public Set<Location> getPasters() {
return this.pasters;
}

public Set<Location> getVacuums() {
return this.vacuums;
public Set<Location> getGreedyBlockLocations() {
return this.greedyBlocks;
}

public Set<Location> getWirelessTransmitters() {
Expand All @@ -208,10 +216,6 @@ public Set<Location> getWirelessReceivers() {
return this.wirelessReceivers;
}

public Set<Location> getPowerOutlets() {
return this.powerOutlets;
}

@Nonnull
public Map<ItemStack, Integer> getAllNetworkItems() {
final Map<ItemStack, Integer> itemStacks = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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];
}

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ItemStack, Integer> allNetworkItems = root.getAllNetworkItems();
final int distinctItems = allNetworkItems.size();
Expand All @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 284c2a5

Please sign in to comment.