Skip to content
This repository was archived by the owner on Jul 2, 2023. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
118ad05
Basic bedwars stats
DarkKronicle Jan 29, 2023
99ae6a5
Github actions
DarkKronicle Jan 29, 2023
6bb9d95
Merge branch 'Sol-Client:develop' into develop
DarkKronicle Jan 29, 2023
e9515f3
Fix parsing
DarkKronicle Jan 30, 2023
62c4f68
Merge branch 'Sol-Client:develop' into develop
DarkKronicle Jan 30, 2023
ab32878
Setting up game parsing and tablist changes
DarkKronicle Feb 4, 2023
120780f
Fixing tabs
DarkKronicle Feb 4, 2023
45e8cc3
Merge with UI change
DarkKronicle Feb 4, 2023
227fd1d
Team upgrades
DarkKronicle Feb 6, 2023
89a5209
Refactor API
DarkKronicle Feb 6, 2023
9baee40
Changing death messages
DarkKronicle Feb 8, 2023
5ecbdd6
Refactor death messages
DarkKronicle Feb 9, 2023
a753bb5
Add Team Upgrades Overlay
DarkKronicle Feb 11, 2023
8fb45b6
Timings and stats
DarkKronicle Apr 19, 2023
a8e2b80
Merge develop into this
TheKodeToad Apr 20, 2023
e44159d
Licenses
TheKodeToad Apr 20, 2023
1de6a92
Language stuff!
TheKodeToad Apr 20, 2023
01c2dd0
Merge branch 'Sol-Client:develop' into develop
DarkKronicle Apr 22, 2023
b04e252
Merge branch 'Sol-Client:develop' into develop
DarkKronicle Apr 22, 2023
37c49e4
Merge branch 'Sol-Client:develop' into develop
DarkKronicle Apr 23, 2023
f9fc77f
Saving certain elements and fixing windows moment
DarkKronicle Apr 24, 2023
afac073
Adding scale and enabled option for team upgrades
DarkKronicle Apr 24, 2023
e2c164b
More configuration and seconds until respawn
DarkKronicle Apr 24, 2023
5daf510
Merge branch 'Sol-Client:develop' into develop
DarkKronicle Apr 24, 2023
b975f13
Paper doll
DarkKronicle Apr 24, 2023
e962389
Remove unnecessary import
DarkKronicle Apr 24, 2023
d7dbbfa
Merge pull request #1 from DarkKronicle/feature/kronhud-elements
DarkKronicle Apr 24, 2023
b9acbf9
Adding a lot more options and more stat displays
DarkKronicle Apr 26, 2023
4c49233
Remove game specific stats from before/during game
DarkKronicle Apr 26, 2023
dd6f7d7
Remove unnecessary line
DarkKronicle Apr 27, 2023
1e55f40
Licensing
DarkKronicle Apr 27, 2023
1e5ce10
Fix star display
DarkKronicle May 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ repositories {
maven { url 'https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1' }
}

tasks.withType(JavaExec).configureEach {
System.properties.each { k, v ->
if (k.startsWith('run.')) {
systemProperty k - 'run.', v
}
}
}

