mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-29 06:05:17 +01:00
Set step height attribute on spawn centrally instead of locally
This commit is contained in:
parent
e78499f6ca
commit
59534df8c0
@ -9,6 +9,7 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -46,6 +47,7 @@ import net.citizensnpcs.api.util.DataKey;
|
|||||||
import net.citizensnpcs.api.util.Messaging;
|
import net.citizensnpcs.api.util.Messaging;
|
||||||
import net.citizensnpcs.npc.ai.CitizensNavigator;
|
import net.citizensnpcs.npc.ai.CitizensNavigator;
|
||||||
import net.citizensnpcs.npc.skin.SkinnableEntity;
|
import net.citizensnpcs.npc.skin.SkinnableEntity;
|
||||||
|
import net.citizensnpcs.trait.AttributeTrait;
|
||||||
import net.citizensnpcs.trait.CurrentLocation;
|
import net.citizensnpcs.trait.CurrentLocation;
|
||||||
import net.citizensnpcs.trait.Gravity;
|
import net.citizensnpcs.trait.Gravity;
|
||||||
import net.citizensnpcs.trait.HologramTrait;
|
import net.citizensnpcs.trait.HologramTrait;
|
||||||
@ -390,7 +392,9 @@ public class CitizensNPC extends AbstractNPC {
|
|||||||
LivingEntity entity = (LivingEntity) getEntity();
|
LivingEntity entity = (LivingEntity) getEntity();
|
||||||
entity.setRemoveWhenFarAway(false);
|
entity.setRemoveWhenFarAway(false);
|
||||||
|
|
||||||
if (NMS.getStepHeight(entity) < 1) {
|
if ((!hasTrait(AttributeTrait.class)
|
||||||
|
|| !getTrait(AttributeTrait.class).hasAttribute(Attribute.GENERIC_STEP_HEIGHT))
|
||||||
|
&& (type == EntityType.PLAYER || Util.isHorse(type))) {
|
||||||
NMS.setStepHeight(entity, 1);
|
NMS.setStepHeight(entity, 1);
|
||||||
}
|
}
|
||||||
if (type == EntityType.PLAYER) {
|
if (type == EntityType.PLAYER) {
|
||||||
|
@ -241,7 +241,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||||||
controllerMove = new PlayerControllerMove(this);
|
controllerMove = new PlayerControllerMove(this);
|
||||||
navigation = new PlayerNavigation(this, world);
|
navigation = new PlayerNavigation(this, world);
|
||||||
invulnerableTicks = 0;
|
invulnerableTicks = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing setSkinFlags((byte) 0xFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -218,7 +218,6 @@ public class HorseController extends MobEntityController {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1);
|
|
||||||
npc.update();
|
npc.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||||||
controllerMove = new PlayerControllerMove(this);
|
controllerMove = new PlayerControllerMove(this);
|
||||||
navigation = new PlayerNavigation(this, world);
|
navigation = new PlayerNavigation(this, world);
|
||||||
invulnerableTicks = 0;
|
invulnerableTicks = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing setSkinFlags((byte) 0xFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -278,7 +278,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||||||
controllerMove = new PlayerControllerMove(this);
|
controllerMove = new PlayerControllerMove(this);
|
||||||
navigation = new PlayerNavigation(this, world);
|
navigation = new PlayerNavigation(this, world);
|
||||||
invulnerableTicks = 0;
|
invulnerableTicks = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||||||
controllerMove = new PlayerControllerMove(this);
|
controllerMove = new PlayerControllerMove(this);
|
||||||
navigation = new PlayerNavigation(this, world);
|
navigation = new PlayerNavigation(this, world);
|
||||||
invulnerableTicks = 0;
|
invulnerableTicks = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||||||
controllerMove = new PlayerControllerMove(this);
|
controllerMove = new PlayerControllerMove(this);
|
||||||
navigation = new PlayerNavigation(this, world);
|
navigation = new PlayerNavigation(this, world);
|
||||||
invulnerableTicks = 0;
|
invulnerableTicks = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||||||
controllerMove = new PlayerControllerMove(this);
|
controllerMove = new PlayerControllerMove(this);
|
||||||
navigation = new PlayerNavigation(this, world);
|
navigation = new PlayerNavigation(this, world);
|
||||||
invulnerableTicks = 0;
|
invulnerableTicks = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
invulnerableTicks = 0;
|
invulnerableTicks = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,6 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||||||
// swallow
|
// swallow
|
||||||
}
|
}
|
||||||
this.invulnerableTime = 0;
|
this.invulnerableTime = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,6 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
this.invulnerableTime = 0;
|
this.invulnerableTime = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,6 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
this.invulnerableTime = 0;
|
this.invulnerableTime = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,6 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.invulnerableTime = 0;
|
this.invulnerableTime = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,6 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.invulnerableTime = 0;
|
this.invulnerableTime = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing
|
|
||||||
setSkinFlags((byte) 0xFF);
|
setSkinFlags((byte) 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
|||||||
controllerMove = new PlayerControllerMove(this);
|
controllerMove = new PlayerControllerMove(this);
|
||||||
navigation = new PlayerNavigation(this, world);
|
navigation = new PlayerNavigation(this, world);
|
||||||
invulnerableTicks = 0;
|
invulnerableTicks = 0;
|
||||||
NMS.setStepHeight(getBukkitEntity(), 1); // the default (0) breaks step climbing setSkinFlags((byte) 0xFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNavigating() {
|
public boolean isNavigating() {
|
||||||
|
Loading…
Reference in New Issue
Block a user