mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Try fix controllable / sit trait issues
This commit is contained in:
parent
61fd34df0b
commit
63f1013d46
@ -25,7 +25,6 @@ public class StoredShops {
|
||||
public void deleteShop(NPCShop shop) {
|
||||
if (Messaging.isDebugging()) {
|
||||
Messaging.debug("Deleting shop", shop.getName());
|
||||
new Exception().printStackTrace();
|
||||
}
|
||||
if (npcShops.values().contains(shop)) {
|
||||
npcShops.values().remove(shop);
|
||||
|
@ -328,8 +328,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
skinnable.getSkinTracker().onSpawnNPC();
|
||||
}
|
||||
|
||||
teleport(at, TeleportCause.PLUGIN);
|
||||
|
||||
NMS.setLocationDirectly(getEntity(), at);
|
||||
NMS.setHeadYaw(getEntity(), at.getYaw());
|
||||
NMS.setBodyYaw(getEntity(), at.getYaw());
|
||||
|
||||
|
@ -122,12 +122,12 @@ public class ArmorStandTrait extends Trait {
|
||||
}
|
||||
|
||||
public void setAsHelperEntity(NPC parent) {
|
||||
npc.addTrait(new ClickRedirectTrait(npc));
|
||||
npc.addTrait(new ClickRedirectTrait(parent));
|
||||
setAsPointEntity();
|
||||
}
|
||||
|
||||
public void setAsHelperEntityWithName(NPC parent) {
|
||||
npc.addTrait(new ClickRedirectTrait(npc));
|
||||
npc.addTrait(new ClickRedirectTrait(parent));
|
||||
setAsPointEntityWithName();
|
||||
}
|
||||
|
||||
|
@ -272,6 +272,8 @@ public class Controllable extends Trait implements Toggleable, CommandConfigurab
|
||||
Vector vel = handle.getVelocity();
|
||||
double oldSpeed = Math.sqrt(vel.getX() * vel.getX() + vel.getZ() * vel.getZ());
|
||||
double horizontal = NMS.getHorizontalMovement(passenger);
|
||||
if (Math.abs(Math.abs(horizontal) - 0.98) > 0.02)
|
||||
return speed;
|
||||
double yaw = passenger.getLocation().getYaw();
|
||||
if (horizontal > 0.0D) {
|
||||
double dXcos = -Math.sin(yaw * Math.PI / 180.0F);
|
||||
|
@ -55,7 +55,7 @@ public class SitTrait extends Trait {
|
||||
}
|
||||
chair = registry.createNPC(EntityType.ARMOR_STAND, "");
|
||||
chair.getOrAddTrait(ArmorStandTrait.class).setAsHelperEntity(npc);
|
||||
if (!chair.spawn(sittingAt)) {
|
||||
if (!chair.spawn(sittingAt.clone())) {
|
||||
chair = null;
|
||||
return;
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class SitTrait extends Trait {
|
||||
}
|
||||
|
||||
if (chair.getStoredLocation() != null && chair.getStoredLocation().distance(sittingAt) > 0.05) {
|
||||
chair.teleport(sittingAt, TeleportCause.PLUGIN);
|
||||
chair.teleport(sittingAt.clone(), TeleportCause.PLUGIN);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user