1.16.5forge实现取消视角切换功能,以下写法没有效果,还请各位大佬指点下,没有报错,是不是代码有问题
看着也没错啊……可能枚举类就是有些不一样吧,你不如去改GameSettings类的getCameraType
无敌三脚猫 发表于 2023-9-15 08:33
看着也没错啊……可能枚举类就是有些不一样吧,你不如去改GameSettings类的getCameraType或者setCameraType ...
这样吗,还是没效果,不太会写,是不是哪里配置错了
- @Mixin(GameSettings.class)
 
- public class MixinMinecraft {
 
-     @Inject(method = "getCameraType", at = @At("HEAD"), cancellable = true)
 
-     private void onGetCameraType(CallbackInfoReturnable<GameType> info) {
 
-          info.setReturnValue(GameType.SURVIVAL);
 
-     }
 
- }
WarmRhombus 发表于 2023-9-15 13:20
这样吗,还是没效果,不太会写,是不是哪里配置错了
嗯?获取视角,结果你返回一个生存模式?
怎么着也应该是
-     @Inject(method = "getCameraType", at = @At("HEAD"), cancellable = true)
 
-     private void onGetCameraType(CallbackInfoReturnable<PointOfView> info) {
 
-          info.setReturnValue(PointOfView.FIRST_PERSON);
 
- }
无敌三脚猫 发表于 2023-9-15 13:44
嗯?获取视角,结果你返回一个生存模式?
怎么着也应该是
找到问题了,构建出来就有效果了,内置的客户端测试的时候没效果