diff options
| author | DoKM <mcazzyman@gmail.com> | 2021-09-02 14:03:14 +0200 |
|---|---|---|
| committer | DoKM <mcazzyman@gmail.com> | 2021-09-02 14:03:14 +0200 |
| commit | 74db72ad590c74b040d0800d411c4e1f1270a09a (patch) | |
| tree | 8ebf9cdf596fae2ec6b149826475d1d84de9ec3a /src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java | |
| parent | 05d6207281e18980b8a28046621c741fa81c1606 (diff) | |
| parent | 8eee6262a6e2c372240331f3c43c2279bd18539e (diff) | |
| download | notenoughupdates-74db72ad590c74b040d0800d411c4e1f1270a09a.tar.gz notenoughupdates-74db72ad590c74b040d0800d411c4e1f1270a09a.tar.bz2 notenoughupdates-74db72ad590c74b040d0800d411c4e1f1270a09a.zip | |
Merge remote-tracking branch 'Moulberry/master'
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java deleted file mode 100644 index 0fd2100c..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FlyFix.java +++ /dev/null @@ -1,74 +0,0 @@ -package io.github.moulberry.notenoughupdates.miscfeatures; - -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.util.SBInfo; -import net.minecraft.client.Minecraft; -import net.minecraft.network.play.client.C13PacketPlayerAbilities; -import net.minecraft.network.play.server.S39PacketPlayerAbilities; - -public class FlyFix { - - private static boolean serverWantFly = false; - private static boolean clientWantFly = false; - private static long lastAbilitySend = 0; - - public static void onSendAbilities(C13PacketPlayerAbilities packet) { - if(true) return; - //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return; - if(Minecraft.getMinecraft().thePlayer == null) return; - if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return; - if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return; - if(SBInfo.getInstance().getLocation() == null) return; - if(!SBInfo.getInstance().getLocation().equals("dynamic")) return; - - long currentTime = System.currentTimeMillis(); - - clientWantFly = packet.isFlying(); - if(clientWantFly != serverWantFly) lastAbilitySend = currentTime; - } - - public static void onReceiveAbilities(S39PacketPlayerAbilities packet) { - if(true) return; - //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return; - if(Minecraft.getMinecraft().thePlayer == null) return; - if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return; - if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return; - if(SBInfo.getInstance().getLocation() == null) return; - if(!SBInfo.getInstance().getLocation().equals("dynamic")) return; - - long currentTime = System.currentTimeMillis(); - - serverWantFly = packet.isFlying(); - - if(serverWantFly != clientWantFly) { - if(currentTime - lastAbilitySend > 0 && currentTime - lastAbilitySend < 500) { - packet.setFlying(clientWantFly); - } else { - clientWantFly = serverWantFly; - } - } - } - - public static void tick() { - if(true) return; - //if(!NotEnoughUpdates.INSTANCE.config.misc.flyFix) return; - if(Minecraft.getMinecraft().thePlayer == null) return; - if(!Minecraft.getMinecraft().thePlayer.capabilities.allowFlying) return; - if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return; - if(SBInfo.getInstance().getLocation() == null) return; - if(!SBInfo.getInstance().getLocation().equals("dynamic")) return; - - long currentTime = System.currentTimeMillis(); - - if(currentTime - lastAbilitySend > 1000 && currentTime - lastAbilitySend < 5000) { - if(clientWantFly != serverWantFly) { - Minecraft.getMinecraft().thePlayer.capabilities.isFlying = serverWantFly; - Minecraft.getMinecraft().thePlayer.sendPlayerAbilities(); - clientWantFly = serverWantFly; - } - } else { - clientWantFly = Minecraft.getMinecraft().thePlayer.capabilities.isFlying; - } - } - -} |
