瀏覽代碼

fix underwater fov issue, closes #2

TheIllusiveC4 5 年之前
父節點
當前提交
6c1230e5ed
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/main/java/top/theillusivec4/customfov/core/EventHandlerFoV.java

+ 4 - 4
src/main/java/top/theillusivec4/customfov/core/EventHandlerFoV.java

@@ -25,6 +25,7 @@ import net.minecraft.client.Minecraft;
 import net.minecraft.entity.SharedMonsterAttributes;
 import net.minecraft.entity.ai.attributes.IAttributeInstance;
 import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.fluid.IFluidState;
 import net.minecraft.item.Items;
 import net.minecraft.util.math.MathHelper;
 import net.minecraftforge.client.event.EntityViewRenderEvent;
@@ -49,12 +50,11 @@ public class EventHandlerFoV {
 
   @SubscribeEvent(priority = EventPriority.HIGHEST)
   public void onFoVModifier(EntityViewRenderEvent.FOVModifier evt) {
-    BlockState blockstate = evt.getInfo().getBlockAtCamera();
+    IFluidState ifluidstate = evt.getInfo().getFluidState();
 
-    if (blockstate.getMaterial() != Material.WATER) {
+    if (ifluidstate.isEmpty()) {
       return;
     }
-
     float originalModifier = 60.0F / 70.0F;
     double originalFOV = evt.getFOV() / originalModifier;
 
@@ -65,7 +65,7 @@ public class EventHandlerFoV {
 
     evt.setFOV(originalFOV * (1.0F - getConfiguredValue((1.0F - originalModifier),
         FoVConfig.underwaterModifier.get(),
-        FoVConfig.underwaterMin.get(), FoVConfig.underwaterMax.get())));
+        FoVConfig.underwaterMax.get(), FoVConfig.underwaterMin.get())));
   }
 
   private float getNewFovModifier() {