New Modules and update to 1.19.3 (#186)

This commit is contained in:
SodaXwX
2022-12-23 21:45:57 +08:00
committed by GitHub
parent 64933773a7
commit 3c14b3bc8f
33 changed files with 663 additions and 454 deletions

View File

@@ -0,0 +1,18 @@
package anticope.rejects.mixin;
import anticope.rejects.events.StopUsingItemEvent;
import meteordevelopment.meteorclient.MeteorClient;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.entity.player.PlayerEntity;
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(ClientPlayerInteractionManager.class)
public class ClientPlayerInteractionManagerMixin {
@Inject(at = @At("HEAD"), method = "stopUsingItem")
public void onStopUsingItem(PlayerEntity player, CallbackInfo ci) {
MeteorClient.EVENT_BUS.post(StopUsingItemEvent.get(player.getInventory().getMainHandStack()));
}
}

View File

@@ -3,26 +3,26 @@ package anticope.rejects.mixin;
import anticope.rejects.modules.Rendering;
import meteordevelopment.meteorclient.systems.modules.Modules;
import net.minecraft.client.gl.PostEffectProcessor;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.*;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.ShaderEffect;
import net.minecraft.client.render.GameRenderer;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(GameRenderer.class)
public class GameRendererMixin {
@Shadow @Final private MinecraftClient client;
@Shadow @Final MinecraftClient client;
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;drawEntityOutlinesFramebuffer()V", ordinal = 0))
private void renderShader(float tickDelta, long startTime, boolean tick, CallbackInfo ci) {
Rendering renderingModule = Modules.get().get(Rendering.class);
if (renderingModule == null) return;
ShaderEffect shader = renderingModule.getShaderEffect();
PostEffectProcessor shader = renderingModule.getShaderEffect();
if (shader != null) {
shader.setupDimensions(client.getWindow().getFramebufferWidth(), client.getWindow().getFramebufferHeight());

View File

@@ -6,9 +6,9 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.RotationAxis;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -24,7 +24,7 @@ public class LivingEntityRendererMixin {
if (renderingModule == null) return;
if ((!(entity instanceof PlayerEntity)) && renderingModule.dinnerboneEnabled()) {
matrices.translate(0.0D, entity.getHeight() + 0.1F, 0.0D);
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(180.0F));
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180.0F));
}
}

View File

@@ -19,8 +19,9 @@ public abstract class MultiplayerScreenMixin extends Screen {
@Inject(method = "init", at = @At("TAIL"))
private void onInit(CallbackInfo info) {
addDrawableChild(new ButtonWidget(this.width - 75 - 3 - 75 - 2 - 75 - 2, 3, 75, 20, Text.literal("Servers"), button -> {
client.setScreen(new ServerManagerScreen(GuiThemes.get(), (MultiplayerScreen) (Object) this));
}));
addDrawableChild(new ButtonWidget.Builder(Text.literal("Servers"), button -> client.setScreen(new ServerManagerScreen(GuiThemes.get(), (MultiplayerScreen) (Object) this)))
.size(75, 20)
.position(this.width - 75 - 3 - 75 - 2 - 75 - 2, 3)
.build());
}
}

View File

@@ -1,49 +0,0 @@
package anticope.rejects.mixin.meteor;
import anticope.rejects.commands.LocateCommand;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import meteordevelopment.meteorclient.systems.commands.Command;
import meteordevelopment.meteorclient.systems.commands.Commands;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.command.CommandSource;
import java.util.List;
import java.util.Map;
@Mixin(Commands.class)
public class CommandsMixin {
@Shadow(remap = false)
@Final
private List<Command> commands;
@Shadow(remap = false)
@Final
private Map<Class<? extends Command>, Command> commandInstances;
@Shadow(remap = false)
@Final
private CommandDispatcher<CommandSource> DISPATCHER;
@Inject(method = "add", at=@At("HEAD"), remap = false, cancellable = true)
private void onAdd(Command cmd, CallbackInfo ci) {
if (cmd instanceof meteordevelopment.meteorclient.systems.commands.commands.LocateCommand) {
Command command = new LocateCommand();
commands.removeIf(command1 -> command1.getName().equals(command.getName()));
commandInstances.values().removeIf(command1 -> command1.getName().equals(command.getName()));
command.registerTo(DISPATCHER);
commands.add(command);
commandInstances.put(command.getClass(), command);
ci.cancel();
}
}
}

View File

@@ -0,0 +1,22 @@
package anticope.rejects.mixin.meteor;
import anticope.rejects.settings.RejectsSettings;
import meteordevelopment.meteorclient.gui.DefaultSettingsWidgetFactory;
import meteordevelopment.meteorclient.gui.GuiTheme;
import meteordevelopment.meteorclient.gui.utils.SettingsWidgetFactory;
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(DefaultSettingsWidgetFactory.class)
public abstract class DefaultSettingsWidgetFactoryMixin extends SettingsWidgetFactory {
public DefaultSettingsWidgetFactoryMixin(GuiTheme theme) {
super(theme);
}
@Inject(method = "<init>", at = @At("TAIL"), remap = false)
private void onInit(GuiTheme theme, CallbackInfo ci) {
new RejectsSettings(factories, this.theme).addSettings();
}
}

View File

@@ -14,9 +14,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Module.class)
public class ModuleMixin {
@Mutable @Shadow public String name;
@Mutable @Shadow(remap = false) public String name;
@Mutable @Shadow public String title;
@Mutable @Shadow(remap = false) public String title;
@Inject(method = "<init>", at = @At("TAIL"), remap = false)
private void onInit(Category category, String name, String description, CallbackInfo info) {