Skip to content

Commit

Permalink
Alpha 7
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterCheezeCake committed Oct 6, 2024
1 parent 5f9f214 commit cfde323
Show file tree
Hide file tree
Showing 13 changed files with 307 additions and 257 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ replay_*.log
*.jfr

scripts/
holding/
# Don't include dev mixins
src/main/java/wtf/cheeze/sbt/mixin/dev
sbtdev.mixins.json
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.21+build.8
loader_version=0.15.11

# Mod Properties
mod_version=0.1.0-Alpha.6
mod_version=0.1.0-Alpha.7
# mod_version = Unstable

maven_group=wtf.cheeze.sbt
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/wtf/cheeze/sbt/SkyblockTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class SkyblockTweaks implements ModInitializer {
public static final SkyblockData DATA = new SkyblockData();
public static final PersistentData PD = PersistentData.load();
public static final ArrayList<HUD> HUDS = new ArrayList<HUD>();
public static final Version VERSION = new Version(Version.VersionType.ALPHA, 0, 1, 0, 6);
public static final Version VERSION = new Version(Version.VersionType.ALPHA, 0, 1, 0, 7);
public static final MinecraftClient mc = MinecraftClient.getInstance();


Expand Down
477 changes: 245 additions & 232 deletions src/main/java/wtf/cheeze/sbt/command/SBTCommand.java

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/main/java/wtf/cheeze/sbt/compat/modmenu/ModMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
* You should have received a copy of the GNU Lesser General Public License
* along with SkyblockTweaks. If not, see <https://www.gnu.org/licenses/>.
*/
package wtf.cheeze.sbt.config;
package wtf.cheeze.sbt.compat.modmenu;

import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import wtf.cheeze.sbt.config.SkyblockTweaksScreenMain;

public final class ModMenu implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return (parent -> new SkyblockTweaksScreenMain(parent));
return (SkyblockTweaksScreenMain::new);
}
}
32 changes: 28 additions & 4 deletions src/main/java/wtf/cheeze/sbt/features/chat/PartyFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class PartyFeatures {
public static Pattern BACKUP_UPDATE_PATTERN = Pattern.compile("The party was transferred to (.+) by .+");
public static Pattern BOOP_PATTERN = Pattern.compile("From (.*): Boop!");

public static boolean verboseDebug = false;
public static long lastPartyCommand = 0;

public static void registerEvents() {
Expand All @@ -54,48 +55,68 @@ public static void registerEvents() {
var s = TextUtils.removeColorCodes(message.getString());
if (s.startsWith("Party >")) {
var matcher = PARTY_PATTERN.matcher(s);
if (!matcher.matches()) return;
if (System.currentTimeMillis() - lastPartyCommand < SBTConfig.get().partyCommands.cooldown) return;
if (!matcher.matches()) {
if (verboseDebug) sendDebugMessage("Party message did not match pattern");
return;
}
if (System.currentTimeMillis() - lastPartyCommand < SBTConfig.get().partyCommands.cooldown) {
if (verboseDebug) sendDebugMessage("Party command on cooldown");
return;
}
HypixelNetworking.sendPartyInfoC2SPacket(2);
lastPartyCommand = System.currentTimeMillis();
var name = matcher.group(1);
if (name.contains(" ")) name = name.split(" ")[1];
if (verboseDebug) sendDebugMessage("Initial Name Field Is '" + name + "'");
if (name.contains(" ")) {
name = name.split(" ")[1];
if (verboseDebug) sendDebugMessage("Name Changed To '" + name + "'");
}
if (SBTConfig.get().partyCommands.blockedUsers.contains(name)) {
SkyblockTweaks.LOGGER.info("Blocked user tried to use party commands: " + name);
if (verboseDebug) sendDebugMessage("Blocked user tried to use party commands: " + name);
return;
}
var msg = matcher.group(2);
if (verboseDebug) sendDebugMessage("Message Field Is '" + msg + "'");
var args = msg.split(" ");
if (verboseDebug) sendDebugMessage("Arg0 is '" + args[0]+"'");
switch (args[0]) {
case "pt", "ptme" -> {
if (!SkyblockTweaks.DATA.amITheLeader) {
if (verboseDebug) sendDebugMessage("Party Transfer Requested, but I am not the leader.");
return;
}
if (verboseDebug) sendDebugMessage("Sending '/p transfer " + name + "'");
SkyblockTweaks.mc.getNetworkHandler().sendChatCommand("p transfer " + name);
}
case "allinv", "allinvite" -> {
if (!SkyblockTweaks.DATA.amITheLeader) {
if (verboseDebug) sendDebugMessage("All Invite Requested, but I am not the leader.");
return;
}
if (verboseDebug) sendDebugMessage("Sending '/p settings allinvite'");
SkyblockTweaks.mc.getNetworkHandler().sendChatCommand("p settings allinvite");
}
case "warp" -> {
if (!SkyblockTweaks.DATA.amITheLeader) {
if (verboseDebug) sendDebugMessage("Warp Requested, but I am not the leader.");
return;
}
if (verboseDebug) sendDebugMessage("Sending '/p warp'");
SkyblockTweaks.mc.getNetworkHandler().sendChatCommand("p warp");
}
case "help" -> {
SkyblockTweaks.LOGGER.info(name);
if ((name.equals(SkyblockTweaks.mc.player.getName().getString()))) {
SkyblockTweaks.mc.player.sendMessage(Text.of("§7[§aSkyblockTweaks§f§7] §fAvailable party commands: !ptme, !allinvite, !warp, !help"), false);
return;
}
if (verboseDebug) sendDebugMessage("Sending help message");
SkyblockTweaks.mc.getNetworkHandler().sendChatCommand("pc [SkyblockTweaks] Available party commands: !ptme, !allinvite, !warp, !help");
}
}
} else if (s.startsWith("The party was transferred to")) {
// This is here in case the packet api fails for some reason
if (verboseDebug) sendDebugMessage("Backup Update Message Received");
var matcher = BACKUP_UPDATE_PATTERN.matcher(s);
if (!matcher.matches()) return;
var name = matcher.group(1);
Expand Down Expand Up @@ -195,6 +216,9 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
private static Text getInviteMessage(String name) {
return TextUtils.getTextThatRunsCommand("§7[§aSkyblockTweaks§f§7] §bClick here to invite §e" + name + "§b to your party!","§3Click here to run §e/p " + name , "/p invite " + name);
}
private static void sendDebugMessage(String message) {
SkyblockTweaks.mc.player.sendMessage(Text.of("§7[§2SBT Party Debugger§f§7]§3 " + message), false);
}


}
22 changes: 12 additions & 10 deletions src/main/java/wtf/cheeze/sbt/features/huds/SkillHUDManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,21 @@ public class SkillHUDManager {

public static final SkillHUDManager INSTANCE = new SkillHUDManager();

private SkillHUDManager() {}
private SkillHUDManager() {
ClientTickEvents.END_CLIENT_TICK.register(client -> {
if (timeLeft > 0) {
timeLeft--;
}
});
}

public final SkillHUD SKILL_HUD = new SkillHUD();
public final SkillBar SKILL_BAR = new SkillBar();

private static final int PERSIST_TICKS = 60;

private int timeLeft = 0;
private SkyblockConstants.Skills currentSkill;
private SkyblockConstants.Skills currentSkill = SkyblockConstants.Skills.UNKNOWN;
private float gained = 0;
private float total = 0;
private float progress = 0;
Expand Down Expand Up @@ -85,11 +91,6 @@ private void commonUpdate(String skillP, float gainedP) {

public class SkillHUD extends TextHUD {
public SkillHUD() {
ClientTickEvents.END_CLIENT_TICK.register(client -> {
if (timeLeft > 0) {
timeLeft--;
}
});
INFO = new HudInformation(
() -> SBTConfig.huds().skills.x,
() -> SBTConfig.huds().skills.y,
Expand Down Expand Up @@ -176,7 +177,7 @@ private static int tryAndGetSkillLevel(SkyblockConstants.Skills skill) {

private static int[] getSkillTable(SkyblockConstants.Skills skill) {
return switch (skill) {
case FARMING, FISHING, FORAGING, MINING, COMBAT, ENCHANTING, ALCHEMY, TAMING, CARPENTRY ->
case FARMING, FISHING, FORAGING, MINING, COMBAT, ENCHANTING, ALCHEMY, TAMING, CARPENTRY, UNKNOWN ->
SkyblockConstants.SKILL_LEVELS;
case RUNECRAFTING -> SkyblockConstants.RUNECRAFTING_LEVELS;
case SOCIAL -> SkyblockConstants.SOCIAL_LEVELS;
Expand Down Expand Up @@ -388,10 +389,11 @@ public String getName() {
@Override
public boolean shouldRender(boolean fromHudScreen) {
if (!super.shouldRender(fromHudScreen)) return false;
if (timeLeft <= 0 && !fromHudScreen) return false;
if (fromHudScreen) return true;
if (timeLeft <= 0) return false;
// Don't display at max level
if (percent == 0 && total == 0 ) return false;
return (SkyblockTweaks.DATA.inSB && SBTConfig.huds().skillBar.enabled) || fromHudScreen;
return (SkyblockTweaks.DATA.inSB && SBTConfig.huds().skillBar.enabled);
}

public static class Config {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/wtf/cheeze/sbt/utils/TextUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public static MutableText withObfuscated(MutableText text) {
return text.styled(style -> style.withObfuscated(true));
}

public static String firstLetterUppercase(String text) {
return text.substring(0, 1).toUpperCase() + text.substring(1);
}




Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wtf/cheeze/sbt/utils/hud/AbstractTickerHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
* The abstract representation of the ticker HUD, for the implementation, see {@link wtf.cheeze.sbt.features.huds.TickerHUD}
*/
public abstract class AbstractTickerHUD extends HUD{
private static final Identifier FULL = Identifier.of("skyblocktweaks", "ticker_full.png");
private static final Identifier BLANK = Identifier.of("skyblocktweaks", "ticker_blank.png");
private static final Identifier FULL = Identifier.of("skyblocktweaks", "tickers/full.png");
private static final Identifier BLANK = Identifier.of("skyblocktweaks", "tickers/blank.png");
private static final int DIMENSION = 9;

public abstract int getMax(boolean fromHudScreen);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wtf/cheeze/sbt/utils/hud/BarHUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
* A HUD that displays a bar, code liberally inspired by SBA, but way simpler thanks to modern mc, bar textures taken directly from SBA
*/
public abstract class BarHUD extends HUD {
public static final Identifier UNFILLED = Identifier.of("skyblocktweaks", "unfill.png");
public static final Identifier FILLED = Identifier.of("skyblocktweaks", "fill.png");
public static final Identifier UNFILLED = Identifier.of("skyblocktweaks", "bars/unfilled.png");
public static final Identifier FILLED = Identifier.of("skyblocktweaks", "bars/filled.png");
public static final int BAR_WIDTH = 71;
public static final int BAR_HEIGHT = 5;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,10 @@ public static enum Crops {
NETHER_WART
}

/**
* Skills
* Unknown is used rather than null when no skill is known to prevent NPEs
*/
public static enum Skills {
COMBAT,
MINING,
Expand All @@ -1196,7 +1200,8 @@ public static enum Skills {
TAMING,
CARPENTRY,
RUNECRAFTING,
SOCIAL
SOCIAL,
UNKNOWN
}

public static enum Powder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static SkyblockConstants.Skills strictCastStringToSkill(String skill) {
case "carpentry" -> SkyblockConstants.Skills.CARPENTRY;
case "runecrafting" -> SkyblockConstants.Skills.RUNECRAFTING;
case "social" -> SkyblockConstants.Skills.SOCIAL;
default -> null;
default -> SkyblockConstants.Skills.UNKNOWN;
};
}
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"wtf.cheeze.sbt.SkyblockTweaks"
],
"modmenu": [
"wtf.cheeze.sbt.config.ModMenu"
"wtf.cheeze.sbt.compat.modmenu.ModMenu"
]
},
"depends": {
Expand Down

0 comments on commit cfde323

Please sign in to comment.