configurations {
shadeOnly
shade
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/io/github/solclient/client/SolClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,10 @@ private void prepare(ModInfo info) {

private static Gson getGson(Mod mod) {
GsonBuilder builder = new GsonBuilder();
if (mod != null)
builder.registerTypeAdapter(mod.getClass(), (InstanceCreator<Mod>) (type) -> mod);
if (mod != null) {
builder.registerTypeAdapter(mod.getClass(), (InstanceCreator<Mod>) (type) -> mod);
mod.registerOtherTypeAdapters(builder);
}

return builder.excludeFieldsWithoutExposeAnnotation().create();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@
package io.github.solclient.client.event.impl;

import lombok.RequiredArgsConstructor;
import net.minecraft.text.Text;

@RequiredArgsConstructor
public class ReceiveChatMessageEvent {

public final boolean actionBar;
public final String message;
public final String originalMessage;
public final Text formattedMessage;
/**
* Whether the event is fired from the replay mod.
*/
public final boolean replay;
public boolean cancelled;
public Text newMessage = null;

}
4 changes: 4 additions & 0 deletions src/main/java/io/github/solclient/client/mod/Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ public void setPinned(boolean pinned) {
}
}

public void registerOtherTypeAdapters(GsonBuilder builder) {

}

void notifyUnpin() {
pinned = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package io.github.solclient.client.mod.impl.core.mixins.client;

import net.minecraft.text.LiteralText;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down Expand Up @@ -56,16 +57,20 @@ public void handleEntityStatus(EntityStatusS2CPacket packet, CallbackInfo callba

@Redirect(method = "onChatMessage", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;addMessage(Lnet/minecraft/text/Text;)V"))
public void handleChat(ChatHud instance, Text message) {
if (!EventBus.INSTANCE.post(
new ReceiveChatMessageEvent(false, Formatting.strip(message.asUnformattedString()), false)).cancelled) {
instance.addMessage(message);
ReceiveChatMessageEvent event = new ReceiveChatMessageEvent(false, Formatting.strip(message.asUnformattedString()), message, false);
if (!EventBus.INSTANCE.post(event).cancelled) {
if (event.newMessage != null) {
instance.addMessage(event.newMessage);
} else {
instance.addMessage(message);
}
}
}

@Redirect(method = "onChatMessage", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;setOverlayMessage(Lnet/minecraft/text/Text;Z)V"))
public void handleActionBar(InGameHud instance, Text text, boolean tinted) {
if (!EventBus.INSTANCE.post(
new ReceiveChatMessageEvent(true, Formatting.strip(text.asUnformattedString()), false)).cancelled) {
new ReceiveChatMessageEvent(true, Formatting.strip(text.asUnformattedString()), text, false)).cancelled) {
instance.setOverlayMessage(text, tinted);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*
* Sol Client - an open source Minecraft client
* Copyright (C) 2021-2023 TheKodeToad and Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package io.github.solclient.client.mod.impl.hud;

import com.google.gson.annotations.Expose;
import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.platform.GlStateManager;
import io.github.solclient.client.event.EventHandler;
import io.github.solclient.client.event.impl.PlayerHeadRotateEvent;
import io.github.solclient.client.event.impl.PreTickEvent;
import io.github.solclient.client.mod.impl.SolClientHudMod;
import io.github.solclient.client.mod.option.ModOption;
import io.github.solclient.client.mod.option.ModOptionStorage;
import io.github.solclient.client.mod.option.annotation.AbstractTranslationKey;
import io.github.solclient.client.mod.option.annotation.Option;
import io.github.solclient.client.mod.option.impl.SliderOption;
import io.github.solclient.client.util.MinecraftUtils;
import io.github.solclient.client.util.data.Position;
import io.github.solclient.client.util.data.Rectangle;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.DiffuseLighting;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.resource.language.I18n;

import java.util.List;
import java.util.Optional;

// Originally from KronHUD
// Added here by DarkKronicle :)
// https://github.com/DarkKronicle/KronHUD/blob/master/src/main/java/io/github/darkkronicle/kronhud/gui/hud/PlayerHud.java
@AbstractTranslationKey("sol_client.mod.paperdoll")
public class PaperDollMod extends SolClientHudMod {

@Expose
@Option
private boolean dynamicRotation = true;

@Expose
private float rotation = 0;

private float lastYawOffset = 0;
private float yawOffset = 0;

@Override
public Rectangle getBounds(Position position) {
return new Rectangle(position.getX(), position.getY(), 62, 94);
}

@Override
public String getDetail() {
return I18n.translate("sol_client.mod.screen.by", "DarkKronicle"); // maybe also add original creator
}

@Override
protected List<ModOption<?>> createOptions() {
List<ModOption<?>> options = super.createOptions();
Optional<String> format = Optional.empty();
options.add(
new SliderOption(
"sol_client.mod.paperdoll.option.rotation",
ModOptionStorage.of(Number.class, () -> rotation, (value) -> rotation = value.floatValue()),
format, 0, 360, 1
)
);
return options;
}

public void renderPlayer(double x, double y, float delta) {
if (mc.player == null) {
return;
}

float deltaYaw = mc.player.prevYaw + (mc.player.yaw - mc.player.prevYaw) * delta;
if (dynamicRotation) {
deltaYaw -= (lastYawOffset + ((yawOffset - lastYawOffset) * delta));
}

GlStateManager.enableLighting();
GlStateManager.color(1, 1, 1, 1);
GlStateManager.enableColorMaterial();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y, 500.0F);
GlStateManager.scale((float) (-40), (float) 40, (float) 40);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);

GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
DiffuseLighting.enableNormally();
GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(deltaYaw + rotation, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, 0.0F);

EntityRenderDispatcher entityRenderDispatcher = MinecraftClient.getInstance().getEntityRenderManager();
entityRenderDispatcher.setYaw(0);
entityRenderDispatcher.setRenderShadows(false);
entityRenderDispatcher.render(mc.player, 0.0, 0.0, 0.0, 0.0F, MinecraftUtils.getTickDelta());
entityRenderDispatcher.setRenderShadows(true);

GlStateManager.popMatrix();
DiffuseLighting.disable();
GlStateManager.disableRescaleNormal();
GlStateManager.activeTexture(GLX.lightmapTextureUnit);
GlStateManager.disableTexture();
GlStateManager.activeTexture(GLX.textureUnit);

}

@EventHandler
public void onPlayerRotate(PlayerHeadRotateEvent event) {
if (event.yaw == 0 && event.pitch == 0) {
return;
}
yawOffset += (event.yaw * .15) / 2;
}

@Override
public void render(Position position, boolean editMode) {
renderPlayer(position.getX() + 31, position.getY() + 86, MinecraftUtils.getTickDelta());
}

@EventHandler
public void onTick(PreTickEvent event) {
lastYawOffset = yawOffset;
yawOffset *= .93f;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Sol Client - an open source Minecraft client
* Copyright (C) 2021-2023 TheKodeToad and Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package io.github.solclient.client.mod.impl.hud.bedwarsoverlay;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@AllArgsConstructor
public enum BedwarsDeathType {
COMBAT("rekt", BedwarsMessages.COMBAT_KILL),
VOID("yeeted into void", BedwarsMessages.VOID_KILL),
PROJECTILE("shot", BedwarsMessages.PROJECTILE_KILL),
FALL("fall", BedwarsMessages.FALL_KILL),
GOLEM("golem moment", BedwarsMessages.GOLEM_KILL),
SELF_VOID("voided", new Pattern[]{BedwarsMessages.SELF_VOID}),
SELF_UNKNOWN("died", new Pattern[]{BedwarsMessages.SELF_UNKNOWN}),
;

@Getter
private final String inner;

@Getter
private final Pattern[] patterns;

public static boolean getDeath(String rawMessage, BedwarsDeathMatch ifPresent) {
for (BedwarsDeathType type : values()) {
if (BedwarsMessages.matched(type.getPatterns(), rawMessage, m -> ifPresent.onMatch(type, m))) {
return true;
}
}
return false;
}

public interface BedwarsDeathMatch {

void onMatch(BedwarsDeathType type, Matcher matcher);

}
}
Loading