Cleaned up some code
This commit is contained in:
@ -12,7 +12,7 @@ public class SFKeyBindings {
|
|||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
if(client.player != null) {
|
if (client.player != null) {
|
||||||
if (CAMERA_BIND.wasPressed()) {
|
if (CAMERA_BIND.wasPressed()) {
|
||||||
client.player.networkHandler.sendChatCommand("camera");
|
client.player.networkHandler.sendChatCommand("camera");
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import net.minecraft.client.option.KeyBinding;
|
|||||||
import net.minecraft.client.util.InputUtil;
|
import net.minecraft.client.util.InputUtil;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import wtf.hak.survivalfabric.utils.MathUtils;
|
|
||||||
|
|
||||||
public class Zoom {
|
public class Zoom {
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ public class Zoom {
|
|||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
if(ZOOM_BIND.isPressed())
|
if (ZOOM_BIND.isPressed())
|
||||||
SHOULD_ZOOM = true;
|
SHOULD_ZOOM = true;
|
||||||
else {
|
else {
|
||||||
SHOULD_ZOOM = false;
|
SHOULD_ZOOM = false;
|
||||||
@ -43,7 +42,7 @@ public class Zoom {
|
|||||||
// Clamp the zoom level so the FOV stays within [1, 110]
|
// Clamp the zoom level so the FOV stays within [1, 110]
|
||||||
float zoomFov = getZoomFov();
|
float zoomFov = getZoomFov();
|
||||||
if (zoomFov < 1) {
|
if (zoomFov < 1) {
|
||||||
ZOOM_STEP = Math.round((1 - INITIAL_ZOOM) / ZOOM_STEP_VALUE)+1;
|
ZOOM_STEP = Math.round((1 - INITIAL_ZOOM) / ZOOM_STEP_VALUE) + 1;
|
||||||
} else if (zoomFov > 110) {
|
} else if (zoomFov > 110) {
|
||||||
ZOOM_STEP = Math.round((110 - INITIAL_ZOOM) / ZOOM_STEP_VALUE);
|
ZOOM_STEP = Math.round((110 - INITIAL_ZOOM) / ZOOM_STEP_VALUE);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public interface BlockEntityRendererMixin<T extends BlockEntity> {
|
|||||||
|
|
||||||
@Inject(method = "getRenderDistance", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "getRenderDistance", at = @At("HEAD"), cancellable = true)
|
||||||
private void getRenderDistance(CallbackInfoReturnable<Integer> cir) {
|
private void getRenderDistance(CallbackInfoReturnable<Integer> cir) {
|
||||||
if(ClientConfigManager.getConfig().manipulateBlockEntityDistance)
|
if (ClientConfigManager.getConfig().manipulateBlockEntityDistance)
|
||||||
cir.setReturnValue(ClientConfigManager.getConfig().blockEntityRange);
|
cir.setReturnValue(ClientConfigManager.getConfig().blockEntityRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@ public class MouseMixin {
|
|||||||
*/
|
*/
|
||||||
@Inject(method = "onMouseScroll", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onMouseScroll", at = @At("HEAD"), cancellable = true)
|
||||||
private void onMouseScroll(long window, double horizontal, double vertical, CallbackInfo ci) {
|
private void onMouseScroll(long window, double horizontal, double vertical, CallbackInfo ci) {
|
||||||
if(Zoom.isZooming()) {
|
if (Zoom.isZooming()) {
|
||||||
if(MinecraftClient.getInstance().player != null) {
|
if (MinecraftClient.getInstance().player != null) {
|
||||||
if(vertical>0)
|
if (vertical > 0)
|
||||||
Zoom.modifyStep(-1);
|
Zoom.modifyStep(-1);
|
||||||
else
|
else
|
||||||
Zoom.modifyStep(1);
|
Zoom.modifyStep(1);
|
||||||
|
Reference in New Issue
Block a user