Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 7 Фев 2024
- Сообщения
- 109
- Реакции
- 0
- Выберите загрузчик игры
- Vanilla
ss-
Адекватный FreeLook, нельзя бить спиной и т.п. Короч как в лунарчике/лесбик моде
Адекватный FreeLook, нельзя бить спиной и т.п. Короч как в лунарчике/лесбик моде
FreeLook:
package Fever.Visual.functions.impl.misc;
import Fever.Visual.events.EventMotion;
import Fever.Visual.events.EventUpdate;
import Fever.Visual.functions.api.Category;
import Fever.Visual.functions.api.Function;
import Fever.Visual.functions.api.FunctionRegister;
import Fever.Visual.functions.settings.impl.BooleanSetting;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.settings.PointOfView;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.MathHelper;
@FunctionRegister(name = "FreeLook", type = Category.Misc)
public class FreeLook extends Function {
public BooleanSetting free = new BooleanSetting("Свободная камера", true);
public static boolean isActive = false;
public static float x = 0;
public static float y = 0;
public static float prevX = 0;
public static float prevY = 0;
private float startYaw, startPitch;
public FreeLook(){
addSettings();
}
@Override
public boolean onEnable(){
if (mc.player != null && isFree()) {
startYaw = mc.player.rotationYaw;
startPitch = mc.player.rotationPitch;
isActive = true;
x = startYaw;
y = startPitch;
prevX = x;
prevY = y;
}
super.onEnable();
return false;
}
@Override
public void onDisable(){
if (mc.player != null && isFree()) {
mc.player.rotationYawOffset = Integer.MIN_VALUE;
mc.gameSettings.setPointOfView(PointOfView.FIRST_PERSON);
mc.player.rotationYaw = startYaw;
mc.player.rotationPitch = startPitch;
isActive = false;
}
super.onDisable();
}
@Subscribe
public void onUpdate(EventUpdate e) {
if (mc.player != null && free.get()) {
mc.gameSettings.setPointOfView(PointOfView.THIRD_PERSON_BACK);
mc.player.rotationYawOffset = startYaw;
}
}
@Subscribe
public void onMotion(EventMotion e){
if (mc.player != null && free.get()) {
e.setYaw(startYaw);
e.setPitch(startPitch);
e.setOnGround(mc.player.isOnGround());
mc.player.rotationYawHead = mc.player.rotationYawOffset;
mc.player.renderYawOffset = mc.player.rotationYawOffset;
mc.player.rotationPitchHead = startPitch;
}
}
public boolean isFree(){
return free.get();
}
public static float getYaw(float partialTicks) {
return partialTicks == 1.0F ? x : prevX + (x - prevX) * partialTicks;
}
public static float getPitch(float partialTicks) {
return partialTicks == 1.0F ? y : prevY + (y - prevY) * partialTicks;
}
public static float getActualYaw(float partialTicks) {
return isActive ? getYaw(partialTicks) : (mc.player != null ? mc.player.getYaw(partialTicks) : 0);
}
public static float getActualPitch(float partialTicks) {
return isActive ? getPitch(partialTicks) : (mc.player != null ? mc.player.getPitch(partialTicks) : 0);
}
public static Vector3d getActualLookVector(float partialTicks) {
if (!isActive && mc.player != null) {
return mc.player.getLook(partialTicks);
}
if (!isActive) {
return Vector3d.ZERO;
}
float yaw = getYaw(partialTicks);
float pitch = getPitch(partialTicks);
float f = pitch * ((float) Math.PI / 180F);
float f1 = -yaw * ((float) Math.PI / 180F);
float f2 = MathHelper.cos(f1);
float f3 = MathHelper.sin(f1);
float f4 = MathHelper.cos(f);
float f5 = MathHelper.sin(f);
return new Vector3d((double) (f3 * f4), (double) (-f5), (double) (f2 * f4));
}
public static Vector3d getInteractionDirection(float partialTicks) {
return getActualLookVector(partialTicks);
}
}
ActiveRenderInfo (До getPitch и Yaw):
public float getYaw(float partialTicks) {
return FreeLook.isActive ? FreeLook.getActualYaw(partialTicks) : this.renderViewEntity.getYaw(partialTicks);
}
public float getPitch(float partialTicks) {
return FreeLook.isActive ? FreeLook.getActualPitch(partialTicks) : this.renderViewEntity.getPitch(partialTicks);
}
Entity (замените rotateTowards:
public void rotateTowards(double var1, double var3) {
double var5 = var3 * 0.15;
double var7 = var1 * 0.15;
this.prevRotationYaw = (float)((double)this.prevRotationYaw + var7);
this.prevRotationPitch = (float)MathHelper.clamp((double)this.prevRotationPitch + var5, (double)-90.0F, (double)90.0F);
if (FreeLook.isActive && mc.currentScreen != null) {
FreeLook.x = (float)((double)FreeLook.x + var7);
FreeLook.y = (float)MathHelper.clamp((double)FreeLook.y + var5, (double)-90.0F, (double)90.0F);
FreeLook.prevX = (float)((double)FreeLook.prevX + var7);
FreeLook.prevY = (float)MathHelper.clamp((double)FreeLook.prevY + var5, (double)-90.0F, (double)90.0F);
} else {
this.rotationPitch = (float)((double)this.rotationPitch + var5);
this.rotationYaw = (float)((double)this.rotationYaw + var7);
this.rotationPitch = MathHelper.clamp(this.rotationPitch, -90.0F, 90.0F);
this.prevRotationPitch = (float)((double)this.prevRotationPitch + var5);
this.prevRotationYaw = (float)((double)this.prevRotationYaw + var7);
this.prevRotationPitch = MathHelper.clamp(this.prevRotationPitch, -90.0F, 90.0F);
}
if (this.ridingEntity != null) {
this.ridingEntity.applyOrientationToEntity(this);
}
}
LivingEntity:
@Override
public float getPitch(float partialTicks) {
if (FreeLook.isActive) {
return FreeLook.getActualPitch(partialTicks);
}
return super.getPitch(partialTicks);
}
@Override
public Vector3d getLook(float partialTicks) {
if (FreeLook.isActive) {
return FreeLook.getActualLookVector(partialTicks);
}
return super.getLook(partialTicks);
}
