Skip to content

Commit

Permalink
Creative Flight changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dueris committed May 22, 2024
1 parent 8d3c9bb commit 30f0ef7
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import me.dueris.calio.data.FactoryData;
import me.dueris.calio.data.factory.FactoryJsonObject;
import me.dueris.genesismc.GenesisMC;
import me.dueris.genesismc.factory.conditions.ConditionExecutor;
import me.dueris.genesismc.factory.powers.genesismc.GravityPower;
import me.dueris.genesismc.factory.powers.holder.PowerType;
import me.dueris.genesismc.util.entity.PowerHolderComponent;
Expand Down Expand Up @@ -32,25 +33,22 @@ public void tickAsync(Player p) {
p.setFlying(true);
}
} else {
if (PowerHolderComponent.hasPowerType(p, CreativeFlight.class) || PowerHolderComponent.isInPhantomForm(p)) {
if (!p.getAllowFlight()) {
p.setAllowFlight(true);
}
if (PowerHolderComponent.hasPowerType(p, CreativeFlight.class)) {
p.setAllowFlight(ConditionExecutor.testEntity(getCondition(), p) || m.equals(GameMode.SPECTATOR) || m.equals(GameMode.CREATIVE));
} else {
boolean a = m.equals(GameMode.SPECTATOR) || m.equals(GameMode.CREATIVE) ||
PowerHolderComponent.hasPowerType(p, ElytraFlightPower.class) || PowerHolderComponent.hasPowerType(p, GravityPower.class) ||
PowerHolderComponent.hasPowerType(p, Grounded.class) || PowerHolderComponent.hasPowerType(p, Swimming.class);
PowerHolderComponent.hasPowerType(p, Grounded.class) || PowerHolderComponent.hasPowerType(p, Swimming.class) || PowerHolderComponent.isInPhantomForm(p);
if (a && !p.getAllowFlight()) {
p.setAllowFlight(true);
} else if (!a && p.getAllowFlight()) {
p.setAllowFlight(false);
}

if (m.equals(GameMode.SPECTATOR)) {
p.setFlying(true);
}
}
}
if (m.equals(GameMode.SPECTATOR)) {
p.setFlying(true);
}
if (p.getChunk().isLoaded()) {
if (Phasing.inPhantomFormBlocks.contains(p)) {
container.set(insideBlock, PersistentDataType.BOOLEAN, true);
Expand Down

0 comments on commit 30f0ef7

Please sign in to comment.