diff options
author | alemidev <me@alemi.dev> | 2023-01-29 00:03:44 +0100 |
---|---|---|
committer | alemidev <me@alemi.dev> | 2023-01-29 00:03:44 +0100 |
commit | 503c398ca846f1279515c0d61b26c550572b0816 (patch) | |
tree | a6006686ff8b1482cc1b34c43a37c99d3f9d56c2 | |
parent | 27c30423de8b564539ac43a5fbea97de6ed2e4f8 (diff) |
feat: improved fullbright (proper removal)
-rw-r--r-- | src/main/java/co/fantabos/bscv/BoSCoVicino.java | 10 | ||||
-rw-r--r-- | src/main/java/co/fantabos/bscv/Fullbright.java | 9 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/co/fantabos/bscv/BoSCoVicino.java b/src/main/java/co/fantabos/bscv/BoSCoVicino.java index 1ee1fc3..fb7a71d 100644 --- a/src/main/java/co/fantabos/bscv/BoSCoVicino.java +++ b/src/main/java/co/fantabos/bscv/BoSCoVicino.java @@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; +import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.client.event.ClientChatEvent; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.MinecraftForge; @@ -84,15 +85,19 @@ public class BoSCoVicino { commands.setAccessible(true); commands.set(player.connection, this.dispatcher); LOGGER.info("Rebuild HINTS"); + log("> rebuilt hints"); return 1; } catch (NoSuchFieldException e) { + log("! no such field error"); LOGGER.error("No such field Exception while rebuilding hints"); return 0; } catch (IllegalAccessException e) { + log("! illegal access error"); LOGGER.error("Illegal Access Exception while rebuilding hints"); return 0; } } else { + log("! local player is NULL"); LOGGER.error("Local player is NULL"); return 0; } @@ -103,6 +108,10 @@ public class BoSCoVicino { MinecraftForge.EVENT_BUS.register(this); } + public static void log(String message) { + BoSCoVicino.minecraft.gui.getChat().addMessage(new StringTextComponent(message)); + } + private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); @@ -138,6 +147,7 @@ public class BoSCoVicino { try { LOGGER.info(String.format("Running command %s", event.getMessage())); this.dispatcher.execute(event.getMessage().substring(1), source); + BoSCoVicino.minecraft.gui.getChat().addRecentChat(event.getMessage()); event.setCanceled(true); } catch (CommandSyntaxException e) { LOGGER.error(String.format("Syntax error in command : %s", e.toString())); diff --git a/src/main/java/co/fantabos/bscv/Fullbright.java b/src/main/java/co/fantabos/bscv/Fullbright.java index 04a1abc..2f22ef8 100644 --- a/src/main/java/co/fantabos/bscv/Fullbright.java +++ b/src/main/java/co/fantabos/bscv/Fullbright.java @@ -24,7 +24,14 @@ public class Fullbright extends Module { if (BoSCoVicino.minecraft == null) return; if (BoSCoVicino.minecraft.player == null) return; if (this.mode.get().equals("potion")) { - BoSCoVicino.minecraft.player.addEffect(new EffectInstance(Effect.byId(16), 2)); + BoSCoVicino.minecraft.player.addEffect(new EffectInstance(Effect.byId(16), 5204)); + } + } + + @Override + protected void onDisabled() { + if (this.mode.get().equals("potion")) { + BoSCoVicino.minecraft.player.removeEffect(Effect.byId(16)); } } } |