Skip to content

Commit

Permalink
dev: add network debug for debug fish
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Jan 30, 2024
1 parent d6ebc5f commit 42d0e0c
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

import com.xzavier0722.mc.plugin.slimefun4.storage.callback.IAsyncReadCallback;
import com.xzavier0722.mc.plugin.slimefun4.storage.controller.SlimefunBlockData;
import com.xzavier0722.mc.plugin.slimefun4.storage.util.LocationUtils;
import com.xzavier0722.mc.plugin.slimefun4.storage.util.StorageCacheUtils;
import io.github.bakedlibs.dough.common.ChatColors;
import io.github.bakedlibs.dough.skins.PlayerHead;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.network.Network;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetProvider;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNet;
import io.github.thebusybiscuit.slimefun4.core.services.sounds.SoundEffect;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.EnergyRegulator;
import io.github.thebusybiscuit.slimefun4.utils.HeadTexture;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
Expand All @@ -19,6 +23,7 @@
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import net.milkbowl.vault.chat.Chat;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
Expand Down Expand Up @@ -208,6 +213,19 @@ private void sendInfo(Player p, Block b) {
" &dChunk Timings: &e" + Slimefun.getProfiler().getTime(b.getChunk())));
}

if (item instanceof EnergyRegulator) {
p.sendMessage(ChatColors.color("&dEnergy Regulator"));
EnergyNet network = EnergyNet.getNetworkFromLocationOrCreate(b.getLocation());
p.sendMessage(ChatColors.color("&dNetwork range: " + network.getRange()));
p.sendMessage(ChatColors.color("&dNetwork components:"));
p.sendMessage(ChatColors.color(" &d- Network capacitors:"));
network.getCapacitors().forEach((loc, component) -> p.sendMessage(ChatColors.color("&d " + component.getId() + " - " + LocationUtils.locationToString(loc))));
p.sendMessage(ChatColors.color(" &d- Network consumers:"));
network.getConsumers().forEach((loc, component) -> p.sendMessage(ChatColors.color("&d " + component.getId() + " - " + LocationUtils.locationToString(loc))));
p.sendMessage(ChatColors.color(" &d- Network generators:"));
network.getGenerators().forEach((loc, component) -> p.sendMessage(ChatColors.color("&d " + component.getId() + " - " + LocationUtils.locationToString(loc))));
}

if (item instanceof EnergyNetComponent component) {
p.sendMessage(ChatColors.color("&dEnergyNet Component"));
p.sendMessage(ChatColors.color(" &dType: &e" + component.getEnergyComponentType()));
Expand Down

0 comments on commit 42d0e0c

Please sign in to comment.