aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorLorenz <ESs95s3P5z8Pheb>2022-07-08 08:52:10 +0200
committerLorenz <ESs95s3P5z8Pheb>2022-07-08 08:52:10 +0200
commit27d1dfa82bf52bca0d041416d500097cd96e4c42 (patch)
tree33e3d320aac19a2a46e27a681d129b8dd5a2ab6d /src/main/java
parentd188f0135b13ed23a77d46db4ed2040dc1b14bf7 (diff)
parentcb1e008e7f61111e1bc480eadc7f7668862e9f5d (diff)
downloadskyhanni-27d1dfa82bf52bca0d041416d500097cd96e4c42.tar.gz
skyhanni-27d1dfa82bf52bca0d041416d500097cd96e4c42.tar.bz2
skyhanni-27d1dfa82bf52bca0d041416d500097cd96e4c42.zip
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/lorenz/mod/mixins/MixinGuiContainer.java2
-rw-r--r--src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java18
-rw-r--r--src/main/java/at/lorenz/mod/mixins/MixinNetworkManager.java3
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java294
4 files changed, 155 insertions, 162 deletions
diff --git a/src/main/java/at/lorenz/mod/mixins/MixinGuiContainer.java b/src/main/java/at/lorenz/mod/mixins/MixinGuiContainer.java
index c9dc12fc5..a0cf8fdbe 100644
--- a/src/main/java/at/lorenz/mod/mixins/MixinGuiContainer.java
+++ b/src/main/java/at/lorenz/mod/mixins/MixinGuiContainer.java
@@ -41,10 +41,8 @@ public abstract class MixinGuiContainer extends GuiScreen {
hook.onDrawSlotPost(slot, ci);
}
-
@Inject(method = "handleMouseClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;windowClick(IIIILnet/minecraft/entity/player/EntityPlayer;)Lnet/minecraft/item/ItemStack;"), cancellable = true)
private void onMouseClick(Slot slot, int slotId, int clickedButton, int clickType, CallbackInfo ci) {
hook.onMouseClick(slot, slotId, clickedButton, clickType, ci);
}
-
}
diff --git a/src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java b/src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java
index 9944a83ac..383fc114e 100644
--- a/src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java
+++ b/src/main/java/at/lorenz/mod/mixins/MixinNetHandlerPlayClient.java
@@ -15,6 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = NetHandlerPlayClient.class, priority = 1001)
public abstract class MixinNetHandlerPlayClient implements INetHandlerPlayClient {
+
@Shadow
private WorldClient clientWorldController;
@@ -22,13 +23,12 @@ public abstract class MixinNetHandlerPlayClient implements INetHandlerPlayClient
private void onSendPacket(Packet<?> packet, CallbackInfo ci) {
NetHandlerPlayClientHookKt.onSendPacket(packet, ci);
}
-
-// @Inject(method = "handleSpawnMob", at = @At("TAIL"))
-// private void onHandleSpawnMobTail(S0FPacketSpawnMob packetIn, CallbackInfo ci) {
-// Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());
-// MasterMode7Features.INSTANCE.onMobSpawned(entity);
-// ((ExtensionEntityLivingBase) entity).getSkytilsHook().onNewDisplayName(
-// entity.getDataWatcher().getWatchableObjectString(2)
-// );
-// }
+ // @Inject(method = "handleSpawnMob", at = @At("TAIL"))
+ // private void onHandleSpawnMobTail(S0FPacketSpawnMob packetIn, CallbackInfo ci) {
+ // Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityID());
+ // MasterMode7Features.INSTANCE.onMobSpawned(entity);
+ // ((ExtensionEntityLivingBase) entity).getSkytilsHook().onNewDisplayName(
+ // entity.getDataWatcher().getWatchableObjectString(2)
+ // );
+ // }
}
diff --git a/src/main/java/at/lorenz/mod/mixins/MixinNetworkManager.java b/src/main/java/at/lorenz/mod/mixins/MixinNetworkManager.java
index c2314201b..d8b2d0fd9 100644
--- a/src/main/java/at/lorenz/mod/mixins/MixinNetworkManager.java
+++ b/src/main/java/at/lorenz/mod/mixins/MixinNetworkManager.java
@@ -1,5 +1,6 @@
package at.lorenz.mod.mixins;
+import at.lorenz.mod.mixinhooks.NetworkManagerHookKt;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import net.minecraft.network.NetworkManager;
@@ -8,10 +9,10 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import at.lorenz.mod.mixinhooks.NetworkManagerHookKt;
@Mixin(value = NetworkManager.class, priority = 1001)
public abstract class MixinNetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
+
@Inject(method = "channelRead0", at = @At("HEAD"), cancellable = true)
private void onReceivePacket(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) {
NetworkManagerHookKt.onReceivePacket(context, packet, ci);
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java
index de1dc7646..63530fb6c 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/SkyblockHud.java
@@ -1,22 +1,20 @@
package com.thatgravyboat.skyblockhud;
-import at.lorenz.mod.ItemDisplayOverlayFeatures;
-import at.lorenz.mod.bazaar.BazaarApi;
import at.lorenz.mod.HideNotClickableItems;
+import at.lorenz.mod.bazaar.BazaarApi;
import at.lorenz.mod.bazaar.BazaarOrderHelper;
import at.lorenz.mod.chat.ChatFilter;
import at.lorenz.mod.chat.ChatManager;
import at.lorenz.mod.dungeon.DungeonChatFilter;
import at.lorenz.mod.dungeon.DungeonHighlightClickedBlocks;
import com.thatgravyboat.skyblockhud.config.SBHConfig;
+import java.io.File;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
-import java.io.File;
-
@Mod(modid = SkyblockHud.MODID, version = SkyblockHud.VERSION)
public class SkyblockHud {
@@ -25,17 +23,16 @@ public class SkyblockHud {
public static SBHConfig config;
-// private File configFile;
+ // private File configFile;
-// private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet("SKYBLOCK", "\u7A7A\u5C9B\u751F\u5B58");
+ // private static final Set<String> SKYBLOCK_IN_ALL_LANGUAGES = Sets.newHashSet("SKYBLOCK", "\u7A7A\u5C9B\u751F\u5B58");
-// private final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
+ // private final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
public static File configDirectory;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
-
new BazaarApi();
MinecraftForge.EVENT_BUS.register(new BazaarOrderHelper());
@@ -44,156 +41,153 @@ public class SkyblockHud {
MinecraftForge.EVENT_BUS.register(new DungeonChatFilter());
MinecraftForge.EVENT_BUS.register(new HideNotClickableItems());
MinecraftForge.EVENT_BUS.register(new DungeonHighlightClickedBlocks());
- MinecraftForge.EVENT_BUS.register(new ItemDisplayOverlayFeatures());
-
-
-// MinecraftForge.EVENT_BUS.register(new LeaderboardGetter());
-// MinecraftForge.EVENT_BUS.register(new SeasonDateHandler());
-// MinecraftForge.EVENT_BUS.register(new LocationHandler());
-// MinecraftForge.EVENT_BUS.register(new IslandHandler());
-// MinecraftForge.EVENT_BUS.register(new TimeHandler());
-// MinecraftForge.EVENT_BUS.register(new CurrencyHandler());
-// MinecraftForge.EVENT_BUS.register(new SlayerHandler());
-// MinecraftForge.EVENT_BUS.register(new DungeonHandler());
-// MinecraftForge.EVENT_BUS.register(new MinesHandler());
-// MinecraftForge.EVENT_BUS.register(new FarmingIslandHandler());
-//
-// MinecraftForge.EVENT_BUS.register(new TrackerHandler());
-// MinecraftForge.EVENT_BUS.register(new KillTracking());
-//
-// MinecraftForge.EVENT_BUS.register(new HeldItemHandler());
-//
-// ClientRegistry.registerKeyBinding(KeyBindings.map);
-//
-// MinecraftForge.EVENT_BUS.register(new ComponentHandler());
-// MinecraftForge.EVENT_BUS.register(new ActionBarParsing());
-// MinecraftForge.EVENT_BUS.register(new CrystalWaypoints());
-// MinecraftForge.EVENT_BUS.register(new FarmHouseHandler());
-// MinecraftForge.EVENT_BUS.register(new WarpHandler());
-// MinecraftForge.EVENT_BUS.register(new CooldownHandler());
-// Commands.init();
-//
-// ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new NpcDialogue());
-// ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new Textures());
-//
-// configDirectory = new File(event.getModConfigurationDirectory(), "skyblockhud");
-// try {
-// configDirectory.mkdir();
-// } catch (Exception ignored) {}
-//
-// configFile = new File(configDirectory, "sbh-config.json");
-//
-// if (configFile.exists()) {
-// try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) {
-// config = gson.fromJson(reader, SBHConfig.class);
-// } catch (Exception ignored) {}
-// }
-//
-// if (config == null) {
-// config = new SBHConfig();
-// saveConfig();
-// }
-//
-// Textures.setTexture(config.misc.style);
-//
-// if (WarpHandler.load()) {
-// WarpHandler.save();
-// }
-//
-// Runtime.getRuntime().addShutdownHook(new Thread(this::saveConfig));
-// Runtime.getRuntime().addShutdownHook(new Thread(TrackerFileLoader::saveTrackerStatsFile));
+ // MinecraftForge.EVENT_BUS.register(new LeaderboardGetter());
+ // MinecraftForge.EVENT_BUS.register(new SeasonDateHandler());
+ // MinecraftForge.EVENT_BUS.register(new LocationHandler());
+ // MinecraftForge.EVENT_BUS.register(new IslandHandler());
+ // MinecraftForge.EVENT_BUS.register(new TimeHandler());
+ // MinecraftForge.EVENT_BUS.register(new CurrencyHandler());
+ // MinecraftForge.EVENT_BUS.register(new SlayerHandler());
+ // MinecraftForge.EVENT_BUS.register(new DungeonHandler());
+ // MinecraftForge.EVENT_BUS.register(new MinesHandler());
+ // MinecraftForge.EVENT_BUS.register(new FarmingIslandHandler());
+ //
+ // MinecraftForge.EVENT_BUS.register(new TrackerHandler());
+ // MinecraftForge.EVENT_BUS.register(new KillTracking());
+ //
+ // MinecraftForge.EVENT_BUS.register(new HeldItemHandler());
+ //
+ // ClientRegistry.registerKeyBinding(KeyBindings.map);
+ //
+ // MinecraftForge.EVENT_BUS.register(new ComponentHandler());
+ // MinecraftForge.EVENT_BUS.register(new ActionBarParsing());
+ // MinecraftForge.EVENT_BUS.register(new CrystalWaypoints());
+ // MinecraftForge.EVENT_BUS.register(new FarmHouseHandler());
+ // MinecraftForge.EVENT_BUS.register(new WarpHandler());
+ // MinecraftForge.EVENT_BUS.register(new CooldownHandler());
+ // Commands.init();
+ //
+ // ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new NpcDialogue());
+ // ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new Textures());
+ //
+ // configDirectory = new File(event.getModConfigurationDirectory(), "skyblockhud");
+ // try {
+ // configDirectory.mkdir();
+ // } catch (Exception ignored) {}
+ //
+ // configFile = new File(configDirectory, "sbh-config.json");
+ //
+ // if (configFile.exists()) {
+ // try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), StandardCharsets.UTF_8))) {
+ // config = gson.fromJson(reader, SBHConfig.class);
+ // } catch (Exception ignored) {}
+ // }
+ //
+ // if (config == null) {
+ // config = new SBHConfig();
+ // saveConfig();
+ // }
+ //
+ // Textures.setTexture(config.misc.style);
+ //
+ // if (WarpHandler.load()) {
+ // WarpHandler.save();
+ // }
+ //
+ // Runtime.getRuntime().addShutdownHook(new Thread(this::saveConfig));
+ // Runtime.getRuntime().addShutdownHook(new Thread(TrackerFileLoader::saveTrackerStatsFile));
}
-// public void saveConfig() {
-// try {
-// configFile.createNewFile();
-//
-// try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) {
-// writer.write(gson.toJson(config));
-// }
-// } catch (IOException ignored) {}
-// }
-
-// @EventHandler
-// public void postInit(FMLPostInitializationEvent event) {
-// MinecraftForge.EVENT_BUS.register(new OverlayHud());
-// MinecraftForge.EVENT_BUS.register(new RPGHud());
-// MinecraftForge.EVENT_BUS.register(new DungeonOverlay());
-// MinecraftForge.EVENT_BUS.register(new BossbarHandler());
-// MinecraftForge.EVENT_BUS.register(new MapHandler());
-// MinecraftForge.EVENT_BUS.register(new MiningHud());
-// MinecraftForge.EVENT_BUS.register(new NpcDialogue());
-// }
-
-// @EventHandler
-// public void loadComplete(FMLLoadCompleteEvent event) {
-// TrackerFileLoader.loadTrackersFile();
-//
-// if (TrackerFileLoader.loadTrackerStatsFile()) {
-// TrackerFileLoader.saveTrackerStatsFile();
-// }
-// }
-
-// @SubscribeEvent
-// public void onLeaveServer(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
-// TrackerFileLoader.saveTrackerStatsFile();
-// }
+ // public void saveConfig() {
+ // try {
+ // configFile.createNewFile();
+ //
+ // try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(configFile), StandardCharsets.UTF_8))) {
+ // writer.write(gson.toJson(config));
+ // }
+ // } catch (IOException ignored) {}
+ // }
+
+ // @EventHandler
+ // public void postInit(FMLPostInitializationEvent event) {
+ // MinecraftForge.EVENT_BUS.register(new OverlayHud());
+ // MinecraftForge.EVENT_BUS.register(new RPGHud());
+ // MinecraftForge.EVENT_BUS.register(new DungeonOverlay());
+ // MinecraftForge.EVENT_BUS.register(new BossbarHandler());
+ // MinecraftForge.EVENT_BUS.register(new MapHandler());
+ // MinecraftForge.EVENT_BUS.register(new MiningHud());
+ // MinecraftForge.EVENT_BUS.register(new NpcDialogue());
+ // }
+
+ // @EventHandler
+ // public void loadComplete(FMLLoadCompleteEvent event) {
+ // TrackerFileLoader.loadTrackersFile();
+ //
+ // if (TrackerFileLoader.loadTrackerStatsFile()) {
+ // TrackerFileLoader.saveTrackerStatsFile();
+ // }
+ // }
+
+ // @SubscribeEvent
+ // public void onLeaveServer(FMLNetworkEvent.ClientDisconnectionFromServerEvent event) {
+ // TrackerFileLoader.saveTrackerStatsFile();
+ // }
public static boolean hasSkyblockScoreboard() {
-// Minecraft mc = Minecraft.getMinecraft();
-//
-// if (mc != null && mc.theWorld != null) {
-// Scoreboard scoreboard = mc.theWorld.getScoreboard();
-// ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1);
-// if (sidebarObjective != null) {
-// String objectiveName = sidebarObjective.getDisplayName().replaceAll("(?i)\\u00A7.", "");
-// for (String skyblock : SKYBLOCK_IN_ALL_LANGUAGES) {
-// if (objectiveName.startsWith(skyblock)) {
-// return true;
-// }
-// }
-// }
-// }
+ // Minecraft mc = Minecraft.getMinecraft();
+ //
+ // if (mc != null && mc.theWorld != null) {
+ // Scoreboard scoreboard = mc.theWorld.getScoreboard();
+ // ScoreObjective sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1);
+ // if (sidebarObjective != null) {
+ // String objectiveName = sidebarObjective.getDisplayName().replaceAll("(?i)\\u00A7.", "");
+ // for (String skyblock : SKYBLOCK_IN_ALL_LANGUAGES) {
+ // if (objectiveName.startsWith(skyblock)) {
+ // return true;
+ // }
+ // }
+ // }
+ // }
return false;
}
-// @SubscribeEvent
-// public void onTooltip(ItemTooltipEvent event) {
-// if (event.itemStack != null && Keyboard.isKeyDown(Keyboard.KEY_BACKSLASH)) {
-// try {
-// StringSelection clipboard = new StringSelection(event.itemStack.serializeNBT().toString());
-// Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard);
-// } catch (Exception ignored) {}
-// }
-// }
-
-// @SubscribeEvent(priority = EventPriority.HIGHEST)
-// public void onStatusBar(ClientChatReceivedEvent event) {
-// String message = Utils.removeColor(event.message.getUnformattedText()).toLowerCase().trim();
-//
-// if (message.startsWith("your profile was changed to:")) {
-// String stripped = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim();
-// MinecraftForge.EVENT_BUS.post(new ProfileSwitchedEvent(stripped));
-// }
-// if (message.startsWith("you are playing on profile:")) {
-// String stripped = message.replace("you are playing on profile:", "").replace("(co-op)", "").trim();
-// MinecraftForge.EVENT_BUS.post(new ProfileJoinedEvent(stripped));
-// }
-// }
+ // @SubscribeEvent
+ // public void onTooltip(ItemTooltipEvent event) {
+ // if (event.itemStack != null && Keyboard.isKeyDown(Keyboard.KEY_BACKSLASH)) {
+ // try {
+ // StringSelection clipboard = new StringSelection(event.itemStack.serializeNBT().toString());
+ // Toolkit.getDefaultToolkit().getSystemClipboard().setContents(clipboard, clipboard);
+ // } catch (Exception ignored) {}
+ // }
+ // }
+
+ // @SubscribeEvent(priority = EventPriority.HIGHEST)
+ // public void onStatusBar(ClientChatReceivedEvent event) {
+ // String message = Utils.removeColor(event.message.getUnformattedText()).toLowerCase().trim();
+ //
+ // if (message.startsWith("your profile was changed to:")) {
+ // String stripped = message.replace("your profile was changed to:", "").replace("(co-op)", "").trim();
+ // MinecraftForge.EVENT_BUS.post(new ProfileSwitchedEvent(stripped));
+ // }
+ // if (message.startsWith("you are playing on profile:")) {
+ // String stripped = message.replace("you are playing on profile:", "").replace("(co-op)", "").trim();
+ // MinecraftForge.EVENT_BUS.post(new ProfileJoinedEvent(stripped));
+ // }
+ // }
public static GuiScreen screenToOpen = null;
-// private static int screenTicks = 0;
-
-// @SubscribeEvent
-// public void onClientTick(TickEvent.ClientTickEvent event) {
-// if (screenToOpen != null) {
-// screenTicks++;
-// if (screenTicks == 5) {
-// Minecraft.getMinecraft().displayGuiScreen(screenToOpen);
-// screenTicks = 0;
-// screenToOpen = null;
-// }
-// }
-// }
+ // private static int screenTicks = 0;
+
+ // @SubscribeEvent
+ // public void onClientTick(TickEvent.ClientTickEvent event) {
+ // if (screenToOpen != null) {
+ // screenTicks++;
+ // if (screenTicks == 5) {
+ // Minecraft.getMinecraft().displayGuiScreen(screenToOpen);
+ // screenTicks = 0;
+ // screenToOpen = null;
+ // }
+ // }
+ // }
}