mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Fix /npc pickupitems message and for players, null casing for /npc panimate START_SLEEPING
This commit is contained in:
parent
73689cf9c2
commit
35245a580b
@ -1769,7 +1769,7 @@ public class NPCCommands {
|
||||
throws CommandException {
|
||||
boolean pickup = set == null ? !npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected()) : set;
|
||||
npc.data().set(NPC.Metadata.PICKUP_ITEMS, pickup);
|
||||
Messaging.send(sender, pickup ? Messages.PICKUP_ITEMS_SET : Messages.PICKUP_ITEMS_UNSET, npc.getName());
|
||||
Messaging.sendTr(sender, pickup ? Messages.PICKUP_ITEMS_SET : Messages.PICKUP_ITEMS_UNSET, npc.getName());
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -29,6 +29,7 @@ public class SleepTrait extends Trait {
|
||||
return;
|
||||
} else if (sleeping && at == null) {
|
||||
stopSleeping();
|
||||
return;
|
||||
}
|
||||
if (npc.getEntity() instanceof Player) {
|
||||
Player player = (Player) npc.getEntity();
|
||||
|
@ -39,8 +39,10 @@ import net.citizensnpcs.trait.SkinTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_10_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_10_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_10_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_10_R1.DamageSource;
|
||||
import net.minecraft.server.v1_10_R1.Entity;
|
||||
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_10_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_10_R1.EnumGamemode;
|
||||
@ -311,6 +313,21 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
cs();
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AxisAlignedBB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().dead) {
|
||||
axisalignedbb = this.getBoundingBox().a(this.getVehicle().getBoundingBox()).grow(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().grow(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.world.getEntities(this, axisalignedbb)) {
|
||||
if (!entity.dead) {
|
||||
entity.d(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,9 +39,11 @@ import net.citizensnpcs.trait.SkinTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_11_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_11_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_11_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_11_R1.ChatComponentText;
|
||||
import net.minecraft.server.v1_11_R1.DamageSource;
|
||||
import net.minecraft.server.v1_11_R1.Entity;
|
||||
import net.minecraft.server.v1_11_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_11_R1.EnumGamemode;
|
||||
@ -375,6 +377,21 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
ct();
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AxisAlignedBB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().dead) {
|
||||
axisalignedbb = this.getBoundingBox().b(this.getVehicle().getBoundingBox()).grow(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().grow(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.world.getEntities(this, axisalignedbb)) {
|
||||
if (!entity.dead) {
|
||||
entity.d(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMoveDestination(double x, double y, double z, double speed) {
|
||||
|
@ -42,10 +42,12 @@ import net.citizensnpcs.trait.SkinTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_12_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_12_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_12_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_12_R1.ChatComponentText;
|
||||
import net.minecraft.server.v1_12_R1.DamageSource;
|
||||
import net.minecraft.server.v1_12_R1.DataWatcher;
|
||||
import net.minecraft.server.v1_12_R1.Entity;
|
||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_12_R1.EnumGamemode;
|
||||
@ -401,6 +403,21 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
cB();
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AxisAlignedBB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().dead) {
|
||||
axisalignedbb = this.getBoundingBox().b(this.getVehicle().getBoundingBox()).grow(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().grow(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.world.getEntities(this, axisalignedbb)) {
|
||||
if (!entity.dead) {
|
||||
entity.d(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMoveDestination(double x, double y, double z, double speed) {
|
||||
|
@ -42,10 +42,12 @@ import net.citizensnpcs.trait.SkinTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_13_R2.AttributeInstance;
|
||||
import net.minecraft.server.v1_13_R2.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_13_R2.BlockPosition;
|
||||
import net.minecraft.server.v1_13_R2.ChatComponentText;
|
||||
import net.minecraft.server.v1_13_R2.DamageSource;
|
||||
import net.minecraft.server.v1_13_R2.DataWatcher;
|
||||
import net.minecraft.server.v1_13_R2.Entity;
|
||||
import net.minecraft.server.v1_13_R2.EntityHuman;
|
||||
import net.minecraft.server.v1_13_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_13_R2.EnumGamemode;
|
||||
@ -376,6 +378,21 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
cN();
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AxisAlignedBB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().dead) {
|
||||
axisalignedbb = this.getBoundingBox().b(this.getVehicle().getBoundingBox()).grow(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().grow(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.world.getEntities(this, axisalignedbb)) {
|
||||
if (!entity.dead) {
|
||||
entity.d(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMoveDestination(double x, double y, double z, double speed) {
|
||||
|
@ -41,9 +41,11 @@ import net.citizensnpcs.trait.SkinTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_14_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_14_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_14_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_14_R1.ChatComponentText;
|
||||
import net.minecraft.server.v1_14_R1.DamageSource;
|
||||
import net.minecraft.server.v1_14_R1.Entity;
|
||||
import net.minecraft.server.v1_14_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_14_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_14_R1.EnumGamemode;
|
||||
@ -381,6 +383,21 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
collideNearby();
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AxisAlignedBB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().dead) {
|
||||
axisalignedbb = this.getBoundingBox().b(this.getVehicle().getBoundingBox()).grow(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().grow(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.world.getEntities(this, axisalignedbb)) {
|
||||
if (!entity.dead) {
|
||||
entity.pickup(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setMoveDestination(double x, double y, double z, double speed) {
|
||||
|
@ -41,9 +41,11 @@ import net.citizensnpcs.trait.SkinTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_15_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_15_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_15_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_15_R1.ChatComponentText;
|
||||
import net.minecraft.server.v1_15_R1.DamageSource;
|
||||
import net.minecraft.server.v1_15_R1.Entity;
|
||||
import net.minecraft.server.v1_15_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_15_R1.EnumGamemode;
|
||||
@ -431,6 +433,21 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
updatePackets(navigating);
|
||||
|
||||
npc.update();
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AxisAlignedBB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().dead) {
|
||||
axisalignedbb = this.getBoundingBox().b(this.getVehicle().getBoundingBox()).grow(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().grow(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.world.getEntities(this, axisalignedbb)) {
|
||||
if (!entity.dead) {
|
||||
entity.pickup(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
double diff = this.yaw - this.aK;
|
||||
if (diff != 40 && diff != -40) {
|
||||
|
@ -49,9 +49,11 @@ import net.minecraft.server.v1_16_R3.AttributeBase;
|
||||
import net.minecraft.server.v1_16_R3.AttributeMapBase;
|
||||
import net.minecraft.server.v1_16_R3.AttributeModifiable;
|
||||
import net.minecraft.server.v1_16_R3.AttributeProvider;
|
||||
import net.minecraft.server.v1_16_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_16_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_16_R3.ChatComponentText;
|
||||
import net.minecraft.server.v1_16_R3.DamageSource;
|
||||
import net.minecraft.server.v1_16_R3.Entity;
|
||||
import net.minecraft.server.v1_16_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_16_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_16_R3.EnumGamemode;
|
||||
@ -461,6 +463,21 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
updatePackets(navigating);
|
||||
|
||||
npc.update();
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AxisAlignedBB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().dead) {
|
||||
axisalignedbb = this.getBoundingBox().b(this.getVehicle().getBoundingBox()).grow(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().grow(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.world.getEntities(this, axisalignedbb)) {
|
||||
if (!entity.dead) {
|
||||
entity.pickup(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
double diff = this.yaw - this.aK;
|
||||
if (diff != 40 && diff != -40) {
|
||||
|
@ -71,6 +71,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.pathfinder.BlockPathTypes;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class EntityHumanNPC extends ServerPlayer implements NPCHolder, SkinnableEntity {
|
||||
@ -198,6 +199,19 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
pushEntities();
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AABB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().isRemoved()) {
|
||||
axisalignedbb = this.getBoundingBox().minmax(this.getVehicle().getBoundingBox()).inflate(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().inflate(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.level.getEntities(this, axisalignedbb)) {
|
||||
entity.playerTouch(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,6 +72,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.pathfinder.BlockPathTypes;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class EntityHumanNPC extends ServerPlayer implements NPCHolder, SkinnableEntity {
|
||||
@ -199,6 +200,19 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
pushEntities();
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AABB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().isRemoved()) {
|
||||
axisalignedbb = this.getBoundingBox().minmax(this.getVehicle().getBoundingBox()).inflate(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().inflate(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.level.getEntities(this, axisalignedbb)) {
|
||||
entity.playerTouch(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,6 +74,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.GameType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.pathfinder.BlockPathTypes;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class EntityHumanNPC extends ServerPlayer implements NPCHolder, SkinnableEntity {
|
||||
@ -172,6 +173,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
super.doTick();
|
||||
return;
|
||||
}
|
||||
|
||||
super.baseTick();
|
||||
boolean navigating = npc.getNavigator().isNavigating() || controllerMove.hasWanted();
|
||||
if (!navigating && getBukkitEntity() != null
|
||||
@ -192,6 +194,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
}
|
||||
moveOnCurrentHeading();
|
||||
}
|
||||
|
||||
NMSImpl.updateAI(this);
|
||||
|
||||
if (isSpectator()) {
|
||||
@ -202,6 +205,19 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
pushEntities();
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AABB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().isRemoved()) {
|
||||
axisalignedbb = this.getBoundingBox().minmax(this.getVehicle().getBoundingBox()).inflate(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().inflate(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.level.getEntities(this, axisalignedbb)) {
|
||||
entity.playerTouch(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -468,7 +484,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
||||
super.tick();
|
||||
if (npc == null)
|
||||
return;
|
||||
noPhysics = isSpectator();
|
||||
|
||||
if (updateCounter + 1 > Setting.PACKET_UPDATE_DELAY.asInt()) {
|
||||
effectsDirty = true;
|
||||
}
|
||||
|
@ -39,10 +39,12 @@ import net.citizensnpcs.trait.SkinTrait;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.minecraft.server.v1_8_R3.AttributeInstance;
|
||||
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_8_R3.Block;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.DamageSource;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_8_R3.Entity;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.EnumProtocolDirection;
|
||||
import net.minecraft.server.v1_8_R3.GenericAttributes;
|
||||
@ -312,6 +314,21 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
|
||||
bL();
|
||||
}
|
||||
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, !npc.isProtected())) {
|
||||
AxisAlignedBB axisalignedbb = null;
|
||||
if (this.vehicle != null && !this.vehicle.dead) {
|
||||
axisalignedbb = this.getBoundingBox().a(this.vehicle.getBoundingBox()).grow(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().grow(1.0, 0.5, 1.0);
|
||||
}
|
||||
|
||||
for (Entity entity : this.world.getEntities(this, axisalignedbb)) {
|
||||
if (!entity.dead) {
|
||||
entity.d(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void moveOnCurrentHeading() {
|
||||
|
Loading…
Reference in New Issue
Block a user