Compare commits
2 Commits
d3c0205d9e
...
1b32596c37
Author | SHA1 | Date |
---|---|---|
fullwall | 1b32596c37 | |
fullwall | edb4f78ceb |
|
@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
|||
import net.citizensnpcs.api.gui.InputMenus;
|
||||
import net.citizensnpcs.api.gui.InventoryMenuPage;
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.util.InventoryMultiplexer;
|
||||
import net.citizensnpcs.util.Util;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
@ -18,6 +19,8 @@ import net.milkbowl.vault.economy.Economy;
|
|||
public class MoneyAction extends NPCShopAction {
|
||||
@Persist
|
||||
public double money;
|
||||
@Persist
|
||||
private String formattedMoney;
|
||||
|
||||
public MoneyAction() {
|
||||
}
|
||||
|
@ -29,7 +32,11 @@ public class MoneyAction extends NPCShopAction {
|
|||
@Override
|
||||
public String describe() {
|
||||
Economy economy = Bukkit.getServicesManager().getRegistration(Economy.class).getProvider();
|
||||
return money + " " + economy.currencyNamePlural();
|
||||
return getFormattedMoney() + " " + economy.currencyNamePlural();
|
||||
}
|
||||
|
||||
private String getFormattedMoney() {
|
||||
return formattedMoney == null || formattedMoney.isEmpty() ? Double.toString(money) : formattedMoney;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -81,11 +88,12 @@ public class MoneyAction extends NPCShopAction {
|
|||
MoneyAction action = previous == null ? new MoneyAction() : (MoneyAction) previous;
|
||||
return InputMenus.filteredStringSetter(() -> Double.toString(action.money), s -> {
|
||||
try {
|
||||
double result = Double.parseDouble(s);
|
||||
double result = Double.parseDouble(Messaging.stripColor(s));
|
||||
if (result < 0)
|
||||
return false;
|
||||
|
||||
action.money = result;
|
||||
action.formattedMoney = !Messaging.stripColor(s).equals(s) ? s : null;
|
||||
} catch (NumberFormatException nfe) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Random;
|
|||
|
||||
import net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_10_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_10_R1.ControllerMove;
|
||||
import net.minecraft.server.v1_10_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_10_R1.EntityLiving;
|
||||
|
@ -82,10 +81,7 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
|
||||
this.a.yaw = a(this.a.yaw, f, 90.0F);
|
||||
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
|
||||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.e * speed.getValue());
|
||||
this.a.l(movement);
|
||||
this.a.bg = movement;
|
||||
this.a.bg = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||
if (a instanceof EntitySlime && h-- <= 0) {
|
||||
this.h = new Random().nextInt(20) + 10;
|
||||
this.h /= 3;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Random;
|
|||
|
||||
import net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_11_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_11_R1.ControllerMove;
|
||||
import net.minecraft.server.v1_11_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_11_R1.EntityLiving;
|
||||
|
@ -84,10 +83,7 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
|
||||
this.a.yaw = a(this.a.yaw, f, 90.0F);
|
||||
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
|
||||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.e * speed.getValue());
|
||||
this.a.l(movement);
|
||||
this.a.bf = movement;
|
||||
this.a.bf = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||
if (a instanceof EntitySlime && h-- <= 0) {
|
||||
this.h = new Random().nextInt(20) + 10;
|
||||
this.h /= 3;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Random;
|
|||
|
||||
import net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_12_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_12_R1.ControllerMove;
|
||||
import net.minecraft.server.v1_12_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_12_R1.EntityLiving;
|
||||
|
@ -47,10 +46,7 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
|
||||
this.a.yaw = a(this.a.yaw, f, 90.0F);
|
||||
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
|
||||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.e * speed.getValue());
|
||||
this.a.k(movement);
|
||||
this.a.bg = movement;
|
||||
this.a.bg = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||
if (a instanceof EntitySlime && h-- <= 0) {
|
||||
this.h = new Random().nextInt(20) + 10;
|
||||
this.h /= 3;
|
||||
|
|
|
@ -49,10 +49,7 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
|
||||
this.a.yaw = a(this.a.yaw, f, 90.0F);
|
||||
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
|
||||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.e * speed.getValue());
|
||||
this.a.o(movement);
|
||||
this.a.bj = movement;
|
||||
this.a.bj = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||
if (a instanceof EntitySlime && h-- <= 0) {
|
||||
this.h = new Random().nextInt(20) + 10;
|
||||
this.h /= 3;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Random;
|
|||
|
||||
import net.citizensnpcs.nms.v1_14_R1.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_14_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_14_R1.ControllerMove;
|
||||
import net.minecraft.server.v1_14_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_14_R1.EntityLiving;
|
||||
|
@ -48,10 +47,7 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
|
||||
this.a.yaw = a(this.a.yaw, f, 90.0F);
|
||||
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
|
||||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.e * speed.getValue());
|
||||
this.a.o(movement);
|
||||
this.a.bd = movement;
|
||||
this.a.bd = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||
if (a instanceof EntitySlime && h-- <= 0) {
|
||||
this.h = new Random().nextInt(20) + 10;
|
||||
this.h /= 3;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Random;
|
|||
|
||||
import net.citizensnpcs.nms.v1_15_R1.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_15_R1.AttributeInstance;
|
||||
import net.minecraft.server.v1_15_R1.ControllerMove;
|
||||
import net.minecraft.server.v1_15_R1.EntityInsentient;
|
||||
import net.minecraft.server.v1_15_R1.EntityLiving;
|
||||
|
@ -48,10 +47,7 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
|
||||
this.a.yaw = a(this.a.yaw, f, 90.0F);
|
||||
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
|
||||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.e * speed.getValue());
|
||||
this.a.o(movement);
|
||||
this.a.bb = movement;
|
||||
this.a.bb = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||
if (a instanceof EntitySlime && h-- <= 0) {
|
||||
this.h = new Random().nextInt(20) + 10;
|
||||
this.h /= 3;
|
||||
|
|
|
@ -49,10 +49,7 @@ public class EntityMoveControl extends ControllerMove {
|
|||
float f = (float) Math.toDegrees(Math.atan2(d1, d0)) - 90.0F;
|
||||
this.a.yaw = a(this.a.yaw, f, 90.0F);
|
||||
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
|
||||
AttributeModifiable speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.e * speed.getValue());
|
||||
this.a.q(movement);
|
||||
this.a.aT = movement;
|
||||
this.a.aT = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||
if (a instanceof EntitySlime && h-- <= 0) {
|
||||
this.h = new Random().nextInt(20) + 10;
|
||||
if (((EntitySlime) a).isAggressive()) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.MoveControl;
|
||||
import net.minecraft.world.entity.monster.Slime;
|
||||
|
@ -104,10 +103,7 @@ public class EntityMoveControl extends MoveControl {
|
|||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
}
|
||||
AttributeInstance speed = this.entity.getAttribute(Attributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.speed * speed.getValue());
|
||||
this.entity.setSpeed(movement);
|
||||
this.entity.zza = movement;
|
||||
this.entity.zza = (float) (this.speed * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
if (entity instanceof Slime && jumpTicks-- <= 0) {
|
||||
this.jumpTicks = new Random().nextInt(20) + 10;
|
||||
if (((Slime) entity).isAggressive()) {
|
||||
|
|
|
@ -102,9 +102,7 @@ public class EntityMoveControl extends MoveControl {
|
|||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
}
|
||||
float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.setSpeed(movement);
|
||||
this.entity.zza = movement;
|
||||
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
if (entity instanceof Slime && jumpTicks-- <= 0) {
|
||||
this.jumpTicks = new Random().nextInt(20) + 10;
|
||||
if (((Slime) entity).isAggressive()) {
|
||||
|
|
|
@ -102,9 +102,7 @@ public class EntityMoveControl extends MoveControl {
|
|||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
}
|
||||
float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.setSpeed(movement);
|
||||
this.entity.zza = movement;
|
||||
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
if (entity instanceof Slime && jumpTicks-- <= 0) {
|
||||
this.jumpTicks = new Random().nextInt(20) + 10;
|
||||
if (((Slime) entity).isAggressive()) {
|
||||
|
|
|
@ -137,21 +137,21 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
detectEquipmentUpdatesPublic();
|
||||
noPhysics = isSpectator();
|
||||
if (isSpectator()) {
|
||||
this.onGround = false;
|
||||
onGround = false;
|
||||
}
|
||||
pushEntities();
|
||||
if (npc.useMinecraftAI()) {
|
||||
foodData.tick(this);
|
||||
}
|
||||
if (npc.data().get(NPC.Metadata.PICKUP_ITEMS, false)) {
|
||||
if (this.takeXpDelay > 0) {
|
||||
--this.takeXpDelay;
|
||||
if (takeXpDelay > 0) {
|
||||
--takeXpDelay;
|
||||
}
|
||||
AABB axisalignedbb;
|
||||
if (this.isPassenger() && !this.getVehicle().isRemoved()) {
|
||||
axisalignedbb = this.getBoundingBox().minmax(this.getVehicle().getBoundingBox()).inflate(1.0, 0.0, 1.0);
|
||||
if (isPassenger() && !getVehicle().isRemoved()) {
|
||||
axisalignedbb = getBoundingBox().minmax(this.getVehicle().getBoundingBox()).inflate(1.0, 0.0, 1.0);
|
||||
} else {
|
||||
axisalignedbb = this.getBoundingBox().inflate(1.0, 0.5, 1.0);
|
||||
axisalignedbb = getBoundingBox().inflate(1.0, 0.5, 1.0);
|
||||
}
|
||||
for (Entity entity : level().getEntities(this, axisalignedbb)) {
|
||||
entity.playerTouch(this);
|
||||
|
@ -210,7 +210,7 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||
|
||||
@Override
|
||||
public ServerStatsCounter getStats() {
|
||||
return this.statsCache == null ? statsCache = new EmptyServerStatsCounter() : statsCache;
|
||||
return statsCache == null ? statsCache = new EmptyServerStatsCounter() : statsCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -101,9 +101,7 @@ public class EntityMoveControl extends MoveControl {
|
|||
this.entity.setYRot(rotlerp(this.entity.getYRot(), f, 90.0F));
|
||||
NMS.setHeadYaw(entity.getBukkitEntity(), this.entity.getYRot());
|
||||
}
|
||||
float movement = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
this.entity.setSpeed(movement);
|
||||
this.entity.zza = movement;
|
||||
this.entity.zza = (float) (this.speedMod * this.entity.getAttribute(Attributes.MOVEMENT_SPEED).getValue());
|
||||
if (entity instanceof Slime && jumpTicks-- <= 0) {
|
||||
this.jumpTicks = new Random().nextInt(20) + 10;
|
||||
if (((Slime) entity).isAggressive()) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Random;
|
|||
|
||||
import net.citizensnpcs.nms.v1_8_R3.entity.EntityHumanNPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_8_R3.AttributeInstance;
|
||||
import net.minecraft.server.v1_8_R3.ControllerMove;
|
||||
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
|
@ -82,10 +81,7 @@ public class PlayerControllerMove extends ControllerMove {
|
|||
float f = (float) Math.toDegrees(Math.atan2(dZ, dX)) - 90.0F;
|
||||
this.a.yaw = a(this.a.yaw, f, 90.0F);
|
||||
NMS.setHeadYaw(a.getBukkitEntity(), this.a.yaw);
|
||||
AttributeInstance speed = this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
float movement = (float) (this.e * speed.getValue());
|
||||
this.a.k(movement);
|
||||
this.a.ba = movement;
|
||||
this.a.ba = (float) (this.e * this.a.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||
if (a instanceof EntitySlime && h-- <= 0) {
|
||||
this.h = new Random().nextInt(20) + 10;
|
||||
this.h /= 3;
|
||||
|
|
Loading…
Reference in New Issue