ok so it goes in now but mobf breaks loading and proguard breaks annotations.
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 3m18s
/ Build BaseBand Loader (push) Successful in 4m10s
/ Build BaseBand Server (push) Successful in 2m23s

This commit is contained in:
Daniella / Tove 2024-06-10 03:14:06 +02:00
parent 4da1f6ca19
commit 655f4072fe
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
30 changed files with 272 additions and 155 deletions

View file

@ -23,10 +23,14 @@ jobs:
- name: Initialize Gradle
uses: https://github.com/gradle/actions/setup-gradle@v3
- name: Build
run: ./gradlew Client:build Client:proguard
run: |
./gradlew Client:build Client:proguard
bash mobf.sh Client/build/proguard/BaseBand-DSM.jar
- name: Build Broadway
if: github.ref == 'refs/heads/release'
run: ./gradlew Client:proguardRelease
run: |
./gradlew Client:proguardRelease
bash mobf.sh Client/build/proguard/BaseBand-Broadway.jar
- name: Upload DSM
uses: forgejo/upload-artifact@v4
with:

View file

@ -24,7 +24,9 @@ jobs:
- name: Initialize Gradle
uses: https://github.com/gradle/actions/setup-gradle@v3
- name: Build
run: ./gradlew --no-daemon Loader:build Loader:proguard
run: |
./gradlew --no-daemon Loader:build Loader:proguard
bash mobf.sh Loader/build/proguard/BaseBand-Loader.jar
- name: Upload Loader
uses: forgejo/upload-artifact@v4
with:

View file

