add god+noclip command, fix completion list bug

This commit is contained in:
Sen 2025-06-17 14:27:55 +02:00
parent f579eee88b
commit a9770ecea1
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
9 changed files with 115 additions and 32 deletions

View file

@ -4630,4 +4630,36 @@ public abstract class EntityNPC extends EntityLiving
public EntityType getType() {
return EntityType.NPC;
}
public void setGodMode(boolean god) {
this.fallDistance = 0.0F;
if(!god) {
this.removeEffect(Potion.HASTE);
this.removeEffect(Potion.RESISTANCE);
this.removeEffect(Potion.FIRE_RESISTANCE);
this.removeEffect(Potion.FLYING);
this.removeEffect(Potion.MANA_GENERATION);
}
else {
this.extinguish();
this.setHealth(this.getMaxHealth());
this.setManaPoints(this.getMaxMana());
this.clearEffects(false);
this.addEffect(new PotionEffect(Potion.HASTE, Integer.MAX_VALUE, 255, false, false));
this.addEffect(new PotionEffect(Potion.RESISTANCE, Integer.MAX_VALUE, 255, false, false));
this.addEffect(new PotionEffect(Potion.FIRE_RESISTANCE, Integer.MAX_VALUE, 0, false, false));
this.addEffect(new PotionEffect(Potion.FLYING, Integer.MAX_VALUE, 1, false, false));
this.addEffect(new PotionEffect(Potion.MANA_GENERATION, Integer.MAX_VALUE, 255, false, false));
}
}
public void setNoclip(boolean noclip) {
if(noclip)
this.mountEntity(null);
this.noclip = noclip;
this.flying &= this.hasEffect(Potion.FLYING) || this.noclip || this.canNaturallyFly();
this.fallDistance = 0.0F;
if(this.connection != null)
this.connection.sendPlayerAbilities();
}
}