This repository has been archived on 2024-07-25. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Thresholds/src/main/java/dev/zontreck/otemod/configs/PlayerFlyCache.java
2024-01-17 02:25:27 -07:00

28 lines
No EOL
814 B
Java

package dev.zontreck.otemod.configs;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Abilities;
public class PlayerFlyCache
{
public boolean FlyEnabled;
public boolean Flying;
public static PlayerFlyCache cachePlayer(ServerPlayer play){
PlayerFlyCache cache = new PlayerFlyCache();
cache.FlyEnabled = play.getAbilities().mayfly;
cache.Flying = play.getAbilities().flying;
play.onUpdateAbilities();
return cache;
}
public void Assert(ServerPlayer play){
if(play.gameMode.isCreative()) return;
Abilities playerAbilities = play.getAbilities();
playerAbilities.flying=Flying;
playerAbilities.mayfly=FlyEnabled;
play.onUpdateAbilities();
}
}