Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
Improve logging, and Boze integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekiplay committed Apr 9, 2024
1 parent 57a1c51 commit 053eae4
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 51 deletions.
15 changes: 10 additions & 5 deletions src/main/java/nekiplay/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static nekiplay.meteorplus.MeteorPlusAddon.LOGPREFIX;

public class Main implements ModInitializer {
public static final Logger LOG = LoggerFactory.getLogger(Main.class);
public static final String BOZE_LOGPREFIX = "[Boze+]";
public static final String METEOR_LOGPREFIX = "[Meteor+]";
@Override
public void onInitialize() {
LOG.info(LOGPREFIX + " initializing items...");
LOG.info(METEOR_LOGPREFIX + " Initializing items...");
ModItems.Initialize();
LOG.info(LOGPREFIX + " loaded items");
LOG.info(METEOR_LOGPREFIX + " Loaded items");

if (MixinPlugin.isBozeAPI) {
if (MixinPlugin.isBozeAPI && !MixinPlugin.isMeteorClient) {
LOG.info(METEOR_LOGPREFIX + " & " + BOZE_LOGPREFIX + " Initialization of Boze Client integration because Meteor Client is not found...");
BozePlusAddon bozePlusMain = new BozePlusAddon();
bozePlusMain.onInitialize();
LOG.info(METEOR_LOGPREFIX + " & " + BOZE_LOGPREFIX + " Loaded of Boze Client integration");
}
else if (MixinPlugin.isBozeAPI && MixinPlugin.isMeteorClient) {
LOG.info(METEOR_LOGPREFIX + " & " + BOZE_LOGPREFIX + " You have Meteor Client installed, integration with Boze Client is disabled");
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/nekiplay/MixinPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class MixinPlugin implements IMixinConfigPlugin {
public static final Logger LOG = LoggerFactory.getLogger(MixinPlugin.class);
public static final String LOGPREFIX = "[Meteor+ Mixins]";
public static final String METEOR_LOGPREFIX_MIXIN = "[Meteor+ Mixins]";

private static final String mixinPackageMeteorPlus = "nekiplay.meteorplus.mixin";
private static final String mixinPackageBozePlus = "nekiplay.bozeplus.mixin";
Expand Down Expand Up @@ -53,7 +53,7 @@ public String getRefMapperConfig() {
@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
if (!mixinClassName.startsWith(mixinPackageMeteorPlus)) {
throw new RuntimeException(LOGPREFIX + " " + mixinClassName + " is not in the mixin package");
throw new RuntimeException(METEOR_LOGPREFIX_MIXIN + " " + mixinClassName + " is not in the mixin package");
}
else if (mixinClassName.startsWith(mixinPackageMeteorPlus + ".meteorclient")) {
if (mixinClassName.contains("FreecamMixin") || mixinClassName.contains("WaypointsModuleMixin")) {
Expand Down
77 changes: 45 additions & 32 deletions src/main/java/nekiplay/meteorplus/MeteorPlusAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;

import static nekiplay.Main.METEOR_LOGPREFIX;
import static nekiplay.MixinPlugin.*;

public class MeteorPlusAddon extends MeteorAddon {
Expand All @@ -52,7 +55,6 @@ public class MeteorPlusAddon extends MeteorAddon {

public static final Category CATEGORYMODS = new Category("Integrations", logo_mods_item);
public static final HudGroup HUD_GROUP = new HudGroup("Meteor+ Hud");
public static final String LOGPREFIX = "[Meteor+]";

private static MeteorPlusAddon instance;

Expand All @@ -64,71 +66,85 @@ public static MeteorPlusAddon getInstance() {
public void onInitialize() {
instance = this;

LOG.info(LOGPREFIX + " Initializing...");
LOG.info(METEOR_LOGPREFIX + " Initializing...");

ArrayList<String> notFoundIntegrations = new ArrayList<>();
ArrayList<String> notFoundBaritoneIntegrations = new ArrayList<>();
ArrayList<String> enabledIntegrations = new ArrayList<>();

if (isXaeroWorldMapresent) {
if (!isBaritonePresent) {
LOG.warn(LOGPREFIX + " [Baritone] not found, disabling Xaero's World Map improvement");
notFoundBaritoneIntegrations.add("Xaero's World Map");
}
else {
LOG.info(LOGPREFIX + " [Baritone] found, enabling Xaero's World Map improvement");
enabledIntegrations.add("Xaero's World Map");
}
}
else {
LOG.warn(LOGPREFIX + " [Xaero's World Map] not found, disabling Xaero's World Map improvement");
notFoundIntegrations.add("Xaero's World Map");
}
if (isJourneyMapPresent) {
if (!isBaritonePresent) {
LOG.warn(LOGPREFIX + " [Baritone] not found, disabling Journey Map improvement");
notFoundBaritoneIntegrations.add("Journey Map");
}
else {
LOG.info(LOGPREFIX + " [Baritone] found, enabling Journey Map improvement");
enabledIntegrations.add("Journey Map");
}
}
else {
LOG.warn(LOGPREFIX + " [Journey Map] not found, disabling Journey Map improvement");
notFoundIntegrations.add("Journey Map");
}
if (!isBaritonePresent) {
LOG.warn(LOGPREFIX + " [Baritone] not found, disabling Freecam and Waypoints improvement");
notFoundBaritoneIntegrations.add("Freecam");
notFoundBaritoneIntegrations.add("Waypoints");
notFoundBaritoneIntegrations.add("Goto+");
}
else {
LOG.info(LOGPREFIX + " [Baritone] found, enabling Freecam and Waypoints improvement");
enabledIntegrations.add("Freecam");
enabledIntegrations.add("Waypoints");
}

if (!isWhereIsIt) {
LOG.warn(LOGPREFIX + " [Where is it] not found, disabling ChestTracker improvement");
notFoundIntegrations.add("Where is it");
}
else {
LOG.info(LOGPREFIX + " [Where is it] found, enabling ChestTracker improvement");
enabledIntegrations.add("Where is it");
}

if (!enabledIntegrations.isEmpty()) {
LOG.info(METEOR_LOGPREFIX + " Enabling integrations for: " + String.join(", ", enabledIntegrations));
}
if (!notFoundBaritoneIntegrations.isEmpty()) {
LOG.warn(METEOR_LOGPREFIX + " Not found Baritone for integrations: " + String.join(", ", notFoundBaritoneIntegrations));
}
if (!notFoundIntegrations.isEmpty()) {
LOG.warn(METEOR_LOGPREFIX + " Not found mods for integrations: " + String.join(", ", notFoundIntegrations));
}

MeteorClient.EVENT_BUS.subscribe(new CordinateProtector());
ConfigModifier.get();

//region Commands
LOG.info(LOGPREFIX + " Initializing commands...");
LOG.info(METEOR_LOGPREFIX + " Initializing commands...");

Commands.add(new ItemRawIdCommand());
Commands.add(new Eclip());
Commands.add(new ClearInventory());
if (isBaritonePresent) {
Commands.add(new GotoPlus());
}
else {
LOG.warn(LOGPREFIX + " [Baritone] not found, disabling Goto+");
}
Commands.add(new GPT());

LOG.info(LOGPREFIX + " Loaded commands");
LOG.info(METEOR_LOGPREFIX + " Loaded commands");
//endregion

LOG.info(LOGPREFIX + " Initializing better chat custom head...");
LOG.info(METEOR_LOGPREFIX + " Initializing better chat custom head...");
BetterChat.registerCustomHead("[Meteor+]", new Identifier("meteorplus", "chat/icon.png"));
LOG.info(LOGPREFIX + " Loaded better chat");
LOG.info(METEOR_LOGPREFIX + " Loaded better chat");


//region Modules
LOG.info(LOGPREFIX + " Initializing modules...");
LOG.info(METEOR_LOGPREFIX + " Initializing modules...");
Modules modules = Modules.get();

modules.add(new Teams());
Expand Down Expand Up @@ -168,48 +184,45 @@ public void onInitialize() {
modules.add(new NoJumpDelay());
}
else {
LOG.warn(LOGPREFIX + " Meteor Rejects detected, removing No Jump Delay");
LOG.warn(METEOR_LOGPREFIX + " Meteor Rejects detected, removing No Jump Delay");
}
modules.add(new NoSlowPlus());
//modules.add(new VelocityPlus());
if (isBaritonePresent) {
if (isXaeroWorldMapresent || isJourneyMapPresent) {
modules.add(new MapIntegration());
LOG.info(LOGPREFIX + " Loaded mini-map integration");
}
}
if (isLitematicaMapresent && isBaritonePresent) {
modules.add(new LitematicaPrinter());
LOG.info(LOGPREFIX + " Loaded litematica integration");
}
if (isWhereIsIt) {
modules.add(new WhereIsIt());
LOG.info(LOGPREFIX + " Loaded where is it integration");
}
LOG.info(LOGPREFIX + " Loaded modules");
LOG.info(METEOR_LOGPREFIX + " Loaded modules");
//endregion

//region Hud
LOG.info(LOGPREFIX + " Initializing hud...");
LOG.info(METEOR_LOGPREFIX + " Initializing hud...");

Hud.get().register(TimerPlusCharge.INFO);

LOG.info(LOGPREFIX + " Loaded hud");
LOG.info(METEOR_LOGPREFIX + " Loaded hud");
//endregion

//region Tabs
LOG.info(LOGPREFIX + " Initializing tabs...");
LOG.info(METEOR_LOGPREFIX + " Initializing tabs...");

Tabs.add(new HiddenModulesTab());

LOG.info(LOGPREFIX + " Loaded tabs");
LOG.info(METEOR_LOGPREFIX + " Loaded tabs");
//endregion
LOG.info(LOGPREFIX + " Full loaded");
LOG.info(METEOR_LOGPREFIX + " Full loaded");
}

@Override
public void onRegisterCategories() {
LOG.info(LOGPREFIX + " registering categories...");
LOG.info(METEOR_LOGPREFIX + " registering categories...");
if (isXaeroWorldMapresent ||
isJourneyMapPresent ||
MixinPlugin.isLitematicaMapresent ||
Expand All @@ -218,7 +231,7 @@ public void onRegisterCategories() {
Modules.registerCategory(CATEGORYMODS);
}
//Modules.registerCategory(CATEGORY);
LOG.info(LOGPREFIX + " register categories");
LOG.info(METEOR_LOGPREFIX + " register categories");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.meteorclient.utils.player.PlayerUtils;
import meteordevelopment.meteorclient.utils.world.Dimension;
import nekiplay.Main;
import nekiplay.meteorplus.MeteorPlusAddon;
import nekiplay.meteorplus.features.modules.integrations.MapIntegration;
import net.minecraft.text.Text;
Expand All @@ -23,9 +24,9 @@ public void initialize(final IClientAPI jmClientApi) {
MapIntegration mapIntegration = Modules.get().get(MapIntegration.class);


MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + " " + JourneyMapLOGPREFIX + " loading Journey Map integrate");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " loading Journey Map integrate");
FabricEvents.FULLSCREEN_POPUP_MENU_EVENT.register(event -> {
MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + " " + JourneyMapLOGPREFIX + " register fullscreen Journey Map");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " register fullscreen Journey Map");
ModPopupMenu popupMenu = event.getPopupMenu();

if (mapIntegration.baritoneGoto.get()) {
Expand Down Expand Up @@ -56,11 +57,11 @@ public void initialize(final IClientAPI jmClientApi) {
}
}

MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + " " + JourneyMapLOGPREFIX + " register fullscreen Journey Map done");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " register fullscreen Journey Map done");
});

FabricEvents.WAYPOINT_POPUP_MENU_EVENT.register(event -> {
MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + " " + JourneyMapLOGPREFIX + " register waypoints Journey Map");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " register waypoints Journey Map");
ModPopupMenu popupMenu = event.getPopupMenu();

if (mapIntegration != null && mapIntegration.baritoneGoto.get()) {
Expand Down Expand Up @@ -91,16 +92,16 @@ public void initialize(final IClientAPI jmClientApi) {
}
}

MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + " " + JourneyMapLOGPREFIX + " register waypoints Journey Map done");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " register waypoints Journey Map done");
});

MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + " " + JourneyMapLOGPREFIX + " initializing tab...");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " initializing tab...");


MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + " " + JourneyMapLOGPREFIX + " loaded tab");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " loaded tab");


MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + " " + JourneyMapLOGPREFIX + " Journey Map integrate loaded");
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " " + JourneyMapLOGPREFIX + " Journey Map integrate loaded");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import meteordevelopment.meteorclient.utils.render.color.Color;
import meteordevelopment.meteorclient.utils.world.Dimension;
import meteordevelopment.orbit.EventHandler;
import nekiplay.Main;
import nekiplay.meteorplus.MeteorPlusAddon;
import net.minecraft.item.Item;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -105,7 +106,7 @@ private void load() {
File[] files = dir2.listFiles();
for (File file : files) {
if (file.exists()) {
MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + "Loading hologram: " + file.getName());
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + "Loading hologram: " + file.getName());
FileReader fr = null;
try {
fr = new FileReader(file);
Expand All @@ -115,16 +116,16 @@ private void load() {
HologramDataListed hologramData = gson.fromJson(json, HologramDataListed.class);
if (hologramData != null) {
allHolograms.add(hologramData);
MeteorPlusAddon.LOG.info(MeteorPlusAddon.LOGPREFIX + " Success loaded hologram: " + file.getName());
MeteorPlusAddon.LOG.info(Main.METEOR_LOGPREFIX + " Success loaded hologram: " + file.getName());
}

} catch (IOException | JsonSyntaxException e) {
MeteorPlusAddon.LOG.error(MeteorPlusAddon.LOGPREFIX + " Error in hologram: " + e);
MeteorPlusAddon.LOG.error(Main.METEOR_LOGPREFIX + " Error in hologram: " + e);
e.printStackTrace();

}
} catch (FileNotFoundException e) {
MeteorPlusAddon.LOG.error(MeteorPlusAddon.LOGPREFIX + " Error in hologram: " + e);
MeteorPlusAddon.LOG.error(Main.METEOR_LOGPREFIX + " Error in hologram: " + e);
e.printStackTrace();
}
}
Expand Down

0 comments on commit 053eae4

Please sign in to comment.