betterer mixins

This commit is contained in:
Jess H 2024-05-24 04:07:26 +01:00
parent 3f18dede05
commit 79dd8a1a30
7 changed files with 49 additions and 11 deletions

View file

@ -5,7 +5,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(CPacketChatMessage.class)
public interface AccessorCPacketChat {
public interface ICPacketChat {
@Accessor("message")
void setMessage(String message);
}

View file

@ -0,0 +1,12 @@
package com.baseband.client.mixins;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Timer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(Minecraft.class)
public interface IMinecraft {
@Accessor("timer")
Timer getTimer();
}

View file

@ -0,0 +1,17 @@
package com.baseband.client.mixins;
import net.minecraft.client.renderer.entity.RenderManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(RenderManager.class)
public interface IRenderManager {
@Accessor("renderPosX")
double getX();
@Accessor("renderPosY")
double getY();
@Accessor("renderPosZ")
double getZ();
}

View file

@ -3,7 +3,7 @@ package com.baseband.client.module.chat;
import com.baseband.client.configuration.annotation.Config;
import com.baseband.client.configuration.annotation.Range;
import com.baseband.client.event.events.PacketEvent;
import com.baseband.client.mixins.AccessorCPacketChat;
import com.baseband.client.mixins.ICPacketChat;
import com.baseband.client.module.Feature;
import com.baseband.client.module.category.Chat;
import com.baseband.client.util.ingame.ChatUtil;
@ -88,7 +88,7 @@ public class ChatCrypt extends Feature {
ChatUtil.print("Encrypted message length was too long, couldn't send!");
e.setCancelled(true);
}
((AccessorCPacketChat)e.getPacket()).setMessage(s);
((ICPacketChat)e.getPacket()).setMessage(s);
}
}

View file

@ -1,5 +1,7 @@
package com.baseband.client.module.render;
import com.baseband.client.mixins.IRenderManager;
import com.baseband.client.mixins.IMinecraft;
import com.baseband.client.module.Feature;
import com.baseband.client.module.category.Render;
import net.minecraft.client.gui.ScaledResolution;
@ -37,12 +39,12 @@ public class Nametags extends Feature {
public void renderWorld(RenderWorldLastEvent e) {
for (EntityPlayer p : mc.world.playerEntities) {
if ((p != mc.getRenderViewEntity()) && (p.isEntityAlive())) {
double pX = p.lastTickPosX + (p.posX - p.lastTickPosX) * mc.timer.renderPartialTicks
- mc.getRenderManager().renderPosX;
double pY = p.lastTickPosY + (p.posY - p.lastTickPosY) * mc.timer.renderPartialTicks
- mc.getRenderManager().renderPosY;
double pZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * mc.timer.renderPartialTicks
- mc.getRenderManager().renderPosZ;
double pX = p.lastTickPosX + (p.posX - p.lastTickPosX) * ((IMinecraft) mc).getTimer().renderPartialTicks
- ((IRenderManager) mc.getRenderManager()).getX();
double pY = p.lastTickPosY + (p.posY - p.lastTickPosY) * ((IMinecraft) mc).getTimer().renderPartialTicks
- ((IRenderManager) mc.getRenderManager()).getY();
double pZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * ((IMinecraft) mc).getTimer().renderPartialTicks
- ((IRenderManager) mc.getRenderManager()).getZ();
if (!p.getName().startsWith("Body #")) {
renderNametag(p, pX, pY, pZ);
}
@ -75,7 +77,7 @@ public class Nametags extends Feature {
GL11.glDisable(2929);
int width = mc.fontRenderer.getStringWidth(name) / 2;
mc.fontRenderer.drawStringWithShadow(name, -width, 11, FriendManager.isFriend(player.getName()) ? ColorModule.getColor().getRGB() : -1);
mc.fontRenderer.drawStringWithShadow(name, -width, 11, -1);
int xOffset = 0;
for (ItemStack armourStack : player.inventory.armorInventory) {

View file

@ -0,0 +1,5 @@
package com.baseband.client.util.ingame;
public class FriendUtil {
}

View file

@ -5,8 +5,10 @@
"minVersion": "0",
"refmap": "mixins.baseband.refmap.json",
"mixins": [
"ICPacketChat",
"IMinecraft",
"IRenderManager",
"MixinNetworkManager",
"AccessorCPacketChat",
"MixinFMLNetworkRegistry",
"MixinEntityPlayerSP",
"MixinGuiNewChat"