Skip to content

Commit

Permalink
Fixed TileEntitySign not found bug, added disconnect and command comm…
Browse files Browse the repository at this point in the history
…ands to remote control
  • Loading branch information
NK committed May 27, 2023
1 parent 8ba3cf4 commit 9ce120f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
5 changes: 4 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,7 @@
- remove useless code, config that isn't need to be stored in lilase.json (again)
- v3.0.4-beta
- Added debugs
- Emergency bug fixes
- Emergency bug fixes
- v3.0.5
- Fixed flipper cannot find TileEntitySign
- Added disconnect and command commands to remote control
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod_name = Lilase
mod_id = lilase
mod_version = 3.0.4-beta
mod_version = 3.0.4

essential.defaults.loom=0

Expand Down
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pluginManagement {
maven("https://repo.polyfrost.cc/releases")
maven("https://maven.architectury.dev/")
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")

}
plugins {
val egtVersion = "0.1.18"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/night0721/lilase/Lilase.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public class Lilase {
public static final String MOD_NAME = "Lilase";
public static final String MODID = "Lilase";
public static final String VERSION = "3.0.4-beta";
public static final String VERSION = "3.0.4";
public static final Minecraft mc = Minecraft.getMinecraft();
// public static PageFlipper pageFlipper;
public static Claimer claimer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,8 @@ public void onTick() {
}
case PRICE:
if (Lilase.mc.currentScreen instanceof GuiEditSign && buyWait.passed()) {
TileEntitySign tileSign;
try {
tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign");
} catch (Exception e) {
TileEntitySign tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign");
if (tileSign == null) {
tileSign = (TileEntitySign) ReflectionUtils.field(Lilase.mc.currentScreen, "field_146848_f");
}
Utils.debugLog("Sign(normal): " + ReflectionUtils.field(Lilase.mc.currentScreen, "tileSign"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ public void init() {

bot.updateCommands().addCommands(
Commands.slash("statistics", "Statistics of current session").setGuildOnly(true),
Commands.slash("screenshot", "Take a screenshot of the client"),
Commands.slash("enable", "Enable a feature of the mod")
.setGuildOnly(true)
.addOptions(new OptionData(OptionType.STRING, "type", "The type of feature to turn on")
.addChoice("Auto Claimer", "claimer")
.addChoice("COFL Macro", "macro")
.addChoice("Auto Relister", "relister"))
).queue();
Commands.slash("screenshot", "Take a screenshot of the client").setGuildOnly(true),
Commands.slash("enable", "Enable a feature of the mod").setGuildOnly(true)
.addOptions(new OptionData(OptionType.STRING, "type", "The type of feature to turn on").addChoice("Auto Claimer", "claimer").addChoice("COFL Macro", "macro").addChoice("Auto Relister", "relister")),
Commands.slash("command", "Runs a command on client side").setGuildOnly(true).addOptions(new OptionData(OptionType.STRING, "command", "The command to run", true)),
Commands.slash("disconnect", "Disconnect from server").setGuildOnly(true)
).queue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import me.night0721.lilase.Lilase;
import me.night0721.lilase.remotecontrol.BotUtils;
import me.night0721.lilase.utils.Utils;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
Expand Down Expand Up @@ -88,5 +89,14 @@ public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
}
}
}
if (event.getName().equals("command")) {
String command = Objects.requireNonNull(event.getOption("command")).getAsString();
Utils.sendServerMessage("/" + command);
event.reply("Command sent").queue();
}
if (event.getName().equals("disconnect")) {
Lilase.mc.theWorld.sendQuittingDisconnectingPacket();
event.reply("Disconnected").queue();
}
}
}

0 comments on commit 9ce120f

Please sign in to comment.