mirror of
https://github.com/chylex/Better-Controls.git
synced 2025-04-30 05:34:04 +02:00
Unify with Forge codebase
This commit is contained in:
parent
f0214983e5
commit
a875ae2255
@ -14,6 +14,7 @@ dependencies {
|
|||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
mappings minecraft.officialMojangMappings()
|
mappings minecraft.officialMojangMappings()
|
||||||
|
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
@ -20,8 +20,8 @@ import net.minecraft.client.gui.screens.Screen;
|
|||||||
import net.minecraft.network.chat.CommonComponents;
|
import net.minecraft.network.chat.CommonComponents;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -3,7 +3,7 @@ import com.mojang.blaze3d.platform.InputConstants.Type;
|
|||||||
import net.minecraft.client.KeyMapping;
|
import net.minecraft.client.KeyMapping;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class KeyBindingWithModifier extends KeyMapping {
|
public class KeyBindingWithModifier extends KeyMapping {
|
||||||
public static final String CATEGORY = "key.categories.bettercontrols";
|
public static final String CATEGORY = "key.categories.bettercontrols";
|
||||||
|
@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||||||
import org.spongepowered.asm.mixin.injection.Slice;
|
import org.spongepowered.asm.mixin.injection.Slice;
|
||||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||||
|
|
||||||
|
@SuppressWarnings("MethodMayBeStatic")
|
||||||
@Mixin(AbstractClientPlayer.class)
|
@Mixin(AbstractClientPlayer.class)
|
||||||
public abstract class HookClientPlayerFOV {
|
public abstract class HookClientPlayerFOV {
|
||||||
@Redirect(
|
@Redirect(
|
||||||
@ -19,7 +20,7 @@ public abstract class HookClientPlayerFOV {
|
|||||||
to = @At(value = "INVOKE", target = "Ljava/lang/Float;isInfinite(F)Z")
|
to = @At(value = "INVOKE", target = "Ljava/lang/Float;isInfinite(F)Z")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private boolean resetFOV(float movementSpeed) {
|
private boolean resetFOV(final float movementSpeed) {
|
||||||
final LocalPlayer player = MINECRAFT.player;
|
final LocalPlayer player = MINECRAFT.player;
|
||||||
return (player != null && PlayerTicker.get(player).shouldResetFOV(player)) || Float.isNaN(movementSpeed);
|
return (player != null && PlayerTicker.get(player).shouldResetFOV(player)) || Float.isNaN(movementSpeed);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||||
|
|
||||||
|
@SuppressWarnings("MethodMayBeStatic")
|
||||||
@Mixin(value = Minecraft.class, priority = 100)
|
@Mixin(value = Minecraft.class, priority = 100)
|
||||||
public abstract class HookOpenScreen {
|
public abstract class HookOpenScreen {
|
||||||
@Inject(method = "setScreen", at = @At("TAIL"))
|
@Inject(method = "setScreen", at = @At("TAIL"))
|
||||||
|
@ -8,6 +8,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import org.spongepowered.asm.mixin.injection.Slice;
|
import org.spongepowered.asm.mixin.injection.Slice;
|
||||||
|
|
||||||
|
@SuppressWarnings("MethodMayBeStatic")
|
||||||
@Mixin(Player.class)
|
@Mixin(Player.class)
|
||||||
public abstract class HookPlayerFlightSpeed extends LivingEntity {
|
public abstract class HookPlayerFlightSpeed extends LivingEntity {
|
||||||
protected HookPlayerFlightSpeed(final EntityType<? extends LivingEntity> type, final Level world) {
|
protected HookPlayerFlightSpeed(final EntityType<? extends LivingEntity> type, final Level world) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "chylex.bettercontrols.mixin",
|
"package": "chylex.bettercontrols.mixin",
|
||||||
"compatibilityLevel": "JAVA_16",
|
"compatibilityLevel": "JAVA_16",
|
||||||
"mixins": [
|
"client": [
|
||||||
"AccessCameraFields",
|
"AccessCameraFields",
|
||||||
"AccessClientPlayerFields",
|
"AccessClientPlayerFields",
|
||||||
"AccessControlsListCategory",
|
"AccessControlsListCategory",
|
||||||
|
Loading…
Reference in New Issue
Block a user