Skip to content

Commit

Permalink
feat(probe): 增加更多节点显示,resolves #111
Browse files Browse the repository at this point in the history
  • Loading branch information
ybw0014 committed Jun 8, 2024
1 parent 3e44e46 commit 4d2f197
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@

<!-- Supported Plugins -->
<dependency>
<groupId>io.github.mooy1</groupId>
<groupId>com.github.SlimefunGuguProject</groupId>
<artifactId>InfinityExpansion</artifactId>
<version>90e11bc</version>
<version>3c5db3650a</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -211,7 +211,7 @@
<dependency>
<groupId>net.guizhanss</groupId>
<artifactId>GuizhanLibPlugin</artifactId>
<version>1.5.0</version>
<version>1.7.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/io/github/sefiraat/networks/network/NetworkRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public class NetworkRoot extends NetworkNode {
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 @@ -85,6 +91,12 @@ public void registerNode(@Nonnull Location location, @Nonnull NodeType type) {
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 @@ -174,6 +186,30 @@ 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> getWirelessTransmitters() {
return this.wirelessTransmitters;
}

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,6 +73,13 @@ private void displayToPlayer(@Nonnull Block block, @Nonnull Player player) {
final int powerNodes = root.getPowerNodes().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 wirelessTransmitters = root.getWirelessTransmitters().size();
final int wirelessReceivers = root.getWirelessReceivers().size();
final int powerOutlets = root.getPowerOutlets().size();
final int greedyBlocks = root.getGreedyBlocks().size();

final Map<ItemStack, Integer> allNetworkItems = root.getAllNetworkItems();
final int distinctItems = allNetworkItems.size();
Expand Down Expand Up @@ -103,6 +110,13 @@ private void displayToPlayer(@Nonnull Block block, @Nonnull Player player) {
player.sendMessage(MESSAGE_FORMAT.format(new Object[]{c, "网络能源节点", p, powerNodes}, 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, 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(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());

Expand Down

0 comments on commit 4d2f197

Please sign in to comment.