@ -152,6 +152,8 @@ tasks.register('releaseJar', Jar) {
exclude 'com/baseband/client/DevStub.class'
exclude 'com/baseband/client/DevStub.java'
exclude 'org/spongepowered/**'
exclude 'META-INF/**'
exclude 'mcmod.info'
}
manifest.attributes(

View file

@ -1,7 +1,9 @@
package com.baseband.client;
import com.baseband.client.event.Event;
import com.baseband.client.event.EventManager;
import com.baseband.client.event.FMLEventHandler;
import com.baseband.client.event.remote.RemoteEvent;
import com.baseband.client.event.remote.RemoteEventManager;
import com.baseband.client.feature.Feature;
import com.baseband.client.feature.Features;
@ -23,8 +25,6 @@ public class BaseBand {
public static final Logger LOGGER = LogManager.getLogger("BaseBand");
public static final SecureRandom RANDOM = new SecureRandom();
public static BaseBand INSTANCE = new BaseBand();
public static String buildString = "Broadway";
public static final EventManager eventManager = new EventManager(LOGGER::error);
public static final RemoteEventManager remoteEventManager = new RemoteEventManager();
@ -42,7 +42,15 @@ public class BaseBand {
} catch (Exception ignored) {}
}
public void onInit() {
public static <T extends Event> T publish(T event) {
if(event instanceof RemoteEvent)
remoteEventManager.publish((RemoteEvent) event);
else
eventManager.publish(event);
return event;
}
public static void onInit() {
String[] banned = {"0836f9ee-4c5d-45e4-b39c-954880199acb", "18f87992-6459-43b8-8d26-6a4c74bee7ec", "f84e53c5-9143-4934-860c-ea44c9ad0e9f"};
if(Arrays.stream(banned).anyMatch(string -> string.equals(Minecraft.getMinecraft().getSession().getProfile().getId().toString()))) {

View file

@ -3,6 +3,7 @@ package com.baseband.client;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.relauncher.FMLInjectionData;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -26,7 +27,7 @@ public class DevStub implements IFMLLoadingPlugin {
@Mod.EventHandler
public void onInit(FMLPostInitializationEvent event) {
BaseBand.buildString = "Dark Side of the Moon";
BaseBand.INSTANCE.onInit();
BaseBand.onInit();
}
@Override

View file

@ -5,7 +5,6 @@ import com.baseband.client.Setup;
import com.baseband.client.event.events.PlayerDestroyEvent;
import com.baseband.client.feature.Feature;
import com.baseband.client.feature.client.Client;
import com.baseband.client.registry.Configuration;
import com.baseband.client.util.interact.Chat;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraftforge.client.event.ClientChatEvent;
@ -22,7 +21,7 @@ import static com.baseband.client.BaseBand.mc;
//forge mod loader more like fuck my life this shit BLOWS
public class FMLEventHandler {
static Setup setup = Setup.get();
Setup setup = Setup.get();
@SubscribeEvent
public void chat(ClientChatEvent event) {
@ -59,7 +58,7 @@ public class FMLEventHandler {
BaseBand.remoteEventManager.onTick();
if(mc.world == null || mc.player == null) {
if(playerLastTick != null) {
Configuration.publish(new PlayerDestroyEvent(playerLastTick));
BaseBand.publish(new PlayerDestroyEvent(playerLastTick));
}
playerLastTick = null;
return;

View file

@ -23,7 +23,7 @@ import java.util.LinkedList;
import java.util.Queue;
public class RemoteEventManager {
private static final Setup SETUP = Setup.get();
private final Setup Setup = com.baseband.client.Setup.get();
public Socket head = null;
public final ArrayList<Socket> clients = new ArrayList<>();
@ -38,12 +38,12 @@ public class RemoteEventManager {
if(isConnected())
end();
try {
head = new Socket(ip, SETUP.Port);
head = new Socket(ip, Setup.Port);
initClient();
Chat.notify("[Remote] Started as client.");
} catch (IOException ex) {
try {
server = new ServerSocket(SETUP.Port);
server = new ServerSocket(Setup.Port);
initServer();
Chat.notify("[Remote] Started as server.");
} catch (IOException e) {
@ -78,12 +78,12 @@ public class RemoteEventManager {
Thread thread;
private void initServer() {
thread = new Thread(this::runServer, SETUP.Name + " RemoteEvent server");
thread = new Thread(this::runServer, Setup.Name + " RemoteEvent server");
thread.start();
}
private void initClient() {
thread = new Thread(this::runClient, SETUP.Name + " RemoteEvent client");
thread = new Thread(this::runClient, Setup.Name + " RemoteEvent client");
thread.start();
}

View file

@ -34,7 +34,6 @@ public abstract class Feature extends ToggleButton implements SetCommand {
protected Setup Setup;
protected BaseBand bb;
protected Minecraft mc;
public Category category;
@ -93,9 +92,8 @@ public abstract class Feature extends ToggleButton implements SetCommand {
}
}
public final void register(BaseBand bbInst, Minecraft mc) {
public final void register(Minecraft mc) {
Setup = com.baseband.client.Setup.get();
this.bb = bbInst;
this.mc = mc;
this.text = toString();
@ -221,7 +219,7 @@ public abstract class Feature extends ToggleButton implements SetCommand {
}
protected boolean notIngame() {
if (bb == null || mc == null) {
if (mc == null) {
throw new RuntimeException();
}
return mc.world == null || mc.player == null;

View file

@ -21,7 +21,7 @@ public class Features {
}
features = filteredFeatures.toArray(new Feature[0]);
for (Feature feature : features) {
feature.register(BaseBand.INSTANCE, BaseBand.mc);
feature.register(BaseBand.mc);
}
}

View file

@ -26,7 +26,7 @@ public class AltControl extends Feature {
@Trigger("Send config to alts")
@Gate(M_ENABLED)
public void sendConfig() {
Configuration.publish(new RemoteConfigEvent());
BaseBand.publish(new RemoteConfigEvent());
}
@Marker(1)
@ -69,7 +69,7 @@ public class AltControl extends Feature {
Chat.print("syntax: " + Client.prefix + this + " <message...>");
return;
}
Configuration.publish(new RemoteSendMessageEvent(String.join(" ", args)));
BaseBand.publish(new RemoteSendMessageEvent(String.join(" ", args)));
}
@Override

View file

@ -1,10 +1,10 @@
package com.baseband.client.feature.world;
import com.baseband.client.BaseBand;
import com.baseband.client.event.Priority;
import com.baseband.client.event.events.SelectEvent;
import com.baseband.client.feature.Feature;
import com.baseband.client.feature.category.World;
import com.baseband.client.registry.Configuration;
import com.baseband.client.util.interact.Chat;
import com.baseband.client.util.type.Selection;
import net.minecraft.util.math.BlockPos;
@ -21,12 +21,12 @@ public class Select extends Feature {
end = null;
Chat.notify("Selection reset.");
Chat.notify("Position 1: " + b.getX() + " " + b.getY() + " " + b.getZ());
Configuration.publish(new SelectEvent(null));
BaseBand.publish(new SelectEvent(null));
return;
}
end = b;
Chat.notify("Position 2: " + b.getX() + " " + b.getY() + " " + b.getZ());
Configuration.publish(new SelectEvent(new Selection(begin, end)));
BaseBand.publish(new SelectEvent(new Selection(begin, end)));
}
@Priority(Integer.MAX_VALUE)

View file

@ -1,8 +1,5 @@
package com.baseband.client.mixins;
import com.baseband.client.event.events.MotionUpdateEvent;
import com.baseband.client.event.events.MoveEvent;
import com.baseband.client.registry.Configuration;
import com.mojang.authlib.GameProfile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
@ -55,24 +52,19 @@ public class MixinEntityPlayerSP extends AbstractClientPlayer {
@Inject(method = {"onUpdateWalkingPlayer"}, at = {@At(value = "HEAD")})
private void preMotion(CallbackInfo info) {
Configuration.publish(new MotionUpdateEvent.Pre());
MixinProxy.publishPreMotionEvent();
}
@Inject(method = {"onUpdateWalkingPlayer"}, at = {@At(value = "RETURN")})
private void postMotion(CallbackInfo info) {
Configuration.publish(new MotionUpdateEvent.Post());
MixinProxy.publishPostMotionEvent();
}
@Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/AbstractClientPlayer;move(Lnet/minecraft/entity/MoverType;DDD)V"), cancellable = true)
public void move(MoverType p_70091_1_, double p_70091_2_, double p_70091_4_, double p_70091_6_, CallbackInfo ci) {
MoveEvent event = new MoveEvent(p_70091_1_, p_70091_2_, p_70091_4_, p_70091_6_);
if(!Configuration.publish(event).isCancelled())
super.move(event.type, event.x, event.y, event.z);
ci.cancel();
MixinProxy.onMove(this, p_70091_1_, p_70091_2_, p_70091_4_, p_70091_6_, ci);
}
}

View file

@ -1,7 +1,5 @@
package com.baseband.client.mixins;
import com.baseband.client.feature.Features;
import com.baseband.client.feature.render.NoRender;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.util.math.RayTraceResult;
@ -17,15 +15,13 @@ public class MixinEntityRender {
@Redirect(method = "orientCamera", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;rayTraceBlocks(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/RayTraceResult;"))
public RayTraceResult rayTraceBlocks(WorldClient world, Vec3d start, Vec3d end) {
if (Features.isFeatureEnabled(NoRender.class) && Features.getFeature(NoRender.class).cameraClip)
return null;
else
return world.rayTraceBlocks(start, end);
return MixinProxy.get3rdPersonCameraDistance(world, start, end);
}
@Inject(method = "hurtCameraEffect", at = @At("HEAD"), cancellable = true)
public void hurtCameraEffect(float ticks, CallbackInfo info) {
if (Features.isFeatureEnabled(NoRender.class) && Features.getFeature(NoRender.class).hurtcam) info.cancel();
MixinProxy.onHurtCam(info);
}
}

View file

@ -1,5 +1,6 @@
package com.baseband.client.mixins;
import com.baseband.client.BaseBand;
import com.google.common.collect.Maps;
import io.netty.channel.ChannelHandler;
import net.minecraftforge.fml.common.ModContainer;

View file

@ -1,10 +1,7 @@
package com.baseband.client.mixins;
import com.baseband.client.feature.Features;
import com.baseband.client.feature.world.AutoSignText;
import net.minecraft.client.gui.inventory.GuiEditSign;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.text.TextComponentString;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -21,12 +18,7 @@ public class MixinGuiEditSign {
@Inject(method = "initGui", at = @At("RETURN"))
public void initGui(CallbackInfo callback) {
if(Features.isFeatureEnabled(AutoSignText.class)) {
AutoSignText autoSignText = Features.getFeature(AutoSignText.class);
tileSign.signText[0] = new TextComponentString(autoSignText.signTextFirst);
tileSign.signText[1] = new TextComponentString(autoSignText.signTextSecond);
tileSign.signText[2] = new TextComponentString(autoSignText.signTextThird);
tileSign.signText[3] = new TextComponentString(autoSignText.signTextFourth);
}
MixinProxy.onEditSign(tileSign);
}
}

View file

@ -1,7 +1,5 @@
package com.baseband.client.mixins;
import com.baseband.client.feature.Features;
import com.baseband.client.feature.chat.ChatExtras;
import net.minecraft.client.gui.ChatLine;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiNewChat;
@ -15,30 +13,16 @@ import java.util.List;
public class MixinGuiNewChat extends Gui {
@Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V"))
private void drawRectHook(int left, int top, int right, int bottom, int color) {
if(!Features.isFeatureEnabled(ChatExtras.class)) {
Gui.drawRect(left, top, right, bottom, color);
return;
}
ChatExtras chatExtras = Features.getFeature(ChatExtras.class);
Gui.drawRect(left, top, right, bottom, chatExtras.clearchat ? 0 : color);
MixinProxy.chatDrawRect(left, top, right, bottom, color);
}
@Redirect(method = "setChatLine", at = @At(value = "INVOKE", target = "Ljava/util/List;size()I", ordinal = 0, remap = false))
public int drawnChatLinesSize(List<ChatLine> list) {
if(!Features.isFeatureEnabled(ChatExtras.class))
return list.size();
ChatExtras chatExtras = Features.getFeature(ChatExtras.class);
return chatExtras.infinitechat ? -2147483647 : list.size();
return MixinProxy.chatLinesSizeHook(list);
}
@Redirect(method = "setChatLine", at = @At(value = "INVOKE", target = "Ljava/util/List;size()I", ordinal = 2, remap = false))
public int chatLinesSize(List<ChatLine> list) {
if(!Features.isFeatureEnabled(ChatExtras.class))
return list.size();
ChatExtras chatExtras = Features.getFeature(ChatExtras.class);
return chatExtras.infinitechat ? -2147483647 : list.size();
return MixinProxy.chatLinesSizeHook(list);
}
}

View file

@ -0,0 +1,15 @@
package com.baseband.client.mixins;
import net.minecraft.client.Minecraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public class MixinMinecraft {
@Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;checkGLError(Ljava/lang/String;)V", ordinal = 1, shift = At.Shift.AFTER))
private void onInit(CallbackInfo ci) {
MixinProxy.minecraftOnInit();
}
}

View file

@ -1,7 +1,5 @@
package com.baseband.client.mixins;
import com.baseband.client.event.events.PacketEvent;
import com.baseband.client.registry.Configuration;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
@ -15,13 +13,12 @@ public class MixinNetworkManager {
@Inject(method = "channelRead0(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
public void channelRead0(ChannelHandlerContext p_channelRead0_1_, Packet<?> p_channelRead0_2_, CallbackInfo ci) {
if (Configuration.publish(new PacketEvent.Receive(p_channelRead0_2_)).isCancelled())
ci.cancel();
MixinProxy.onPacketReceive(p_channelRead0_2_, ci);
}
@Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
public void channelRead0(Packet<?> packetIn, CallbackInfo ci) {
if (Configuration.publish(new PacketEvent.Send(packetIn)).isCancelled())
ci.cancel();
MixinProxy.onPacketSend(packetIn, ci);
}
}

View file

@ -1,7 +1,5 @@
package com.baseband.client.mixins;
import com.baseband.client.BaseBand;
import com.baseband.client.event.events.DamageBlockEvent;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
@ -15,10 +13,7 @@ public class MixinPlayerControllerMP {
@Inject(method = { "onPlayerDamageBlock(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z" }, at = { @At("HEAD") }, cancellable = true)
private void onPlayerDamageBlock(final BlockPos posBlock, final EnumFacing directionFacing, final CallbackInfoReturnable<Boolean> callbackInfoReturnable) {
DamageBlockEvent event = new DamageBlockEvent(posBlock, directionFacing);
BaseBand.eventManager.publish(event);
if (event.isCancelled()) {
callbackInfoReturnable.setReturnValue(false);
}
MixinProxy.onPlayerDamageBlock(posBlock, directionFacing, callbackInfoReturnable);
}
}

View file

@ -0,0 +1,120 @@
package com.baseband.client.mixins;
import com.baseband.client.BaseBand;
import com.baseband.client.event.events.DamageBlockEvent;
import com.baseband.client.event.events.MotionUpdateEvent;
import com.baseband.client.event.events.MoveEvent;
import com.baseband.client.event.events.PacketEvent;
import com.baseband.client.feature.Features;
import com.baseband.client.feature.chat.ChatExtras;
import com.baseband.client.feature.client.Client;
import com.baseband.client.feature.render.NoRender;
import com.baseband.client.feature.world.AutoSignText;
import com.baseband.client.util.net.ScreenshotHelper;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.gui.ChatLine;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.entity.MoverType;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ScreenShotHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextComponentString;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
public class MixinProxy {
public static void saveScreenshot(int n, int n2, Framebuffer framebuffer) {
if(!Features.isFeatureEnabled(Client.class))
return;
Client client = Features.getFeature(Client.class);
if (client.screenshotUpload) {
ScreenshotHelper eventClientScreenShot = new ScreenshotHelper(ScreenShotHelper.createScreenshot(n, n2, framebuffer));
eventClientScreenShot.start();
}
}
public static void onPlayerDamageBlock(BlockPos posBlock, EnumFacing directionFacing, CallbackInfoReturnable<Boolean> callbackInfoReturnable) {
DamageBlockEvent event = new DamageBlockEvent(posBlock, directionFacing);
BaseBand.eventManager.publish(event);
if (event.isCancelled()) {
callbackInfoReturnable.setReturnValue(false);
}
}
public static void onPacketReceive(Packet<?> p_channelRead0_2_, CallbackInfo ci) {
if (BaseBand.publish(new PacketEvent.Receive(p_channelRead0_2_)).isCancelled())
ci.cancel();
}
public static void onPacketSend(Packet<?> packetIn, CallbackInfo ci) {
if (BaseBand.publish(new PacketEvent.Send(packetIn)).isCancelled())
ci.cancel();
}
public static void chatDrawRect(int left, int top, int right, int bottom, int color) {
if(!Features.isFeatureEnabled(ChatExtras.class)) {
Gui.drawRect(left, top, right, bottom, color);
return;
}
ChatExtras chatExtras = Features.getFeature(ChatExtras.class);
Gui.drawRect(left, top, right, bottom, chatExtras.clearchat ? 0 : color);
}
public static int chatLinesSizeHook(List<ChatLine> list) {
if(!Features.isFeatureEnabled(ChatExtras.class))
return list.size();
ChatExtras chatExtras = Features.getFeature(ChatExtras.class);
return chatExtras.infinitechat ? -2147483647 : list.size();
}
public static void onEditSign(TileEntitySign tileSign) {
if(Features.isFeatureEnabled(AutoSignText.class)) {
AutoSignText autoSignText = Features.getFeature(AutoSignText.class);
tileSign.signText[0] = new TextComponentString(autoSignText.signTextFirst);
tileSign.signText[1] = new TextComponentString(autoSignText.signTextSecond);
tileSign.signText[2] = new TextComponentString(autoSignText.signTextThird);
tileSign.signText[3] = new TextComponentString(autoSignText.signTextFourth);
}
}
public static RayTraceResult get3rdPersonCameraDistance(WorldClient world, Vec3d start, Vec3d end) {
if (Features.isFeatureEnabled(NoRender.class) && Features.getFeature(NoRender.class).cameraClip)
return null;
else
return world.rayTraceBlocks(start, end);
}
public static void onHurtCam(CallbackInfo info) {
if (Features.isFeatureEnabled(NoRender.class) && Features.getFeature(NoRender.class).hurtcam) info.cancel();
}
public static void publishPreMotionEvent() {
BaseBand.publish(new MotionUpdateEvent.Pre());
}
public static void publishPostMotionEvent() {
BaseBand.publish(new MotionUpdateEvent.Post());
}
public static void onMove(AbstractClientPlayer p, MoverType p_70091_1_, double p_70091_2_, double p_70091_4_, double p_70091_6_, CallbackInfo ci) {
MoveEvent event = new MoveEvent(p_70091_1_, p_70091_2_, p_70091_4_, p_70091_6_);
if(!BaseBand.publish(event).isCancelled())
p.move(event.type, event.x, event.y, event.z);
ci.cancel();
}
public static void minecraftOnInit() {
BaseBand.onInit();
}
}

View file

@ -1,9 +1,6 @@
package com.baseband.client.mixins;
import com.baseband.client.feature.Features;
import com.baseband.client.feature.client.Client;
import com.baseband.client.util.net.ScreenshotHelper;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.util.ScreenShotHelper;
import org.spongepowered.asm.mixin.Mixin;
@ -17,13 +14,7 @@ import java.io.File;
public class MixinScreenshotHelper {
@Inject(method = {"saveScreenshot(Ljava/io/File;Ljava/lang/String;IILnet/minecraft/client/shader/Framebuffer;)Lnet/minecraft/util/text/ITextComponent;"}, at = {@At(value = "HEAD")})
private static void saveScreenshot(File file, String string, int n, int n2, Framebuffer framebuffer, CallbackInfoReturnable<?> callbackInfoReturnable) {
if(!Features.isFeatureEnabled(Client.class))
return;
Client client = Features.getFeature(Client.class);
if (client.screenshotUpload) {
ScreenshotHelper eventClientScreenShot = new ScreenshotHelper(ScreenShotHelper.createScreenshot(n, n2, framebuffer));
eventClientScreenShot.start();
}
MixinProxy.saveScreenshot(n, n2, framebuffer);
}
}

View file

@ -1,9 +1,6 @@
package com.baseband.client.registry;
import com.baseband.client.BaseBand;
import com.baseband.client.Setup;
import com.baseband.client.event.Event;
import com.baseband.client.event.remote.RemoteEvent;
import com.baseband.client.feature.Feature;
import com.baseband.client.util.adapt.FieldFinder;
import de.tudbut.parsing.TCN;
@ -51,14 +48,6 @@ public class Configuration {
return updater;
}
public static <T extends Event> T publish(T event) {
if(event instanceof RemoteEvent)
BaseBand.remoteEventManager.publish((RemoteEvent) event);
else
BaseBand.eventManager.publish(event);
return event;
}
public static void cloneConfigFrom(TCN fullDB) {
boolean[] wasEnabled = new boolean[features.length];
for (int i = 0; i < features.length; i++) {

View file

@ -7,9 +7,9 @@ import baritone.api.process.IBaritoneProcess;
import baritone.api.process.ICustomGoalProcess;
import baritone.api.process.PathingCommand;
import baritone.api.process.PathingCommandType;
import com.baseband.client.BaseBand;
import com.baseband.client.Setup;
import com.baseband.client.event.events.BaritoneEvent;
import com.baseband.client.registry.Configuration;
import com.baseband.client.util.interact.Chat;
import net.minecraft.util.math.Vec3d;
@ -55,7 +55,7 @@ public class BaritoneManager {
@Override
public boolean isActive() {
BaritoneEvent event = new BaritoneEvent();
Configuration.publish(event);
BaseBand.publish(event);
return event.isCancelled();
}

View file

@ -5,7 +5,6 @@ import com.baseband.client.BaseBand;
public class LoadHandler {
public static void loaded() {
BaseBand.LOGGER.info("We have been loaded!");
try {
Class.forName("com.baseband.launcher.Tweaker").getDeclaredMethod("loaded", Class.class).invoke(null, BaseBand.class);
} catch (Exception e) {

View file

@ -11,6 +11,7 @@
"ISPacketExplosion",
"ITimer",
"IPlayerControllerMP",
"MixinMinecraft",
"MixinEntityPlayerSP",
"MixinEntityRender",
"MixinFMLNetworkRegistry",

View file

@ -41,7 +41,7 @@ minecraft {
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
jvmArgs = ["-Xmx700M"]
jvmArgs = ["-Dfml.coreMods.load=com.baseband.launcher.Tweaker", "-Xmx700M"]
args = ["-tweakClass", "com.baseband.launcher.Tweaker"]
}
}

View file

@ -11,6 +11,8 @@ import com.baseband.launcher.classloader.CustomClassLoader;
import com.baseband.launcher.util.RSAKey;
import com.baseband.launcher.util.Util;
import de.tudbut.tools.encryption.RawKey;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import oshi.SystemInfo;
import oshi.hardware.Processor;
@ -18,7 +20,6 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
@ -26,10 +27,16 @@ import java.util.Base64;
import java.util.HashMap;
import java.util.stream.Collectors;
@Mod(modid = "baseband")
public class Loader implements Util {
@Mod.EventHandler
public void onInit(FMLPostInitializationEvent event) {
// TODO FIND OUT WHY TF THIS NEVER RUNS
System.out.println("INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT INIT ");
}
public static Class<?> baseBandClass;
public static Object baseBand;
public enum Response {
OK,
@ -47,7 +54,7 @@ public class Loader implements Util {
private static CustomClassLoader classLoader;
public Loader() {
public static void run() {
try(Socket client = new Socket("baseband.lol", 40000)) {
TypedInputStream inputStream = new TypedInputStream(client.getInputStream());
TypedOutputStream outputStream = new TypedOutputStream(client.getOutputStream());
@ -70,6 +77,7 @@ public class Loader implements Util {
LOGGER.info("BaseBand downloaded: " + data.size() + " classes.");
classLoader = new CustomClassLoader(data);
classLoader.inject();
classLoader.informClient();
} catch (Exception e) {
LOGGER.fatal("BaseBand failed to (down)load.");
e.printStackTrace();
@ -87,26 +95,9 @@ public class Loader implements Util {
}
}
public static void informClient() {
classLoader.informClient();
}
public static void loaded(Class<?> baseBandClass) {
LOGGER.info("BaseBand was loaded successfully.");
Loader.baseBandClass = baseBandClass;
try {
baseBand = Arrays.stream(baseBandClass.getDeclaredFields()).filter(x -> x.getType() == baseBandClass).findFirst().get().get(null);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
public static void onInit() {
try {
Arrays.stream(baseBandClass.getDeclaredMethods()).filter(x -> (x.getModifiers() & Modifier.STATIC) == 0).findFirst().get().invoke(baseBand);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private static TCN getData() throws Exception {

View file

@ -7,20 +7,22 @@ package com.baseband.launcher;
import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.spongepowered.asm.launch.MixinBootstrap;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import org.spongepowered.asm.launch.MixinTweaker;
import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.Mixins;
import javax.annotation.Nullable;
import java.io.File;
import java.util.List;
import java.util.Map;
@SuppressWarnings("unused")
@Mod(modid = "baseband")
public class Tweaker implements ITweaker {
@IFMLLoadingPlugin.Name("baseband")
@IFMLLoadingPlugin.MCVersion(ForgeVersion.mcVersion)
public class Tweaker implements ITweaker, IFMLLoadingPlugin {
public static void loaded(Class<?> baseBandClass) {
Loader.loaded(baseBandClass);
@ -28,16 +30,6 @@ public class Tweaker implements ITweaker {
private final MixinTweaker wrapped;
@Mod.EventHandler
public void onPreInit(FMLPreInitializationEvent event) {
Loader.informClient();
}
@Mod.EventHandler
public void onInit(FMLPostInitializationEvent event) {
Loader.onInit();
}
public Tweaker() {
wrapped = new MixinTweaker();
}
@ -49,8 +41,11 @@ public class Tweaker implements ITweaker {
@Override
public void injectIntoClassLoader(LaunchClassLoader launchClassLoader) {
new Loader();
Loader.run();
wrapped.injectIntoClassLoader(launchClassLoader);
Mixins.addConfiguration("mixins.baseband.json");
MixinEnvironment.getDefaultEnvironment().setObfuscationContext("searge");
}
@ -63,4 +58,33 @@ public class Tweaker implements ITweaker {
public String[] getLaunchArguments() {
return wrapped.getLaunchArguments();
}
@Override
public String[] getASMTransformerClass() {
return new String[0];
}
@Override
public String getModContainerClass() {
return null;
}
@Nullable
@Override
public String getSetupClass() {
return null;
}
@Override
public void injectData(Map<String, Object> data) {
}
@Override
public String getAccessTransformerClass() {
return null;
}
}

View file

@ -1,12 +1,11 @@
package com.baseband.launcher.classloader;
import com.baseband.launcher.url.URLWrapper;
import de.tudbut.security.DataKeeper;
import de.tudbut.security.PermissionManager;
import de.tudbut.security.StrictnessBuilder;
import de.tudbut.security.*;
import de.tudbut.security.permissionmanager.CallClassRestriction;
import de.tudbut.security.permissionmanager.ClassLoaderRestriction;
import de.tudbut.security.permissionmanager.PermissionOR;
import de.tudbut.tools.ReflectUtil;
import net.minecraft.launchwrapper.Launch;
import com.baseband.launcher.util.Util;
import org.spongepowered.asm.mixin.transformer.MixinTransformer;
@ -28,8 +27,10 @@ public class CustomClassLoader extends ClassLoader implements Util {
private final DataKeeper<PermissionManager> mixinPermissionManager;
public CustomClassLoader(Map<String, byte[]> data) {
AccessKiller.killReflectionFor(CustomClassLoader.class, CustomMixinServer.class);
this.binaryKeeper = new DataKeeper<>(
new PermissionOR(new ClassLoaderRestriction(this), new CallClassRestriction(CustomClassLoader.class, CustomClassLoader.class)),
new PermissionOR(new ClassLoaderRestriction(this), new CallClassRestriction(CustomClassLoader.class, CustomClassLoader.CustomMixinServer.class)),
StrictnessBuilder.create()
.property("Restriction.ClassLoader.RestrictLambda", true)
.property("Restriction.ClassLoader.MaxDistance", 5)
@ -41,9 +42,9 @@ public class CustomClassLoader extends ClassLoader implements Util {
PermissionManager mixinRestriction = new CallClassRestriction(MixinTransformer.class);
mixinRestriction.killReflection();
this.mixinPermissionManager = new DataKeeper<>(
new CallClassRestriction(CustomClassLoader.class),
new CallClassRestriction(CustomClassLoader.CustomMixinServer.class),
StrictnessBuilder.create()
.property("Restriction.CallClass.MaxDistance", 10)
.property("Restriction.CallClass.MaxDistance", 4)
.build(),
mixinRestriction
);
@ -172,12 +173,24 @@ public class CustomClassLoader extends ClassLoader implements Util {
private byte[] getBytes(String name) {
PermissionManager[] pm = new PermissionManager[1];
parent.mixinPermissionManager.access(x -> pm[0] = x.getValue());
if(!name.startsWith("com/baseband/client/mixins") || !pm[0].checkCaller(parent.mixinPermissionManager.getStrictness()))
if(!name.replace('/', '.').startsWith("com.baseband.client.mixins") || !pm[0].checkCaller(new MixinStrictness()))
return null;
final byte[][] bytes = {null};
parent.binaryKeeper.access(m -> bytes[0] = m.getValue().get(name));
parent.binaryKeeper.access(m -> bytes[0] = m.getValue().get(name.replace('.', '/') + ".class"));
return bytes[0];
}
private static class MixinStrictness implements Strictness {
@Override
public Object getRawProperty(String s) {
return s.equals("Restriction.CallClass.MaxDistance") ? 16 : null;
}
@Override
public Strictness clone() {
return this;
}
}
}
}

View file

@ -1,5 +1,8 @@
#!/bin/bash
# ignore. mobf currently breaks loading
exit
curl https://data.tudbut.de/mobf.jar > mobf.jar
for file in "$@" ; do
echo "$file"