diff --git a/src/main/java/keystrokesmod/mixins/impl/entity/IAccessorEntityPlayerSP.java b/src/main/java/keystrokesmod/mixins/impl/entity/IAccessorEntityPlayerSP.java new file mode 100644 index 0000000..ae43680 --- /dev/null +++ b/src/main/java/keystrokesmod/mixins/impl/entity/IAccessorEntityPlayerSP.java @@ -0,0 +1,24 @@ +package keystrokesmod.mixins.impl.entity; + +import net.minecraftforge.fml.relauncher.*; +import org.spongepowered.asm.mixin.*; +import net.minecraft.client.entity.*; +import org.spongepowered.asm.mixin.gen.*; + +@SideOnly(Side.CLIENT) +@Mixin(EntityPlayerSP.class) +public interface IAccessorEntityPlayerSP { + + @Accessor("lastReportedPosX") + double getLastReportedPosX(); + + @Accessor("lastReportedPosY") + double getLastReportedPosY(); + + @Accessor("lastReportedPosZ") + double getLastReportedPosZ(); + + @Accessor("lastReportedYaw") + float getLastReportedYaw(); + +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java index bc97dee..9931b58 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Scaffold.java +++ b/src/main/java/keystrokesmod/module/impl/player/Scaffold.java @@ -5,6 +5,8 @@ import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.event.ReceivePacketEvent; import keystrokesmod.event.SendPacketEvent; +import keystrokesmod.mixins.impl.entity.IAccessorEntityPlayerSP; +import keystrokesmod.mixins.impl.entity.MixinEntityPlayerSP; import keystrokesmod.mixins.interfaces.IMixinItemRenderer; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; @@ -240,12 +242,8 @@ public class Scaffold extends Module { if (rotation.getInput() == 2) { e.setYaw(offsetRotation()); - if (modifyPitch) { - //e.setPitch(e.getPitch() + 5); - //Utils.print("Modifying pitch"); - } - if (e.getPitch() >= 60 && !ModuleManager.tower.canTower() && mc.thePlayer.motionY <= 0.42F) { - e.setPitch(e.getPitch() + 9); + if (e.getPitch() >= 50 && !ModuleManager.tower.canTower() && mc.thePlayer.motionY <= 0.42F) { + e.setPitch(e.getPitch() + 7); } } @@ -295,62 +293,50 @@ public class Scaffold extends Module { float yawBackwards = MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - hardcodedYaw(); float motionYaw = getMotionYaw(); float main = MathHelper.wrapAngleTo180_float(motionYaw - yaw); - if (blockRotations != null) { - mainOffset = MathHelper.wrapAngleTo180_float(yawBackwards - lastBlockYaw); - lastBlockYaw = MathHelper.wrapAngleTo180_float(blockRotations[0]); + if (blockRotations != null) { + lastBlockYaw = blockRotations[0]; + mainOffset = MathHelper.wrapAngleTo180_float(yawBackwards - lastBlockYaw); + float minOffset = 25; + float minEdge = 15; if (main >= 0) { - if (mainOffset >= 10) { - modifyPitch = true; - } - else modifyPitch = false; //Utils.print("Main1"); - if (mainOffset >= 0) mainOffset = 0; - if (mainOffset <= -30) mainOffset = -30; + if (!Utils.scaffoldDiagonal(false)) { + if (mainOffset >= 0) mainOffset = 0; + if (mainOffset <= -minOffset) mainOffset = -minOffset; + } + else { + if (mainOffset >= 0) mainOffset = 0; + if (mainOffset <= -minEdge) mainOffset = -minEdge; + } } if (main <= -0) { - if (mainOffset <= -10) { - modifyPitch = true; - } - else modifyPitch = false; //Utils.print("Main2"); - if (mainOffset <= -0) mainOffset = -0; - if (mainOffset >= 30) mainOffset = 30; + if (!Utils.scaffoldDiagonal(false)) { + if (mainOffset <= -0) mainOffset = -0; + if (mainOffset >= minOffset) mainOffset = minOffset; + } + else { + if (mainOffset <= -0) mainOffset = -0; + if (mainOffset >= minEdge) mainOffset = minEdge; + } } - - //Utils.print("" + mainOffset); - - //Utils.print("" + difference); } else { - lastBlockYaw = yaw; - if (main >= 0) { - if (mainOffset >= 0) mainOffset = -10; - } - if (main <= -0) { - if (mainOffset <= -0) mainOffset = 10; - } - //Utils.print("No offset"); - difference = 0; + lastBlockYaw = ((IAccessorEntityPlayerSP) mc.thePlayer).getLastReportedYaw(); } - newYaw = motionYaw - (!Utils.scaffoldDiagonal(false) ? 122.625F : 142.625F) * Math.signum( - main + + if (!Utils.isMoving() || Utils.getHorizontalSpeed(mc.thePlayer) == 0.0D) { + return yaw; + } + + float lastYaw = lastBlockYaw; + float newYaw = getMotionYaw() - (!Utils.scaffoldDiagonal(false) ? 124.625F : 142.625F) * Math.signum( + MathHelper.wrapAngleTo180_float(getMotionYaw() - yaw) + ); + yaw = applyGcd( + lastYaw + MathHelper.wrapAngleTo180_float(newYaw - lastYaw) - mainOffset ); - yaw = applyGcd(MathHelper.wrapAngleTo180_float(newYaw) - mainOffset); - - //yaw += 180 = opposite yaw - - /*double min = 25; - if (lastNigger > min) { - yaw += 180; - Utils.print("(Positive) Yaw switched " + lastNigger); - } - else if (lastNigger < -min) { - yaw -= 180; - Utils.print("(Negative) Yaw switched " + lastNigger); - }*/ - - lastNigger = MathHelper.wrapAngleTo180_float(lastBlockYaw - yawBackwards); return yaw; } diff --git a/src/main/resources/mixins.raven.json b/src/main/resources/mixins.raven.json index 3e9a95d..e7d60d5 100644 --- a/src/main/resources/mixins.raven.json +++ b/src/main/resources/mixins.raven.json @@ -22,6 +22,7 @@ "client.MixinWorldInfo", "client.MixinWorld", "render.MixinGuiChat", - "render.MixinGuiScreen" + "render.MixinGuiScreen", + "entity.IAccessorEntityPlayerSP" ] } \ No newline at end of file