feat: improved fullbright (proper removal)
This commit is contained in:
parent
27c30423de
commit
503c398ca8
2 changed files with 18 additions and 1 deletions
|
@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.command.Commands;
|
import net.minecraft.command.Commands;
|
||||||
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraftforge.client.event.ClientChatEvent;
|
import net.minecraftforge.client.event.ClientChatEvent;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
@ -84,15 +85,19 @@ public class BoSCoVicino {
|
||||||
commands.setAccessible(true);
|
commands.setAccessible(true);
|
||||||
commands.set(player.connection, this.dispatcher);
|
commands.set(player.connection, this.dispatcher);
|
||||||
LOGGER.info("Rebuild HINTS");
|
LOGGER.info("Rebuild HINTS");
|
||||||
|
log("> rebuilt hints");
|
||||||
return 1;
|
return 1;
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
|
log("! no such field error");
|
||||||
LOGGER.error("No such field Exception while rebuilding hints");
|
LOGGER.error("No such field Exception while rebuilding hints");
|
||||||
return 0;
|
return 0;
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
log("! illegal access error");
|
||||||
LOGGER.error("Illegal Access Exception while rebuilding hints");
|
LOGGER.error("Illegal Access Exception while rebuilding hints");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
log("! local player is NULL");
|
||||||
LOGGER.error("Local player is NULL");
|
LOGGER.error("Local player is NULL");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -103,6 +108,10 @@ public class BoSCoVicino {
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
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) {
|
private void setup(final FMLCommonSetupEvent event) {
|
||||||
// some preinit code
|
// some preinit code
|
||||||
LOGGER.info("HELLO FROM PREINIT");
|
LOGGER.info("HELLO FROM PREINIT");
|
||||||
|
@ -138,6 +147,7 @@ public class BoSCoVicino {
|
||||||
try {
|
try {
|
||||||
LOGGER.info(String.format("Running command %s", event.getMessage()));
|
LOGGER.info(String.format("Running command %s", event.getMessage()));
|
||||||
this.dispatcher.execute(event.getMessage().substring(1), source);
|
this.dispatcher.execute(event.getMessage().substring(1), source);
|
||||||
|
BoSCoVicino.minecraft.gui.getChat().addRecentChat(event.getMessage());
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
} catch (CommandSyntaxException e) {
|
} catch (CommandSyntaxException e) {
|
||||||
LOGGER.error(String.format("Syntax error in command : %s", e.toString()));
|
LOGGER.error(String.format("Syntax error in command : %s", e.toString()));
|
||||||
|
|
|
@ -24,7 +24,14 @@ public class Fullbright extends Module {
|
||||||
if (BoSCoVicino.minecraft == null) return;
|
if (BoSCoVicino.minecraft == null) return;
|
||||||
if (BoSCoVicino.minecraft.player == null) return;
|
if (BoSCoVicino.minecraft.player == null) return;
|
||||||
if (this.mode.get().equals("potion")) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue