velocity fixed, again, more mixins.

This commit is contained in:
Jess H 2024-05-24 05:10:14 +01:00
parent 9abc2d7d09
commit 04281bc20f
4 changed files with 34 additions and 5 deletions

View file

@ -0,0 +1,18 @@
package com.baseband.client.mixins;
import net.minecraft.network.play.server.SPacketExplosion;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(SPacketExplosion.class)
public interface ISPacketExplosion {
@Accessor("motionX")
void setMotionX(float x);
@Accessor("motionY")
void setMotionY(float y);
@Accessor("motionZ")
void setMotionZ(float z);
}

View file

@ -1,9 +1,11 @@
package com.baseband.client.module.movement;
import com.baseband.client.event.events.PacketEvent;
import com.baseband.client.mixins.ISPacketExplosion;
import com.baseband.client.module.Feature;
import com.baseband.client.module.category.Movement;
import net.minecraft.network.play.server.SPacketEntityVelocity;
import net.minecraft.network.play.server.SPacketExplosion;
import net.minecraftforge.event.entity.living.LivingKnockBackEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -21,8 +23,16 @@ public class Velocity extends Feature {
}
public void packetRead(PacketEvent.Read event) {
if(event.getPacket() instanceof SPacketEntityVelocity) {
event.setCancelled(true);
if (event.getPacket() instanceof SPacketEntityVelocity) {
SPacketEntityVelocity velocity = (SPacketEntityVelocity) event.getPacket();
if (velocity.getEntityID() == mc.player.getEntityId()) {
event.setCancelled(true);
}
} else if (event.getPacket() instanceof SPacketExplosion) {
ISPacketExplosion isPacketExplosion = ((ISPacketExplosion) event.getPacket());
isPacketExplosion.setMotionX(0);
isPacketExplosion.setMotionY(0);
isPacketExplosion.setMotionZ(0);
}
}
}

View file

@ -39,7 +39,7 @@ 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) * ((IMinecraft) mc).getTimer().renderPartialTicks
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();

View file

@ -5,13 +5,14 @@
"minVersion": "0",
"refmap": "mixins.baseband.refmap.json",
"client": [
"ISPacketExplosion",
"ICPacketChat",
"IMinecraft",
"IRenderManager",
"MixinEntityPlayerSP",
"MixinFMLNetworkRegistry",
"MixinGuiEditSign",
"MixinGuiNewChat",
"MixinNetworkManager",
"MixinGuiEditSign"
"MixinNetworkManager"
]
}