use of dev.hypnotic.module.render.Freecam in project Hypnotic-Client by Hypnotic-Development.
the class CameraMixin method onUpdateSetPosArgs.
@ModifyArgs(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setPos(DDD)V"))
private void onUpdateSetPosArgs(Args args) {
Freecam freecam = ModuleManager.INSTANCE.getModule(Freecam.class);
if (freecam.isEnabled()) {
args.set(0, freecam.getX(tickDelta));
args.set(1, freecam.getY(tickDelta));
args.set(2, freecam.getZ(tickDelta));
}
}
use of dev.hypnotic.module.render.Freecam in project Hypnotic-Client by Hypnotic-Development.
the class GameRendererMixin method updateTargetedEntityInvoke.
@Inject(method = "updateTargetedEntity", at = @At("HEAD"), cancellable = true)
private void updateTargetedEntityInvoke(float tickDelta, CallbackInfo info) {
Freecam freecam = ModuleManager.INSTANCE.getModule(Freecam.class);
if ((freecam.isEnabled()) && mc.getCameraEntity() != null && !freecamSet) {
info.cancel();
Entity cameraE = mc.getCameraEntity();
double x = cameraE.getX();
double y = cameraE.getY();
double z = cameraE.getZ();
double prevX = cameraE.prevX;
double prevY = cameraE.prevY;
double prevZ = cameraE.prevZ;
float yaw = cameraE.getYaw();
float pitch = cameraE.getPitch();
float prevYaw = cameraE.prevYaw;
float prevPitch = cameraE.prevPitch;
((IVec3d) cameraE.getPos()).set(freecam.pos.x, freecam.pos.y - cameraE.getEyeHeight(cameraE.getPose()), freecam.pos.z);
cameraE.prevX = freecam.prevPos.x;
cameraE.prevY = freecam.prevPos.y - cameraE.getEyeHeight(cameraE.getPose());
cameraE.prevZ = freecam.prevPos.z;
freecamSet = true;
updateTargetedEntity(tickDelta);
freecamSet = false;
((IVec3d) cameraE.getPos()).set(x, y, z);
cameraE.prevX = prevX;
cameraE.prevY = prevY;
cameraE.prevZ = prevZ;
cameraE.setYaw(yaw);
cameraE.setPitch(pitch);
cameraE.prevYaw = prevYaw;
cameraE.prevPitch = prevPitch;
}
}
Aggregations