Update to Minecraft 1.18-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-22 09:00:00 +11:00
parent a852b81a69
commit 43702a9e10
700 changed files with 10286 additions and 10098 deletions

View File

@@ -41,7 +41,7 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@Override
public int getMaxDomestication() {
return getHandle().getMaxDomestication();
return getHandle().getMaxTemper();
}
@Override
@@ -52,13 +52,13 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
@Override
public double getJumpStrength() {
return getHandle().getJumpStrength();
return getHandle().getCustomJump();
}
@Override
public void setJumpStrength(double strength) {
Validate.isTrue(strength >= 0, "Jump strength cannot be less than zero");
getHandle().getAttributeInstance(GenericAttributes.JUMP_STRENGTH).setValue(strength);
getHandle().getAttribute(GenericAttributes.JUMP_STRENGTH).setBaseValue(strength);
}
@Override
@@ -81,7 +81,7 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
public void setOwner(AnimalTamer owner) {
if (owner != null) {
setTamed(true);
getHandle().setGoalTarget(null, null, false);
getHandle().setTarget(null, null, false);
setOwnerUUID(owner.getUniqueId());
} else {
setTamed(false);

View File

@@ -16,7 +16,7 @@ public class CraftAgeable extends CraftCreature implements Ageable {
@Override
public void setAge(int age) {
getHandle().setAgeRaw(age);
getHandle().setAge(age);
}
@Override

View File

@@ -43,7 +43,7 @@ public class CraftAnimals extends CraftAgeable implements Animals {
@Override
public void setLoveModeTicks(int ticks) {
Preconditions.checkArgument(ticks >= 0, "Love mode ticks must be positive or 0");
getHandle().setLoveTicks(ticks);
getHandle().setInLoveTime(ticks);
}
@Override
@@ -53,7 +53,7 @@ public class CraftAnimals extends CraftAgeable implements Animals {
@Override
public boolean isBreedItem(ItemStack itemStack) {
return getHandle().isBreedItem(CraftItemStack.asNMSCopy(itemStack));
return getHandle().isFood(CraftItemStack.asNMSCopy(itemStack));
}
@Override

View File

@@ -133,7 +133,7 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
@Override
public void setColor(Color color) {
getHandle().setColor(color.asRGB());
getHandle().setFixedColor(color.asRGB());
}
@Override
@@ -141,7 +141,7 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
int effectId = effect.getType().getId();
MobEffect existing = null;
for (MobEffect mobEffect : getHandle().effects) {
if (MobEffectList.getId(mobEffect.getMobEffect()) == effectId) {
if (MobEffectList.getId(mobEffect.getEffect()) == effectId) {
existing = mobEffect;
}
}
@@ -174,7 +174,7 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
@Override
public boolean hasCustomEffect(PotionEffectType type) {
for (MobEffect effect : getHandle().effects) {
if (CraftPotionUtil.equals(effect.getMobEffect(), type)) {
if (CraftPotionUtil.equals(effect.getEffect(), type)) {
return true;
}
}
@@ -191,7 +191,7 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
int effectId = effect.getId();
MobEffect existing = null;
for (MobEffect mobEffect : getHandle().effects) {
if (MobEffectList.getId(mobEffect.getMobEffect()) == effectId) {
if (MobEffectList.getId(mobEffect.getEffect()) == effectId) {
existing = mobEffect;
}
}
@@ -206,26 +206,26 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
@Override
public void setBasePotionData(PotionData data) {
Validate.notNull(data, "PotionData cannot be null");
getHandle().setType(CraftPotionUtil.fromBukkit(data));
getHandle().setPotionType(CraftPotionUtil.fromBukkit(data));
}
@Override
public PotionData getBasePotionData() {
return CraftPotionUtil.toBukkit(getHandle().getType());
return CraftPotionUtil.toBukkit(getHandle().getPotionType());
}
@Override
public ProjectileSource getSource() {
EntityLiving source = getHandle().getSource();
EntityLiving source = getHandle().getOwner();
return (source == null) ? null : (LivingEntity) source.getBukkitEntity();
}
@Override
public void setSource(ProjectileSource shooter) {
if (shooter instanceof CraftLivingEntity) {
getHandle().setSource((EntityLiving) ((CraftLivingEntity) shooter).getHandle());
getHandle().setOwner((EntityLiving) ((CraftLivingEntity) shooter).getHandle());
} else {
getHandle().setSource((EntityLiving) null);
getHandle().setOwner((EntityLiving) null);
}
}
}

View File

@@ -144,12 +144,12 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
@Override
public boolean hasBasePlate() {
return !getHandle().hasBasePlate();
return !getHandle().isNoBasePlate();
}
@Override
public void setBasePlate(boolean basePlate) {
getHandle().setBasePlate(!basePlate);
getHandle().setNoBasePlate(!basePlate);
}
@Override
@@ -171,12 +171,12 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
@Override
public boolean hasArms() {
return getHandle().hasArms();
return getHandle().isShowArms();
}
@Override
public void setArms(boolean arms) {
getHandle().setArms(arms);
getHandle().setShowArms(arms);
}
@Override
@@ -217,16 +217,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
@Override
public void addEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) {
getHandle().disabledSlots |= (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getSlotFlag() + lockType.ordinal() * 8);
getHandle().disabledSlots |= (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getFilterFlag() + lockType.ordinal() * 8);
}
@Override
public void removeEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) {
getHandle().disabledSlots &= ~(1 << CraftEquipmentSlot.getNMS(equipmentSlot).getSlotFlag() + lockType.ordinal() * 8);
getHandle().disabledSlots &= ~(1 << CraftEquipmentSlot.getNMS(equipmentSlot).getFilterFlag() + lockType.ordinal() * 8);
}
@Override
public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) {
return (getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getSlotFlag() + lockType.ordinal() * 8)) != 0;
return (getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getFilterFlag() + lockType.ordinal() * 8)) != 0;
}
}

View File

@@ -21,7 +21,7 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override
public void setKnockbackStrength(int knockbackStrength) {
Validate.isTrue(knockbackStrength >= 0, "Knockback cannot be negative");
getHandle().setKnockbackStrength(knockbackStrength);
getHandle().setKnockback(knockbackStrength);
}
@Override
@@ -31,13 +31,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override
public double getDamage() {
return getHandle().getDamage();
return getHandle().getBaseDamage();
}
@Override
public void setDamage(double damage) {
Preconditions.checkArgument(damage >= 0, "Damage must be positive");
getHandle().setDamage(damage);
getHandle().setBaseDamage(damage);
}
@Override
@@ -54,12 +54,12 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override
public boolean isCritical() {
return getHandle().isCritical();
return getHandle().isCritArrow();
}
@Override
public void setCritical(boolean critical) {
getHandle().setCritical(critical);
getHandle().setCritArrow(critical);
}
@Override
@@ -70,9 +70,9 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override
public void setShooter(ProjectileSource shooter) {
if (shooter instanceof Entity) {
getHandle().setShooter(((CraftEntity) shooter).getHandle());
getHandle().setOwner(((CraftEntity) shooter).getHandle());
} else {
getHandle().setShooter(null);
getHandle().setOwner(null);
}
getHandle().projectileSource = shooter;
}
@@ -88,7 +88,7 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
return null;
}
BlockPosition pos = getHandle().getChunkCoordinates();
BlockPosition pos = getHandle().blockPosition();
return getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
}
@@ -100,7 +100,7 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override
public void setPickupStatus(PickupStatus status) {
Preconditions.checkNotNull(status, "status");
getHandle().pickup = EntityArrow.PickupStatus.a(status.ordinal());
getHandle().pickup = EntityArrow.PickupStatus.byOrdinal(status.ordinal());
}
@Override
@@ -113,7 +113,7 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
@Override
public boolean isShotFromCrossbow() {
return getHandle().isShotFromCrossbow();
return getHandle().shotFromCrossbow();
}
@Override

View File

@@ -27,11 +27,11 @@ public class CraftBat extends CraftAmbient implements Bat {
@Override
public boolean isAwake() {
return !getHandle().isAsleep();
return !getHandle().isResting();
}
@Override
public void setAwake(boolean state) {
getHandle().setAsleep(!state);
getHandle().setResting(!state);
}
}

View File

@@ -43,14 +43,14 @@ public class CraftBee extends CraftAnimals implements Bee {
@Override
public Location getFlower() {
BlockPosition flower = getHandle().getFlowerPos();
BlockPosition flower = getHandle().getSavedFlowerPos();
return (flower == null) ? null : new Location(getWorld(), flower.getX(), flower.getY(), flower.getZ());
}
@Override
public void setFlower(Location location) {
Preconditions.checkArgument(location == null || this.getWorld().equals(location.getWorld()), "Flower must be in same world");
getHandle().setFlowerPos(location == null ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
getHandle().setSavedFlowerPos(location == null ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
}
@Override
@@ -75,12 +75,12 @@ public class CraftBee extends CraftAnimals implements Bee {
@Override
public int getAnger() {
return getHandle().getAnger();
return getHandle().getRemainingPersistentAngerTime();
}
@Override
public void setAnger(int anger) {
getHandle().setAnger(anger);
getHandle().setRemainingPersistentAngerTime(anger);
}
@Override
@@ -90,6 +90,6 @@ public class CraftBee extends CraftAnimals implements Bee {
@Override
public void setCannotEnterHiveTicks(int ticks) {
getHandle().setCannotEnterHiveTicks(ticks);
getHandle().setStayOutOfHiveCountdown(ticks);
}
}

View File

@@ -14,7 +14,7 @@ public class CraftBoat extends CraftVehicle implements Boat {
@Override
public TreeSpecies getWoodType() {
return getTreeSpecies(getHandle().getType());
return getTreeSpecies(getHandle().getBoatType());
}
@Override

View File

@@ -44,11 +44,11 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
@Override
public DyeColor getCollarColor() {
return DyeColor.getByWoolData((byte) getHandle().getCollarColor().getColorIndex());
return DyeColor.getByWoolData((byte) getHandle().getCollarColor().getId());
}
@Override
public void setCollarColor(DyeColor color) {
getHandle().setCollarColor(EnumColor.fromColorIndex(color.getWoolData()));
getHandle().setCollarColor(EnumColor.byId(color.getWoolData()));
}
}

View File

@@ -17,13 +17,13 @@ public abstract class CraftChestedHorse extends CraftAbstractHorse implements Ch
@Override
public boolean isCarryingChest() {
return getHandle().isCarryingChest();
return getHandle().hasChest();
}
@Override
public void setCarryingChest(boolean chest) {
if (chest == isCarryingChest()) return;
getHandle().setCarryingChest(chest);
getHandle().loadChest();
getHandle().setChest(chest);
getHandle().createInventory();
}
}

View File

@@ -73,7 +73,7 @@ public class CraftCreeper extends CraftMonster implements Creeper {
@Override
public void explode() {
getHandle().explode();
getHandle().explodeCreeper();
}
@Override

View File

@@ -14,12 +14,12 @@ public class CraftEnderCrystal extends CraftEntity implements EnderCrystal {
@Override
public boolean isShowingBottom() {
return getHandle().isShowingBottom();
return getHandle().showsBottom();
}
@Override
public void setShowingBottom(boolean showing) {
getHandle().setShowingBottom(showing);
getHandle().setShowBottom(showing);
}
@Override

View File

@@ -49,16 +49,16 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
@Override
public Phase getPhase() {
return Phase.values()[getHandle().getDataWatcher().get(EntityEnderDragon.DATA_PHASE)];
return Phase.values()[getHandle().getEntityData().get(EntityEnderDragon.DATA_PHASE)];
}
@Override
public void setPhase(Phase phase) {
getHandle().getDragonControllerManager().setControllerPhase(getMinecraftPhase(phase));
getHandle().getPhaseManager().setPhase(getMinecraftPhase(phase));
}
public static Phase getBukkitPhase(DragonControllerPhase phase) {
return Phase.values()[phase.b()];
return Phase.values()[phase.getId()];
}
public static DragonControllerPhase getMinecraftPhase(Phase phase) {
@@ -73,7 +73,7 @@ public class CraftEnderDragon extends CraftComplexLivingEntity implements EnderD
@Override
public DragonBattle getDragonBattle() {
return getHandle().getEnderDragonBattle() != null ? new CraftDragonBattle(getHandle().getEnderDragonBattle()) : null;
return getHandle().getDragonFight() != null ? new CraftDragonBattle(getHandle().getDragonFight()) : null;
}
@Override

View File

@@ -39,7 +39,7 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
@Override
public void setTargetLocation(Location location) {
Preconditions.checkArgument(getWorld().equals(location.getWorld()), "Cannot target EnderSignal across worlds");
getHandle().a(new BlockPosition(location.getX(), location.getY(), location.getZ()));
getHandle().signalTo(new BlockPosition(location.getX(), location.getY(), location.getZ()));
}
@Override
@@ -54,12 +54,12 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
@Override
public ItemStack getItem() {
return CraftItemStack.asBukkitCopy(getHandle().getSuppliedItem());
return CraftItemStack.asBukkitCopy(getHandle().getItem());
}
@Override
public void setItem(ItemStack item) {
getHandle().setItem(item != null ? CraftItemStack.asNMSCopy(item) : Items.ENDER_EYE.createItemStack());
getHandle().setItem(item != null ? CraftItemStack.asNMSCopy(item) : Items.ENDER_EYE.getDefaultInstance());
}
@Override

View File

@@ -18,24 +18,24 @@ public class CraftEnderman extends CraftMonster implements Enderman {
@Override
public MaterialData getCarriedMaterial() {
IBlockData blockData = getHandle().getCarried();
IBlockData blockData = getHandle().getCarriedBlock();
return (blockData == null) ? Material.AIR.getNewData((byte) 0) : CraftMagicNumbers.getMaterial(blockData);
}
@Override
public BlockData getCarriedBlock() {
IBlockData blockData = getHandle().getCarried();
IBlockData blockData = getHandle().getCarriedBlock();
return (blockData == null) ? null : CraftBlockData.fromData(blockData);
}
@Override
public void setCarriedMaterial(MaterialData data) {
getHandle().setCarried(CraftMagicNumbers.getBlock(data));
getHandle().setCarriedBlock(CraftMagicNumbers.getBlock(data));
}
@Override
public void setCarriedBlock(BlockData blockData) {
getHandle().setCarried(blockData == null ? null : ((CraftBlockData) blockData).getState());
getHandle().setCarriedBlock(blockData == null ? null : ((CraftBlockData) blockData).getState());
}
@Override

View File

@@ -408,16 +408,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public Location getLocation() {
return new Location(getWorld(), entity.locX(), entity.locY(), entity.locZ(), entity.getBukkitYaw(), entity.getXRot());
return new Location(getWorld(), entity.getX(), entity.getY(), entity.getZ(), entity.getBukkitYaw(), entity.getXRot());
}
@Override
public Location getLocation(Location loc) {
if (loc != null) {
loc.setWorld(getWorld());
loc.setX(entity.locX());
loc.setY(entity.locY());
loc.setZ(entity.locZ());
loc.setX(entity.getX());
loc.setY(entity.getY());
loc.setZ(entity.getZ());
loc.setYaw(entity.getBukkitYaw());
loc.setPitch(entity.getXRot());
}
@@ -427,25 +427,25 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public Vector getVelocity() {
return CraftVector.toBukkit(entity.getMot());
return CraftVector.toBukkit(entity.getDeltaMovement());
}
@Override
public void setVelocity(Vector velocity) {
Preconditions.checkArgument(velocity != null, "velocity");
velocity.checkFinite();
entity.setMot(CraftVector.toNMS(velocity));
entity.setDeltaMovement(CraftVector.toNMS(velocity));
entity.hurtMarked = true;
}
@Override
public double getHeight() {
return getHandle().getHeight();
return getHandle().getBbHeight();
}
@Override
public double getWidth() {
return getHandle().getWidth();
return getHandle().getBbWidth();
}
@Override
@@ -484,7 +484,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
entity.setXRot(pitch);
entity.yRotO = yaw;
entity.xRotO = pitch;
entity.setHeadRotation(yaw);
entity.setYHeadRot(yaw);
}
@Override
@@ -513,9 +513,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
// entity.setLocation() throws no event, and so cannot be cancelled
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
entity.absMoveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// SPIGOT-619: Force sync head rotation also
entity.setHeadRotation(location.getYaw());
entity.setYHeadRot(location.getYaw());
return true;
}
@@ -534,7 +534,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
Preconditions.checkState(!entity.generation, "Cannot get nearby entities during world generation");
List<Entity> notchEntityList = entity.level.getEntities(entity, entity.getBoundingBox().grow(x, y, z), Predicates.alwaysTrue());
List<Entity> notchEntityList = entity.level.getEntities(entity, entity.getBoundingBox().inflate(x, y, z), Predicates.alwaysTrue());
List<org.bukkit.entity.Entity> bukkitEntityList = new java.util.ArrayList<org.bukkit.entity.Entity>(notchEntityList.size());
for (Entity e : notchEntityList) {
@@ -555,7 +555,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public int getMaxFireTicks() {
return entity.getMaxFireTicks();
return entity.getFireImmuneTicks();
}
@Override
@@ -597,7 +597,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public void remove() {
entity.die();
entity.discard();
}
@Override
@@ -663,7 +663,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean addPassenger(org.bukkit.entity.Entity passenger) {
Preconditions.checkArgument(passenger != null, "passenger == null");
return ((CraftEntity) passenger).getHandle().a(getHandle(), true);
return ((CraftEntity) passenger).getHandle().startRiding(getHandle(), true);
}
@Override
@@ -711,7 +711,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public UUID getUniqueId() {
return getHandle().getUniqueID();
return getHandle().getUUID();
}
@Override
@@ -737,7 +737,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Preconditions.checkState(!entity.generation, "Cannot play effect during world generation");
if (type.getApplicable().isInstance(this)) {
this.getHandle().level.broadcastEntityEffect(getHandle(), type.getData());
this.getHandle().level.broadcastEntityEvent(getHandle(), type.getData());
}
}
@@ -841,7 +841,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public boolean isCustomNameVisible() {
return getHandle().getCustomNameVisible();
return getHandle().isCustomNameVisible();
}
@Override
@@ -866,7 +866,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public String getName() {
return CraftChatMessage.fromComponent(getHandle().getDisplayName());
return CraftChatMessage.fromComponent(getHandle().getName());
}
@Override
@@ -951,7 +951,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public boolean isInvulnerable() {
return getHandle().isInvulnerable(DamageSource.GENERIC);
return getHandle().isInvulnerableTo(DamageSource.GENERIC);
}
@Override
@@ -986,28 +986,28 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@Override
public Set<String> getScoreboardTags() {
return getHandle().getScoreboardTags();
return getHandle().getTags();
}
@Override
public boolean addScoreboardTag(String tag) {
return getHandle().addScoreboardTag(tag);
return getHandle().addTag(tag);
}
@Override
public boolean removeScoreboardTag(String tag) {
return getHandle().removeScoreboardTag(tag);
return getHandle().removeTag(tag);
}
@Override
public PistonMoveReaction getPistonMoveReaction() {
return PistonMoveReaction.getById(getHandle().getPushReaction().ordinal());
return PistonMoveReaction.getById(getHandle().getPistonPushReaction().ordinal());
}
@Override
public BlockFace getFacing() {
// Use this method over getDirection because it handles boats and minecarts.
return CraftBlock.notchToBlockFace(getHandle().getAdjustedDirection());
return CraftBlock.notchToBlockFace(getHandle().getMotionDirection());
}
@Override
@@ -1022,7 +1022,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public void storeBukkitValues(NBTTagCompound c) {
if (!this.persistentDataContainer.isEmpty()) {
c.set("BukkitValues", this.persistentDataContainer.toTagCompound());
c.put("BukkitValues", this.persistentDataContainer.toTagCompound());
}
}
@@ -1036,8 +1036,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
protected NBTTagCompound save() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("id", getHandle().getSaveID());
getHandle().save(nbttagcompound);
nbttagcompound.putString("id", getHandle().getEncodeId());
getHandle().saveWithoutId(nbttagcompound);
return nbttagcompound;
}
@@ -1049,13 +1049,13 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
WorldServer world = ((CraftWorld) getWorld()).getHandle();
PlayerChunkMap.EntityTracker entityTracker = world.getChunkProvider().chunkMap.entityMap.get(getEntityId());
PlayerChunkMap.EntityTracker entityTracker = world.getChunkSource().chunkMap.entityMap.get(getEntityId());
if (entityTracker == null) {
return;
}
entityTracker.broadcast(getHandle().getPacket());
entityTracker.broadcast(getHandle().getAddEntityPacket());
}
private static PermissibleBase getPermissibleBase() {

View File

@@ -29,11 +29,11 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker {
@Override
public Evoker.Spell getCurrentSpell() {
return Evoker.Spell.values()[getHandle().getSpell().ordinal()];
return Evoker.Spell.values()[getHandle().getCurrentSpell().ordinal()];
}
@Override
public void setCurrentSpell(Evoker.Spell spell) {
getHandle().setSpell(spell == null ? EntityIllagerWizard.Spell.NONE : EntityIllagerWizard.Spell.a(spell.ordinal()));
getHandle().setIsCastingSpell(spell == null ? EntityIllagerWizard.Spell.NONE : EntityIllagerWizard.Spell.byId(spell.ordinal()));
}
}

View File

@@ -37,6 +37,6 @@ public class CraftEvokerFangs extends CraftEntity implements EvokerFangs {
@Override
public void setOwner(LivingEntity owner) {
getHandle().a(owner == null ? null : ((CraftLivingEntity) owner).getHandle());
getHandle().setOwner(owner == null ? null : ((CraftLivingEntity) owner).getHandle());
}
}

View File

@@ -36,7 +36,7 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock {
@Override
public BlockData getBlockData() {
return CraftBlockData.fromData(getHandle().getBlock());
return CraftBlockData.fromData(getHandle().getBlockState());
}
@Override

View File

@@ -41,9 +41,9 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
@Override
public void setShooter(ProjectileSource shooter) {
if (shooter instanceof CraftLivingEntity) {
getHandle().setShooter(((CraftLivingEntity) shooter).getHandle());
getHandle().setOwner(((CraftLivingEntity) shooter).getHandle());
} else {
getHandle().setShooter(null);
getHandle().setOwner(null);
}
getHandle().projectileSource = shooter;
}

View File

@@ -19,11 +19,11 @@ public class CraftFirework extends CraftProjectile implements Firework {
public CraftFirework(CraftServer server, EntityFireworks entity) {
super(server, entity);
ItemStack item = getHandle().getDataWatcher().get(EntityFireworks.DATA_ID_FIREWORKS_ITEM);
ItemStack item = getHandle().getEntityData().get(EntityFireworks.DATA_ID_FIREWORKS_ITEM);
if (item.isEmpty()) {
item = new ItemStack(Items.FIREWORK_ROCKET);
getHandle().getDataWatcher().set(EntityFireworks.DATA_ID_FIREWORKS_ITEM, item);
getHandle().getEntityData().set(EntityFireworks.DATA_ID_FIREWORKS_ITEM, item);
}
this.item = CraftItemStack.asCraftMirror(item);
@@ -61,7 +61,7 @@ public class CraftFirework extends CraftProjectile implements Firework {
// Copied from EntityFireworks constructor, update firework lifetime/power
getHandle().lifetime = 10 * (1 + meta.getPower()) + random.nextInt(6) + random.nextInt(7);
getHandle().getDataWatcher().markDirty(EntityFireworks.DATA_ID_FIREWORKS_ITEM);
getHandle().getEntityData().markDirty(EntityFireworks.DATA_ID_FIREWORKS_ITEM);
}
@Override
@@ -76,6 +76,6 @@ public class CraftFirework extends CraftProjectile implements Firework {
@Override
public void setShotAtAngle(boolean shotAtAngle) {
getHandle().getDataWatcher().set(EntityFireworks.DATA_SHOT_AT_ANGLE, shotAtAngle);
getHandle().getEntityData().set(EntityFireworks.DATA_SHOT_AT_ANGLE, shotAtAngle);
}
}

View File

@@ -71,7 +71,7 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
EntityFishingHook hook = getHandle();
if (this.biteChance == -1) {
if (hook.level.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX()), MathHelper.floor(hook.locY()) + 1, MathHelper.floor(hook.locZ())))) {
if (hook.level.isRainingAt(new BlockPosition(MathHelper.floor(hook.getX()), MathHelper.floor(hook.getY()) + 1, MathHelper.floor(hook.getZ())))) {
return 1 / 300.0;
}
return 1 / 500.0;
@@ -87,7 +87,7 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
@Override
public boolean isInOpenWater() {
return getHandle().isInOpenWater();
return getHandle().isOpenWaterFishing();
}
@Override
@@ -101,7 +101,7 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
EntityFishingHook hook = getHandle();
hook.hookedIn = (entity != null) ? ((CraftEntity) entity).getHandle() : null;
hook.getDataWatcher().set(EntityFishingHook.DATA_HOOKED_ENTITY, hook.hookedIn != null ? hook.hookedIn.getId() + 1 : 0);
hook.getEntityData().set(EntityFishingHook.DATA_HOOKED_ENTITY, hook.hookedIn != null ? hook.hookedIn.getId() + 1 : 0);
}
@Override
@@ -111,7 +111,7 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
return false;
}
hook.reel(hook.hookedIn);
hook.pullEntity(hook.hookedIn);
return true;
}

View File

@@ -50,7 +50,7 @@ public class CraftFox extends CraftAnimals implements Fox {
@Override
public void setCrouching(boolean crouching) {
getHandle().setCrouching(crouching);
getHandle().setIsCrouching(crouching);
}
@Override
@@ -70,7 +70,7 @@ public class CraftFox extends CraftAnimals implements Fox {
@Override
public AnimalTamer getFirstTrustedPlayer() {
UUID uuid = getHandle().getDataWatcher().get(EntityFox.DATA_TRUSTED_ID_0).orElse(null);
UUID uuid = getHandle().getEntityData().get(EntityFox.DATA_TRUSTED_ID_0).orElse(null);
if (uuid == null) {
return null;
}
@@ -85,16 +85,16 @@ public class CraftFox extends CraftAnimals implements Fox {
@Override
public void setFirstTrustedPlayer(AnimalTamer player) {
if (player == null && getHandle().getDataWatcher().get(EntityFox.DATA_TRUSTED_ID_1).isPresent()) {
if (player == null && getHandle().getEntityData().get(EntityFox.DATA_TRUSTED_ID_1).isPresent()) {
throw new IllegalStateException("Must remove second trusted player first");
}
getHandle().getDataWatcher().set(EntityFox.DATA_TRUSTED_ID_0, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
getHandle().getEntityData().set(EntityFox.DATA_TRUSTED_ID_0, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
}
@Override
public AnimalTamer getSecondTrustedPlayer() {
UUID uuid = getHandle().getDataWatcher().get(EntityFox.DATA_TRUSTED_ID_1).orElse(null);
UUID uuid = getHandle().getEntityData().get(EntityFox.DATA_TRUSTED_ID_1).orElse(null);
if (uuid == null) {
return null;
}
@@ -109,10 +109,10 @@ public class CraftFox extends CraftAnimals implements Fox {
@Override
public void setSecondTrustedPlayer(AnimalTamer player) {
if (player != null && !getHandle().getDataWatcher().get(EntityFox.DATA_TRUSTED_ID_0).isPresent()) {
if (player != null && !getHandle().getEntityData().get(EntityFox.DATA_TRUSTED_ID_0).isPresent()) {
throw new IllegalStateException("Must add first trusted player first");
}
getHandle().getDataWatcher().set(EntityFox.DATA_TRUSTED_ID_1, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
getHandle().getEntityData().set(EntityFox.DATA_TRUSTED_ID_1, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
}
}

View File

@@ -34,6 +34,6 @@ public class CraftGlowSquid extends CraftSquid implements GlowSquid {
@Override
public void setDarkTicksRemaining(int darkTicksRemaining) {
Preconditions.checkArgument(darkTicksRemaining >= 0, "darkTicksRemaining must be >= 0");
getHandle().setDarkTicksRemaining(darkTicksRemaining);
getHandle().setDarkTicks(darkTicksRemaining);
}
}

View File

@@ -33,7 +33,7 @@ public class CraftGuardian extends CraftMonster implements Guardian {
// clean up laser target, when target is removed
if (target == null) {
getHandle().a(0); // PAIL rename setLaserTarget
getHandle().setActiveAttackTarget(0);
}
}
@@ -45,9 +45,9 @@ public class CraftGuardian extends CraftMonster implements Guardian {
return false;
}
getHandle().a(target.getEntityId()); // PAIL rename setLaserTarget
getHandle().setActiveAttackTarget(target.getEntityId());
} else {
getHandle().a(0); // PAIL rename setLaserTarget
getHandle().setActiveAttackTarget(0);
}
return true;
@@ -55,7 +55,7 @@ public class CraftGuardian extends CraftMonster implements Guardian {
@Override
public boolean hasLaser() {
return getHandle().fy(); // PAIL rename hasLaserTarget
return getHandle().hasActiveAttackTarget();
}
@Override

View File

@@ -31,24 +31,24 @@ public class CraftHorse extends CraftAbstractHorse implements Horse {
@Override
public Color getColor() {
return Color.values()[getHandle().getColor().a()];
return Color.values()[getHandle().getVariant().getId()];
}
@Override
public void setColor(Color color) {
Validate.notNull(color, "Color cannot be null");
getHandle().setVariant(HorseColor.a(color.ordinal()), getHandle().getStyle());
getHandle().setVariantAndMarkings(HorseColor.byId(color.ordinal()), getHandle().getMarkings());
}
@Override
public Style getStyle() {
return Style.values()[getHandle().getStyle().a()];
return Style.values()[getHandle().getMarkings().getId()];
}
@Override
public void setStyle(Style style) {
Validate.notNull(style, "Style cannot be null");
getHandle().setVariant(getHandle().getColor(), HorseStyle.a(style.ordinal()));
getHandle().setVariantAndMarkings(getHandle().getVariant(), HorseStyle.byId(style.ordinal()));
}
@Override

View File

@@ -74,7 +74,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
super(server, entity);
mode = server.getDefaultGameMode();
this.inventory = new CraftInventoryPlayer(entity.getInventory());
enderChest = new CraftInventory(entity.getEnderChest());
enderChest = new CraftInventory(entity.getEnderChestInventory());
}
@Override
@@ -94,7 +94,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public MainHand getMainHand() {
return getHandle().getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT;
return getHandle().getMainArm() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT;
}
@Override
@@ -133,18 +133,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
Preconditions.checkArgument(location.getWorld().equals(getWorld()), "Cannot sleep across worlds");
BlockPosition blockposition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
IBlockData iblockdata = getHandle().level.getType(blockposition);
IBlockData iblockdata = getHandle().level.getBlockState(blockposition);
if (!(iblockdata.getBlock() instanceof BlockBed)) {
return false;
}
if (getHandle().sleep(blockposition, force).left().isPresent()) {
if (getHandle().startSleepInBed(blockposition, force).left().isPresent()) {
return false;
}
// From BlockBed
iblockdata = (IBlockData) iblockdata.set(BlockBed.OCCUPIED, true);
getHandle().level.setTypeAndData(blockposition, iblockdata, 4);
iblockdata = (IBlockData) iblockdata.setValue(BlockBed.OCCUPIED, true);
getHandle().level.setBlock(blockposition, iblockdata, 4);
return true;
}
@@ -153,20 +153,20 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
public void wakeup(boolean setSpawnLocation) {
Preconditions.checkState(isSleeping(), "Cannot wakeup if not sleeping");
getHandle().wakeup(true, setSpawnLocation);
getHandle().stopSleepInBed(true, setSpawnLocation);
}
@Override
public Location getBedLocation() {
Preconditions.checkState(isSleeping(), "Not sleeping");
BlockPosition bed = getHandle().getBedPosition().get();
BlockPosition bed = getHandle().getSleepingPos().get();
return new Location(getWorld(), bed.getX(), bed.getY(), bed.getZ());
}
@Override
public String getName() {
return getHandle().getName();
return getHandle().getScoreboardName();
}
@Override
@@ -290,15 +290,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (iinventory instanceof ITileInventory) {
if (iinventory instanceof TileEntity) {
TileEntity te = (TileEntity) iinventory;
if (!te.hasWorld()) {
te.setWorld(getHandle().level);
if (!te.hasLevel()) {
te.setLevel(getHandle().level);
}
}
}
Containers<?> container = CraftContainer.getNotchInventoryType(inventory);
if (iinventory instanceof ITileInventory) {
getHandle().openContainer(iinventory);
getHandle().openMenu(iinventory);
} else {
openCustomInventory(inventory, player, container);
}
@@ -320,7 +320,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
String title = container.getBukkitView().getTitle();
player.connection.sendPacket(new PacketPlayOutOpenWindow(container.containerId, windowType, CraftChatMessage.fromString(title)[0]));
player.connection.send(new PacketPlayOutOpenWindow(container.containerId, windowType, CraftChatMessage.fromString(title)[0]));
player.containerMenu = container;
player.initMenu(container);
}
@@ -336,7 +336,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return null;
}
}
getHandle().openContainer(((BlockWorkbench) Blocks.CRAFTING_TABLE).getInventory(null, getHandle().level, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())));
getHandle().openMenu(((BlockWorkbench) Blocks.CRAFTING_TABLE).getMenuProvider(null, getHandle().level, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())));
if (force) {
getHandle().containerMenu.checkReachable = false;
}
@@ -357,7 +357,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
// If there isn't an enchant table we can force create one, won't be very useful though.
BlockPosition pos = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
getHandle().openContainer(((BlockEnchantmentTable) Blocks.ENCHANTING_TABLE).getInventory(null, getHandle().level, pos));
getHandle().openMenu(((BlockEnchantmentTable) Blocks.ENCHANTING_TABLE).getMenuProvider(null, getHandle().level, pos));
if (force) {
getHandle().containerMenu.checkReachable = false;
@@ -371,7 +371,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (((EntityPlayer) getHandle()).connection == null) return;
if (getHandle().containerMenu != getHandle().inventoryMenu) {
// fire INVENTORY_CLOSE if one already open
((EntityPlayer) getHandle()).connection.a(new PacketPlayInCloseWindow(getHandle().containerMenu.containerId));
((EntityPlayer) getHandle()).connection.handleContainerClose(new PacketPlayInCloseWindow(getHandle().containerMenu.containerId));
}
EntityPlayer player = (EntityPlayer) getHandle();
Container container;
@@ -390,7 +390,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
// Now open the window
Containers<?> windowType = CraftContainer.getNotchInventoryType(inventory.getTopInventory());
String title = inventory.getTitle();
player.connection.sendPacket(new PacketPlayOutOpenWindow(container.containerId, windowType, CraftChatMessage.fromString(title)[0]));
player.connection.send(new PacketPlayOutOpenWindow(container.containerId, windowType, CraftChatMessage.fromString(title)[0]));
player.containerMenu = container;
player.initMenu(container);
}
@@ -418,7 +418,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
int level = 1; // note: using level 0 with active 'is-regular-villager'-flag allows hiding the name suffix
if (merchant instanceof CraftAbstractVillager) {
mcMerchant = ((CraftAbstractVillager) merchant).getHandle();
name = ((CraftAbstractVillager) merchant).getHandle().getScoreboardDisplayName();
name = ((CraftAbstractVillager) merchant).getHandle().getDisplayName();
if (merchant instanceof CraftVillager) {
level = ((CraftVillager) merchant).getHandle().getVillagerData().getLevel();
}
@@ -430,14 +430,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
mcMerchant.setTradingPlayer(this.getHandle());
mcMerchant.openTrade(this.getHandle(), name, level);
mcMerchant.openTradingScreen(this.getHandle(), name, level);
return this.getHandle().containerMenu.getBukkitView();
}
@Override
public void closeInventory() {
getHandle().closeInventory();
getHandle().closeContainer();
}
@Override
@@ -447,12 +447,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public boolean isHandRaised() {
return getHandle().isHandRaised();
return getHandle().isUsingItem();
}
@Override
public ItemStack getItemInUse() {
net.minecraft.world.item.ItemStack item = getHandle().getActiveItem();
net.minecraft.world.item.ItemStack item = getHandle().getUseItem();
return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item);
}
@@ -463,27 +463,27 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public int getExpToLevel() {
return getHandle().getExpToLevel();
return getHandle().getXpNeededForNextLevel();
}
@Override
public float getAttackCooldown() {
return getHandle().getAttackCooldown(0.5f);
return getHandle().getAttackStrengthScale(0.5f);
}
@Override
public boolean hasCooldown(Material material) {
Preconditions.checkArgument(material != null, "material");
return getHandle().getCooldownTracker().hasCooldown(CraftMagicNumbers.getItem(material));
return getHandle().getCooldowns().isOnCooldown(CraftMagicNumbers.getItem(material));
}
@Override
public int getCooldown(Material material) {
Preconditions.checkArgument(material != null, "material");
ItemCooldown.Info cooldown = getHandle().getCooldownTracker().cooldowns.get(CraftMagicNumbers.getItem(material));
return (cooldown == null) ? 0 : Math.max(0, cooldown.endTime - getHandle().getCooldownTracker().tickCount);
ItemCooldown.Info cooldown = getHandle().getCooldowns().cooldowns.get(CraftMagicNumbers.getItem(material));
return (cooldown == null) ? 0 : Math.max(0, cooldown.endTime - getHandle().getCooldowns().tickCount);
}
@Override
@@ -491,7 +491,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
Preconditions.checkArgument(material != null, "material");
Preconditions.checkArgument(ticks >= 0, "Cannot have negative cooldown");
getHandle().getCooldownTracker().setCooldown(CraftMagicNumbers.getItem(material), ticks);
getHandle().getCooldowns().addCooldown(CraftMagicNumbers.getItem(material), ticks);
}
@Override
@@ -501,7 +501,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public int discoverRecipes(Collection<NamespacedKey> recipes) {
return getHandle().discoverRecipes(bukkitKeysToMinecraftRecipes(recipes));
return getHandle().awardRecipes(bukkitKeysToMinecraftRecipes(recipes));
}
@Override
@@ -511,7 +511,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public int undiscoverRecipes(Collection<NamespacedKey> recipes) {
return getHandle().undiscoverRecipes(bukkitKeysToMinecraftRecipes(recipes));
return getHandle().resetRecipes(bukkitKeysToMinecraftRecipes(recipes));
}
@Override
@@ -526,10 +526,10 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
private Collection<IRecipe<?>> bukkitKeysToMinecraftRecipes(Collection<NamespacedKey> recipeKeys) {
Collection<IRecipe<?>> recipes = new ArrayList<>();
CraftingManager manager = getHandle().level.getMinecraftServer().getCraftingManager();
CraftingManager manager = getHandle().level.getServer().getRecipeManager();
for (NamespacedKey recipeKey : recipeKeys) {
Optional<? extends IRecipe<?>> recipe = manager.getRecipe(CraftNamespacedKey.toMinecraft(recipeKey));
Optional<? extends IRecipe<?>> recipe = manager.byKey(CraftNamespacedKey.toMinecraft(recipeKey));
if (!recipe.isPresent()) {
continue;
}
@@ -543,7 +543,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public org.bukkit.entity.Entity getShoulderEntityLeft() {
if (!getHandle().getShoulderEntityLeft().isEmpty()) {
Optional<Entity> shoulder = EntityTypes.a(getHandle().getShoulderEntityLeft(), getHandle().level);
Optional<Entity> shoulder = EntityTypes.create(getHandle().getShoulderEntityLeft(), getHandle().level);
return (!shoulder.isPresent()) ? null : shoulder.get().getBukkitEntity();
}
@@ -562,7 +562,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public org.bukkit.entity.Entity getShoulderEntityRight() {
if (!getHandle().getShoulderEntityRight().isEmpty()) {
Optional<Entity> shoulder = EntityTypes.a(getHandle().getShoulderEntityRight(), getHandle().level);
Optional<Entity> shoulder = EntityTypes.create(getHandle().getShoulderEntityRight(), getHandle().level);
return (!shoulder.isPresent()) ? null : shoulder.get().getBukkitEntity();
}
@@ -581,7 +581,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public boolean dropItem(boolean dropAll) {
if (!(getHandle() instanceof EntityPlayer)) return false;
return ((EntityPlayer) getHandle()).dropItem(dropAll);
return ((EntityPlayer) getHandle()).drop(dropAll);
}
@Override

View File

@@ -23,12 +23,12 @@ public class CraftItem extends CraftEntity implements Item {
@Override
public ItemStack getItemStack() {
return CraftItemStack.asCraftMirror(item.getItemStack());
return CraftItemStack.asCraftMirror(item.getItem());
}
@Override
public void setItemStack(ItemStack stack) {
item.setItemStack(CraftItemStack.asNMSCopy(stack));
item.setItem(CraftItemStack.asNMSCopy(stack));
}
@Override

View File

@@ -44,13 +44,13 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
super.update();
// mark dirty, so that the client gets updated with item and rotation
for (DataWatcher.Item<?> dataItem : getHandle().getDataWatcher().getAll()) {
getHandle().getDataWatcher().markDirty(dataItem.a());
for (DataWatcher.Item<?> dataItem : getHandle().getEntityData().getAll()) {
getHandle().getEntityData().markDirty(dataItem.getAccessor());
}
// update redstone
if (!getHandle().generation) {
getHandle().getWorld().updateAdjacentComparators(getHandle().pos, Blocks.AIR);
getHandle().getLevel().updateNeighbourForOutputSignal(getHandle().pos, Blocks.AIR);
}
}

View File

@@ -116,7 +116,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
// during world generation, we don't want to run logic for dropping items and xp
if (getHandle().generation && health == 0) {
getHandle().die();
getHandle().discard();
return;
}
@@ -129,14 +129,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public double getAbsorptionAmount() {
return getHandle().getAbsorptionHearts();
return getHandle().getAbsorptionAmount();
}
@Override
public void setAbsorptionAmount(double amount) {
Preconditions.checkArgument(amount >= 0 && Double.isFinite(amount), "amount < 0 or non-finite");
getHandle().setAbsorptionHearts((float) amount);
getHandle().setAbsorptionAmount((float) amount);
}
@Override
@@ -148,7 +148,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setMaxHealth(double amount) {
Validate.isTrue(amount > 0, "Max health must be greater than 0");
getHandle().getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(amount);
getHandle().getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(amount);
if (getHealth() > amount) {
setHealth(amount);
@@ -157,12 +157,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public void resetMaxHealth() {
setMaxHealth(getHandle().getAttributeInstance(GenericAttributes.MAX_HEALTH).getAttribute().getDefault());
setMaxHealth(getHandle().getAttribute(GenericAttributes.MAX_HEALTH).getAttribute().getDefaultValue());
}
@Override
public double getEyeHeight() {
return getHandle().getHeadHeight();
return getHandle().getEyeHeight();
}
@Override
@@ -238,12 +238,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public int getRemainingAir() {
return getHandle().getAirTicks();
return getHandle().getAirSupply();
}
@Override
public void setRemainingAir(int ticks) {
getHandle().setAirTicks(ticks);
getHandle().setAirSupply(ticks);
}
@Override
@@ -274,7 +274,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public void setArrowsInBody(int count) {
Preconditions.checkArgument(count >= 0, "New arrow amount must be >= 0");
getHandle().getDataWatcher().set(EntityLiving.DATA_ARROW_COUNT_ID, count);
getHandle().getEntityData().set(EntityLiving.DATA_ARROW_COUNT_ID, count);
}
@Override
@@ -294,7 +294,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
reason = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle());
}
entity.damageEntity(reason, (float) amount);
entity.hurt(reason, (float) amount);
}
@Override
@@ -360,7 +360,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean addPotionEffect(PotionEffect effect, boolean force) {
getHandle().addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
getHandle().addEffect(new MobEffect(MobEffectList.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
return true;
}
@@ -375,25 +375,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean hasPotionEffect(PotionEffectType type) {
return getHandle().hasEffect(MobEffectList.fromId(type.getId()));
return getHandle().hasEffect(MobEffectList.byId(type.getId()));
}
@Override
public PotionEffect getPotionEffect(PotionEffectType type) {
MobEffect handle = getHandle().getEffect(MobEffectList.fromId(type.getId()));
return (handle == null) ? null : new PotionEffect(PotionEffectType.getById(MobEffectList.getId(handle.getMobEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isShowParticles());
MobEffect handle = getHandle().getEffect(MobEffectList.byId(type.getId()));
return (handle == null) ? null : new PotionEffect(PotionEffectType.getById(MobEffectList.getId(handle.getEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible());
}
@Override
public void removePotionEffect(PotionEffectType type) {
getHandle().removeEffect(MobEffectList.fromId(type.getId()), EntityPotionEffectEvent.Cause.PLUGIN);
getHandle().removeEffect(MobEffectList.byId(type.getId()), EntityPotionEffectEvent.Cause.PLUGIN);
}
@Override
public Collection<PotionEffect> getActivePotionEffects() {
List<PotionEffect> effects = new ArrayList<PotionEffect>();
for (MobEffect handle : getHandle().activeEffects.values()) {
effects.add(new PotionEffect(PotionEffectType.getById(MobEffectList.getId(handle.getMobEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isShowParticles()));
effects.add(new PotionEffect(PotionEffectType.getById(MobEffectList.getId(handle.getEffect())), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible()));
}
return effects;
}
@@ -413,17 +413,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
if (Snowball.class.isAssignableFrom(projectile)) {
launch = new EntitySnowball(world, getHandle());
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemSnowball
((EntityProjectile) launch).shootFromRotation(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemSnowball
} else if (Egg.class.isAssignableFrom(projectile)) {
launch = new EntityEgg(world, getHandle());
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemEgg
((EntityProjectile) launch).shootFromRotation(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemEgg
} else if (EnderPearl.class.isAssignableFrom(projectile)) {
launch = new EntityEnderPearl(world, getHandle());
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemEnderPearl
((EntityProjectile) launch).shootFromRotation(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 1.5F, 1.0F); // ItemEnderPearl
} else if (AbstractArrow.class.isAssignableFrom(projectile)) {
if (TippedArrow.class.isAssignableFrom(projectile)) {
launch = new EntityTippedArrow(world, getHandle());
((EntityTippedArrow) launch).setType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
((EntityTippedArrow) launch).setPotionType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
} else if (SpectralArrow.class.isAssignableFrom(projectile)) {
launch = new EntitySpectralArrow(world, getHandle());
} else if (Trident.class.isAssignableFrom(projectile)) {
@@ -431,7 +431,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} else {
launch = new EntityTippedArrow(world, getHandle());
}
((EntityArrow) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 3.0F, 1.0F); // ItemBow
((EntityArrow) launch).shootFromRotation(getHandle(), getHandle().getXRot(), getHandle().getYRot(), 0.0F, 3.0F, 1.0F); // ItemBow
} else if (ThrownPotion.class.isAssignableFrom(projectile)) {
if (LingeringPotion.class.isAssignableFrom(projectile)) {
launch = new EntityPotion(world, getHandle());
@@ -440,10 +440,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
launch = new EntityPotion(world, getHandle());
((EntityPotion) launch).setItem(CraftItemStack.asNMSCopy(new ItemStack(org.bukkit.Material.SPLASH_POTION, 1)));
}
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), -20.0F, 0.5F, 1.0F); // ItemSplashPotion
((EntityProjectile) launch).shootFromRotation(getHandle(), getHandle().getXRot(), getHandle().getYRot(), -20.0F, 0.5F, 1.0F); // ItemSplashPotion
} else if (ThrownExpBottle.class.isAssignableFrom(projectile)) {
launch = new EntityThrownExpBottle(world, getHandle());
((EntityProjectile) launch).a(getHandle(), getHandle().getXRot(), getHandle().getYRot(), -20.0F, 0.7F, 1.0F); // ItemExpBottle
((EntityProjectile) launch).shootFromRotation(getHandle(), getHandle().getXRot(), getHandle().getYRot(), -20.0F, 0.7F, 1.0F); // ItemExpBottle
} else if (FishHook.class.isAssignableFrom(projectile) && getHandle() instanceof EntityHuman) {
launch = new EntityFishingHook((EntityHuman) getHandle(), world, 0, 0);
} else if (Fireball.class.isAssignableFrom(projectile)) {
@@ -461,26 +461,26 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
((EntityFireball) launch).projectileSource = this;
launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
launch.moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
} else if (LlamaSpit.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
Vector direction = location.getDirection();
launch = EntityTypes.LLAMA_SPIT.a(world);
launch = EntityTypes.LLAMA_SPIT.create(world);
((EntityLlamaSpit) launch).setShooter(getHandle());
((EntityLlamaSpit) launch).setOwner(getHandle());
((EntityLlamaSpit) launch).shoot(direction.getX(), direction.getY(), direction.getZ(), 1.5F, 10.0F); // EntityLlama
launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
launch.moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
} else if (ShulkerBullet.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
launch = new EntityShulkerBullet(world, getHandle(), null, null);
launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
launch.moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
} else if (Firework.class.isAssignableFrom(projectile)) {
Location location = getEyeLocation();
launch = new EntityFireworks(world, net.minecraft.world.item.ItemStack.EMPTY, getHandle());
launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
launch.moveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
Validate.notNull(launch, "Projectile not supported");
@@ -489,7 +489,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
((T) launch.getBukkitEntity()).setVelocity(velocity);
}
world.addEntity(launch);
world.addFreshEntity(launch);
return (T) launch.getBukkitEntity();
}
@@ -507,7 +507,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean getRemoveWhenFarAway() {
return getHandle() instanceof EntityInsentient && !((EntityInsentient) getHandle()).isPersistent();
return getHandle() instanceof EntityInsentient && !((EntityInsentient) getHandle()).isPersistenceRequired();
}
@Override
@@ -525,7 +525,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public void setCanPickupItems(boolean pickup) {
if (getHandle() instanceof EntityInsentient) {
((EntityInsentient) getHandle()).setCanPickupLoot(pickup);
((EntityInsentient) getHandle()).setCanPickUpLoot(pickup);
} else {
getHandle().bukkitPickUpLoot = pickup;
}
@@ -534,7 +534,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean getCanPickupItems() {
if (getHandle() instanceof EntityInsentient) {
return ((EntityInsentient) getHandle()).canPickupLoot();
return ((EntityInsentient) getHandle()).canPickUpLoot();
} else {
return getHandle().bukkitPickUpLoot;
}
@@ -569,7 +569,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
if (!isLeashed()) {
return false;
}
((EntityInsentient) getHandle()).unleash(true, false);
((EntityInsentient) getHandle()).dropLeash(true, false);
return true;
}
@@ -588,18 +588,18 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
unleash();
((EntityInsentient) getHandle()).setLeashHolder(((CraftEntity) holder).getHandle(), true);
((EntityInsentient) getHandle()).setLeashedTo(((CraftEntity) holder).getHandle(), true);
return true;
}
@Override
public boolean isGliding() {
return getHandle().getFlag(7);
return getHandle().getSharedFlag(7);
}
@Override
public void setGliding(boolean gliding) {
getHandle().setFlag(7, gliding);
getHandle().setSharedFlag(7, gliding);
}
@Override
@@ -614,7 +614,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean isRiptiding() {
return getHandle().isRiptiding();
return getHandle().isAutoSpinAttack();
}
@Override
@@ -626,7 +626,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public boolean isClimbing() {
Preconditions.checkState(!getHandle().generation, "Cannot check if climbing during world generation");
return getHandle().isClimbing();
return getHandle().onClimbable();
}
@Override
@@ -637,13 +637,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public void setAI(boolean ai) {
if (this.getHandle() instanceof EntityInsentient) {
((EntityInsentient) this.getHandle()).setNoAI(!ai);
((EntityInsentient) this.getHandle()).setNoAi(!ai);
}
}
@Override
public boolean hasAI() {
return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).isNoAI() : false;
return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).isNoAi() : false;
}
@Override
@@ -654,7 +654,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
if (getHandle() instanceof EntityHuman) {
((EntityHuman) getHandle()).attack(((CraftEntity) target).getHandle());
} else {
getHandle().attackEntity(((CraftEntity) target).getHandle());
getHandle().doHurtTarget(((CraftEntity) target).getHandle());
}
}
@@ -662,14 +662,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void swingMainHand() {
Preconditions.checkState(!getHandle().generation, "Cannot swing hand during world generation");
getHandle().swingHand(EnumHand.MAIN_HAND, true);
getHandle().swing(EnumHand.MAIN_HAND, true);
}
@Override
public void swingOffHand() {
Preconditions.checkState(!getHandle().generation, "Cannot swing hand during world generation");
getHandle().swingHand(EnumHand.OFF_HAND, true);
getHandle().swing(EnumHand.OFF_HAND, true);
}
@Override
@@ -689,17 +689,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public <T> T getMemory(MemoryKey<T> memoryKey) {
return (T) getHandle().getBehaviorController().getMemory(CraftMemoryKey.fromMemoryKey(memoryKey)).map(CraftMemoryMapper::fromNms).orElse(null);
return (T) getHandle().getBrain().getMemory(CraftMemoryKey.fromMemoryKey(memoryKey)).map(CraftMemoryMapper::fromNms).orElse(null);
}
@Override
public <T> void setMemory(MemoryKey<T> memoryKey, T t) {
getHandle().getBehaviorController().setMemory(CraftMemoryKey.fromMemoryKey(memoryKey), CraftMemoryMapper.toNms(t));
getHandle().getBrain().setMemory(CraftMemoryKey.fromMemoryKey(memoryKey), CraftMemoryMapper.toNms(t));
}
@Override
public EntityCategory getCategory() {
EnumMonsterType type = getHandle().getMonsterType(); // Not actually an enum?
EnumMonsterType type = getHandle().getMobType(); // Not actually an enum?
if (type == EnumMonsterType.UNDEFINED) {
return EntityCategory.NONE;
@@ -724,6 +724,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public void setInvisible(boolean invisible) {
getHandle().persistentInvisibility = invisible;
getHandle().setFlag(5, invisible);
getHandle().setSharedFlag(5, invisible);
}
}

View File

@@ -48,7 +48,7 @@ public class CraftLlama extends CraftChestedHorse implements Llama {
Preconditions.checkArgument(1 <= strength && strength <= 5, "strength must be [1,5]");
if (strength == getStrength()) return;
getHandle().setStrength(strength);
getHandle().loadChest();
getHandle().createInventory();
}
@Override

View File

@@ -29,11 +29,11 @@ public class CraftLlamaSpit extends AbstractProjectile implements LlamaSpit {
@Override
public ProjectileSource getShooter() {
return (getHandle().getShooter() != null) ? (ProjectileSource) getHandle().getShooter().getBukkitEntity() : null;
return (getHandle().getOwner() != null) ? (ProjectileSource) getHandle().getOwner().getBukkitEntity() : null;
}
@Override
public void setShooter(ProjectileSource source) {
getHandle().setShooter((source != null) ? ((CraftLivingEntity) source).getHandle() : null);
getHandle().setOwner((source != null) ? ((CraftLivingEntity) source).getHandle() : null);
}
}

View File

@@ -77,11 +77,11 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
public void setDisplayBlock(MaterialData material) {
if (material != null) {
IBlockData block = CraftMagicNumbers.getBlock(material);
this.getHandle().setDisplayBlock(block);
this.getHandle().setDisplayBlockState(block);
} else {
// Set block to air (default) and set the flag to not have a display block.
this.getHandle().setDisplayBlock(Blocks.AIR.getBlockData());
this.getHandle().a(false);
this.getHandle().setDisplayBlockState(Blocks.AIR.defaultBlockState());
this.getHandle().setCustomDisplay(false);
}
}
@@ -89,33 +89,33 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart {
public void setDisplayBlockData(BlockData blockData) {
if (blockData != null) {
IBlockData block = ((CraftBlockData) blockData).getState();
this.getHandle().setDisplayBlock(block);
this.getHandle().setDisplayBlockState(block);
} else {
// Set block to air (default) and set the flag to not have a display block.
this.getHandle().setDisplayBlock(Blocks.AIR.getBlockData());
this.getHandle().a(false);
this.getHandle().setDisplayBlockState(Blocks.AIR.defaultBlockState());
this.getHandle().setCustomDisplay(false);
}
}
@Override
public MaterialData getDisplayBlock() {
IBlockData blockData = getHandle().getDisplayBlock();
IBlockData blockData = getHandle().getDisplayBlockState();
return CraftMagicNumbers.getMaterial(blockData);
}
@Override
public BlockData getDisplayBlockData() {
IBlockData blockData = getHandle().getDisplayBlock();
IBlockData blockData = getHandle().getDisplayBlockState();
return CraftBlockData.fromData(blockData);
}
@Override
public void setDisplayBlockOffset(int offset) {
getHandle().setDisplayBlockOffset(offset);
getHandle().setDisplayOffset(offset);
}
@Override
public int getDisplayBlockOffset() {
return getHandle().getDisplayBlockOffset();
return getHandle().getDisplayOffset();
}
}

View File

@@ -34,7 +34,7 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca
@Override
public void setCommand(String command) {
getHandle().getCommandBlock().setCommand(command != null ? command : "");
getHandle().getDataWatcher().set(EntityMinecartCommandBlock.DATA_ID_COMMAND_NAME, getHandle().getCommandBlock().getCommand());
getHandle().getEntityData().set(EntityMinecartCommandBlock.DATA_ID_COMMAND_NAME, getHandle().getCommandBlock().getCommand());
}
@Override

View File

@@ -21,17 +21,17 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
EntityInsentient entity = getHandle();
if (target == null) {
entity.setGoalTarget(null, null, false);
entity.setTarget(null, null, false);
} else if (target instanceof CraftLivingEntity) {
entity.setGoalTarget(((CraftLivingEntity) target).getHandle(), null, false);
entity.setTarget(((CraftLivingEntity) target).getHandle(), null, false);
}
}
@Override
public CraftLivingEntity getTarget() {
if (getHandle().getGoalTarget() == null) return null;
if (getHandle().getTarget() == null) return null;
return (CraftLivingEntity) getHandle().getGoalTarget().getBukkitEntity();
return (CraftLivingEntity) getHandle().getTarget().getBukkitEntity();
}
@Override

View File

@@ -19,14 +19,14 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow {
@Override
public Variant getVariant() {
return Variant.values()[getHandle().getVariant().ordinal()];
return Variant.values()[getHandle().getMushroomType().ordinal()];
}
@Override
public void setVariant(Variant variant) {
Preconditions.checkArgument(variant != null, "variant");
getHandle().setVariant(EntityMushroomCow.Type.values()[variant.ordinal()]);
getHandle().setMushroomType(EntityMushroomCow.Type.values()[variant.ordinal()]);
}
@Override

View File

@@ -18,12 +18,12 @@ public class CraftPhantom extends CraftFlying implements Phantom {
@Override
public int getSize() {
return getHandle().getSize();
return getHandle().getPhantomSize();
}
@Override
public void setSize(int sz) {
getHandle().setSize(sz);
getHandle().setPhantomSize(sz);
}
@Override

View File

@@ -15,7 +15,7 @@ public class CraftPig extends CraftAnimals implements Pig {
@Override
public boolean hasSaddle() {
return getHandle().hasSaddle();
return getHandle().isSaddled();
}
@Override

View File

@@ -13,12 +13,12 @@ public class CraftPigZombie extends CraftZombie implements PigZombie {
@Override
public int getAnger() {
return getHandle().getAnger();
return getHandle().getRemainingPersistentAngerTime();
}
@Override
public void setAnger(int level) {
getHandle().setAnger(level);
getHandle().setRemainingPersistentAngerTime(level);
}
@Override

View File

@@ -149,7 +149,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public GameProfile getProfile() {
return getHandle().getProfile();
return getHandle().getGameProfile();
}
@Override
@@ -162,9 +162,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (value == isOp()) return;
if (value) {
server.getHandle().addOp(getProfile());
server.getHandle().op(getProfile());
} else {
server.getHandle().removeOp(getProfile());
server.getHandle().deop(getProfile());
}
perm.recalculatePermissions();
@@ -179,7 +179,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public InetSocketAddress getAddress() {
if (getHandle().connection == null) return null;
SocketAddress addr = getHandle().connection.connection.getSocketAddress();
SocketAddress addr = getHandle().connection.connection.getRemoteAddress();
if (addr instanceof InetSocketAddress) {
return (InetSocketAddress) addr;
} else {
@@ -201,7 +201,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (getHandle().connection == null) return;
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
getHandle().connection.sendPacket(new PacketPlayOutChat(component, ChatMessageType.SYSTEM, SystemUtils.NIL_UUID));
getHandle().connection.send(new PacketPlayOutChat(component, ChatMessageType.SYSTEM, SystemUtils.NIL_UUID));
}
}
@@ -210,7 +210,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (getHandle().connection == null) return;
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
getHandle().connection.sendPacket(new PacketPlayOutChat(component, ChatMessageType.CHAT, (sender == null) ? SystemUtils.NIL_UUID : sender));
getHandle().connection.send(new PacketPlayOutChat(component, ChatMessageType.CHAT, (sender == null) ? SystemUtils.NIL_UUID : sender));
}
}
@@ -265,7 +265,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().listName = name.equals(getName()) ? null : CraftChatMessage.fromStringOrNull(name);
for (EntityPlayer player : (List<EntityPlayer>) server.getHandle().players) {
if (player.getBukkitEntity().canSee(this)) {
player.connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME, getHandle()));
player.connection.send(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_DISPLAY_NAME, getHandle()));
}
}
}
@@ -306,7 +306,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (getHandle().connection == null) return;
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter((this.playerListHeader == null) ? new ChatComponentText("") : this.playerListHeader, (this.playerListFooter == null) ? new ChatComponentText("") : this.playerListFooter);
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
@Override
@@ -341,7 +341,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (getHandle().connection == null) return;
// Do not directly assign here, from the packethandler we'll assign it.
getHandle().connection.sendPacket(new PacketPlayOutSpawnPosition(new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), loc.getYaw()));
getHandle().connection.send(new PacketPlayOutSpawnPosition(new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), loc.getYaw()));
}
@Override
@@ -400,7 +400,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
float f = (float) Math.pow(2.0D, (note - 12.0D) / 12.0D);
getHandle().connection.sendPacket(new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect("block.note_block." + instrumentName), net.minecraft.sounds.SoundCategory.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f));
getHandle().connection.send(new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect("block.note_block." + instrumentName), net.minecraft.sounds.SoundCategory.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f));
}
@Override
@@ -462,7 +462,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
break;
}
float f = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D);
getHandle().connection.sendPacket(new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect("block.note_block." + instrumentName), net.minecraft.sounds.SoundCategory.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f));
getHandle().connection.send(new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect("block.note_block." + instrumentName), net.minecraft.sounds.SoundCategory.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f));
}
@Override
@@ -480,7 +480,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (loc == null || sound == null || category == null || getHandle().connection == null) return;
PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect(CraftSound.getSoundEffect(sound), net.minecraft.sounds.SoundCategory.valueOf(category.name()), loc.getX(), loc.getY(), loc.getZ(), volume, pitch);
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
@Override
@@ -488,7 +488,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (loc == null || sound == null || category == null || getHandle().connection == null) return;
PacketPlayOutCustomSoundEffect packet = new PacketPlayOutCustomSoundEffect(new MinecraftKey(sound), net.minecraft.sounds.SoundCategory.valueOf(category.name()), new Vec3D(loc.getX(), loc.getY(), loc.getZ()), volume, pitch);
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
@Override
@@ -510,14 +510,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void stopSound(String sound, org.bukkit.SoundCategory category) {
if (getHandle().connection == null) return;
getHandle().connection.sendPacket(new PacketPlayOutStopSound(new MinecraftKey(sound), category == null ? net.minecraft.sounds.SoundCategory.MASTER : net.minecraft.sounds.SoundCategory.valueOf(category.name())));
getHandle().connection.send(new PacketPlayOutStopSound(new MinecraftKey(sound), category == null ? net.minecraft.sounds.SoundCategory.MASTER : net.minecraft.sounds.SoundCategory.valueOf(category.name())));
}
@Override
public void stopAllSounds() {
if (getHandle().connection == null) return;
getHandle().connection.sendPacket(new PacketPlayOutStopSound(null, null));
getHandle().connection.send(new PacketPlayOutStopSound(null, null));
}
@Override
@@ -526,7 +526,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
int packetData = effect.getId();
PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), data, false);
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
@Override
@@ -547,7 +547,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Preconditions.checkArgument(block != null, "Block cannot be null");
Preconditions.checkArgument(block.getWorld().equals(getWorld()), "Cannot break blocks across worlds");
return getHandle().gameMode.breakBlock(new BlockPosition(block.getX(), block.getY(), block.getZ()));
return getHandle().gameMode.destroyBlock(new BlockPosition(block.getX(), block.getY(), block.getZ()));
}
@Override
@@ -555,7 +555,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (getHandle().connection == null) return;
PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), CraftMagicNumbers.getBlock(material, data));
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
@Override
@@ -563,7 +563,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (getHandle().connection == null) return;
PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), ((CraftBlockData) block).getState());
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
@Override
@@ -575,7 +575,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
int stage = (int) (9 * progress); // There are 0 - 9 damage states
PacketPlayOutBlockBreakAnimation packet = new PacketPlayOutBlockBreakAnimation(getHandle().getId(), new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), stage);
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
@Override
@@ -605,14 +605,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
IChatBaseComponent[] components = CraftSign.sanitizeLines(lines);
TileEntitySign sign = new TileEntitySign(new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), Blocks.OAK_SIGN.getBlockData());
sign.setColor(EnumColor.fromColorIndex(dyeColor.getWoolData()));
TileEntitySign sign = new TileEntitySign(new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()), Blocks.OAK_SIGN.defaultBlockState());
sign.setColor(EnumColor.byId(dyeColor.getWoolData()));
sign.setHasGlowingText(hasGlowingText);
for (int i = 0; i < components.length; i++) {
sign.a(i, components[i]);
sign.setMessage(i, components[i]);
}
getHandle().connection.sendPacket(sign.getUpdatePacket());
getHandle().connection.send(sign.getUpdatePacket());
}
@Override
@@ -657,12 +657,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Collection<MapIcon> icons = new ArrayList<MapIcon>();
for (MapCursor cursor : data.cursors) {
if (cursor.isVisible()) {
icons.add(new MapIcon(MapIcon.Type.a(cursor.getRawType()), cursor.getX(), cursor.getY(), cursor.getDirection(), CraftChatMessage.fromStringOrNull(cursor.getCaption())));
icons.add(new MapIcon(MapIcon.Type.byIcon(cursor.getRawType()), cursor.getX(), cursor.getY(), cursor.getDirection(), CraftChatMessage.fromStringOrNull(cursor.getCaption())));
}
}
PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), map.getScale().getValue(), map.isLocked(), icons, new WorldMap.b(0, 0, 128, 128, data.buffer));
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
@Override
@@ -721,26 +721,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Close any foreign inventory
if (getHandle().containerMenu != getHandle().inventoryMenu) {
getHandle().closeInventory();
getHandle().closeContainer();
}
// Check if the fromWorld and toWorld are the same.
if (fromWorld == toWorld) {
entity.connection.teleport(to);
} else {
server.getHandle().moveToWorld(entity, toWorld, true, to, true);
server.getHandle().respawn(entity, toWorld, true, to, true);
}
return true;
}
@Override
public void setSneaking(boolean sneak) {
getHandle().setSneaking(sneak);
getHandle().setShiftKeyDown(sneak);
}
@Override
public boolean isSneaking() {
return getHandle().isSneaking();
return getHandle().isShiftKeyDown();
}
@Override
@@ -766,13 +766,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Deprecated
@Override
public void updateInventory() {
getHandle().containerMenu.updateInventory();
getHandle().containerMenu.sendAllDataToRemote();
}
@Override
public void setSleepingIgnored(boolean isSleeping) {
getHandle().fauxSleeping = isSleeping;
((CraftWorld) getWorld()).getHandle().everyoneSleeping();
((CraftWorld) getWorld()).getHandle().updateSleepingPlayerList();
}
@Override
@@ -782,14 +782,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public Location getBedSpawnLocation() {
WorldServer world = getHandle().server.getWorldServer(getHandle().getSpawnDimension());
BlockPosition bed = getHandle().getSpawn();
WorldServer world = getHandle().server.getLevel(getHandle().getRespawnDimension());
BlockPosition bed = getHandle().getRespawnPosition();
if (world != null && bed != null) {
Optional<Vec3D> spawnLoc = EntityHuman.getBed(world, bed, getHandle().getSpawnAngle(), getHandle().isSpawnForced(), true);
Optional<Vec3D> spawnLoc = EntityHuman.findRespawnPositionAndUseSpawnBlock(world, bed, getHandle().getRespawnAngle(), getHandle().isRespawnForced(), true);
if (spawnLoc.isPresent()) {
Vec3D vec = spawnLoc.get();
return new Location(world.getWorld(), vec.x, vec.y, vec.z, getHandle().getSpawnAngle(), 0);
return new Location(world.getWorld(), vec.x, vec.y, vec.z, getHandle().getRespawnAngle(), 0);
}
}
return null;
@@ -805,7 +805,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (location == null) {
getHandle().setRespawnPosition(null, null, 0.0F, override, false);
} else {
getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().getDimensionKey(), new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), location.getYaw(), override, false);
getHandle().setRespawnPosition(((CraftWorld) location.getWorld()).getHandle().dimension(), new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), location.getYaw(), override, false);
}
}
@@ -813,14 +813,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public Location getBedLocation() {
Preconditions.checkState(isSleeping(), "Not sleeping");
BlockPosition bed = getHandle().getSpawn();
BlockPosition bed = getHandle().getRespawnPosition();
return new Location(getWorld(), bed.getX(), bed.getY(), bed.getZ());
}
@Override
public boolean hasDiscoveredRecipe(NamespacedKey recipe) {
Preconditions.checkArgument(recipe != null, "recipe cannot be null");
return getHandle().getRecipeBook().hasDiscoveredRecipe(CraftNamespacedKey.toMinecraft(recipe));
return getHandle().getRecipeBook().contains(CraftNamespacedKey.toMinecraft(recipe));
}
@Override
@@ -832,92 +832,92 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void incrementStatistic(Statistic statistic) {
CraftStatistic.incrementStatistic(getHandle().getStatisticManager(), statistic);
CraftStatistic.incrementStatistic(getHandle().getStats(), statistic);
}
@Override
public void decrementStatistic(Statistic statistic) {
CraftStatistic.decrementStatistic(getHandle().getStatisticManager(), statistic);
CraftStatistic.decrementStatistic(getHandle().getStats(), statistic);
}
@Override
public int getStatistic(Statistic statistic) {
return CraftStatistic.getStatistic(getHandle().getStatisticManager(), statistic);
return CraftStatistic.getStatistic(getHandle().getStats(), statistic);
}
@Override
public void incrementStatistic(Statistic statistic, int amount) {
CraftStatistic.incrementStatistic(getHandle().getStatisticManager(), statistic, amount);
CraftStatistic.incrementStatistic(getHandle().getStats(), statistic, amount);
}
@Override
public void decrementStatistic(Statistic statistic, int amount) {
CraftStatistic.decrementStatistic(getHandle().getStatisticManager(), statistic, amount);
CraftStatistic.decrementStatistic(getHandle().getStats(), statistic, amount);
}
@Override
public void setStatistic(Statistic statistic, int newValue) {
CraftStatistic.setStatistic(getHandle().getStatisticManager(), statistic, newValue);
CraftStatistic.setStatistic(getHandle().getStats(), statistic, newValue);
}
@Override
public void incrementStatistic(Statistic statistic, Material material) {
CraftStatistic.incrementStatistic(getHandle().getStatisticManager(), statistic, material);
CraftStatistic.incrementStatistic(getHandle().getStats(), statistic, material);
}
@Override
public void decrementStatistic(Statistic statistic, Material material) {
CraftStatistic.decrementStatistic(getHandle().getStatisticManager(), statistic, material);
CraftStatistic.decrementStatistic(getHandle().getStats(), statistic, material);
}
@Override
public int getStatistic(Statistic statistic, Material material) {
return CraftStatistic.getStatistic(getHandle().getStatisticManager(), statistic, material);
return CraftStatistic.getStatistic(getHandle().getStats(), statistic, material);
}
@Override
public void incrementStatistic(Statistic statistic, Material material, int amount) {
CraftStatistic.incrementStatistic(getHandle().getStatisticManager(), statistic, material, amount);
CraftStatistic.incrementStatistic(getHandle().getStats(), statistic, material, amount);
}
@Override
public void decrementStatistic(Statistic statistic, Material material, int amount) {
CraftStatistic.decrementStatistic(getHandle().getStatisticManager(), statistic, material, amount);
CraftStatistic.decrementStatistic(getHandle().getStats(), statistic, material, amount);
}
@Override
public void setStatistic(Statistic statistic, Material material, int newValue) {
CraftStatistic.setStatistic(getHandle().getStatisticManager(), statistic, material, newValue);
CraftStatistic.setStatistic(getHandle().getStats(), statistic, material, newValue);
}
@Override
public void incrementStatistic(Statistic statistic, EntityType entityType) {
CraftStatistic.incrementStatistic(getHandle().getStatisticManager(), statistic, entityType);
CraftStatistic.incrementStatistic(getHandle().getStats(), statistic, entityType);
}
@Override
public void decrementStatistic(Statistic statistic, EntityType entityType) {
CraftStatistic.decrementStatistic(getHandle().getStatisticManager(), statistic, entityType);
CraftStatistic.decrementStatistic(getHandle().getStats(), statistic, entityType);
}
@Override
public int getStatistic(Statistic statistic, EntityType entityType) {
return CraftStatistic.getStatistic(getHandle().getStatisticManager(), statistic, entityType);
return CraftStatistic.getStatistic(getHandle().getStats(), statistic, entityType);
}
@Override
public void incrementStatistic(Statistic statistic, EntityType entityType, int amount) {
CraftStatistic.incrementStatistic(getHandle().getStatisticManager(), statistic, entityType, amount);
CraftStatistic.incrementStatistic(getHandle().getStats(), statistic, entityType, amount);
}
@Override
public void decrementStatistic(Statistic statistic, EntityType entityType, int amount) {
CraftStatistic.decrementStatistic(getHandle().getStatisticManager(), statistic, entityType, amount);
CraftStatistic.decrementStatistic(getHandle().getStats(), statistic, entityType, amount);
}
@Override
public void setStatistic(Statistic statistic, EntityType entityType, int newValue) {
CraftStatistic.setStatistic(getHandle().getStatisticManager(), statistic, entityType, newValue);
CraftStatistic.setStatistic(getHandle().getStats(), statistic, entityType, newValue);
}
@Override
@@ -968,15 +968,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean isWhitelisted() {
return server.getHandle().getWhitelist().isWhitelisted(getProfile());
return server.getHandle().getWhiteList().isWhiteListed(getProfile());
}
@Override
public void setWhitelisted(boolean value) {
if (value) {
server.getHandle().getWhitelist().add(new WhiteListEntry(getProfile()));
server.getHandle().getWhiteList().add(new WhiteListEntry(getProfile()));
} else {
server.getHandle().getWhitelist().remove(getProfile());
server.getHandle().getWhiteList().remove(getProfile());
}
}
@@ -988,22 +988,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
throw new IllegalArgumentException("Mode cannot be null");
}
getHandle().a(EnumGamemode.getById(mode.getValue()));
getHandle().setGameMode(EnumGamemode.byId(mode.getValue()));
}
@Override
public GameMode getGameMode() {
return GameMode.getByValue(getHandle().gameMode.getGameMode().getId());
return GameMode.getByValue(getHandle().gameMode.getGameModeForPlayer().getId());
}
@Override
public void giveExp(int exp) {
getHandle().giveExp(exp);
getHandle().giveExperiencePoints(exp);
}
@Override
public void giveExpLevels(int levels) {
getHandle().levelDown(levels);
getHandle().giveExperienceLevels(levels);
}
@Override
@@ -1056,7 +1056,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
PacketPlayOutExperience packet = new PacketPlayOutExperience(progress, getTotalExperience(), level);
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
@Nullable
@@ -1095,16 +1095,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
hiddenPlayers.put(player.getUniqueId(), hidingPlugins);
// Remove this player from the hidden player's EntityTrackerEntry
PlayerChunkMap tracker = ((WorldServer) entity.level).getChunkProvider().chunkMap;
PlayerChunkMap tracker = ((WorldServer) entity.level).getChunkSource().chunkMap;
EntityPlayer other = ((CraftPlayer) player).getHandle();
PlayerChunkMap.EntityTracker entry = tracker.entityMap.get(other.getId());
if (entry != null) {
entry.clear(getHandle());
entry.removePlayer(getHandle());
}
// Remove the hidden player from this player user list, if they're on it
if (other.sentListPacket) {
getHandle().connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other));
getHandle().connection.send(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other));
}
}
@@ -1137,10 +1137,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
hiddenPlayers.remove(player.getUniqueId());
PlayerChunkMap tracker = ((WorldServer) entity.level).getChunkProvider().chunkMap;
PlayerChunkMap tracker = ((WorldServer) entity.level).getChunkSource().chunkMap;
EntityPlayer other = ((CraftPlayer) player).getHandle();
getHandle().connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
getHandle().connection.send(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
PlayerChunkMap.EntityTracker entry = tracker.entityMap.get(other.getId());
if (entry != null && !entry.seenBy.contains(getHandle())) {
@@ -1214,15 +1214,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void readExtraData(NBTTagCompound nbttagcompound) {
hasPlayedBefore = true;
if (nbttagcompound.hasKey("bukkit")) {
if (nbttagcompound.contains("bukkit")) {
NBTTagCompound data = nbttagcompound.getCompound("bukkit");
if (data.hasKey("firstPlayed")) {
if (data.contains("firstPlayed")) {
firstPlayed = data.getLong("firstPlayed");
lastPlayed = data.getLong("lastPlayed");
}
if (data.hasKey("newExp")) {
if (data.contains("newExp")) {
EntityPlayer handle = getHandle();
handle.newExp = data.getInt("newExp");
handle.newTotalExp = data.getInt("newTotalExp");
@@ -1234,20 +1234,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setExtraData(NBTTagCompound nbttagcompound) {
if (!nbttagcompound.hasKey("bukkit")) {
nbttagcompound.set("bukkit", new NBTTagCompound());
if (!nbttagcompound.contains("bukkit")) {
nbttagcompound.put("bukkit", new NBTTagCompound());
}
NBTTagCompound data = nbttagcompound.getCompound("bukkit");
EntityPlayer handle = getHandle();
data.setInt("newExp", handle.newExp);
data.setInt("newTotalExp", handle.newTotalExp);
data.setInt("newLevel", handle.newLevel);
data.setInt("expToDrop", handle.expToDrop);
data.setBoolean("keepLevel", handle.keepLevel);
data.setLong("firstPlayed", getFirstPlayed());
data.setLong("lastPlayed", System.currentTimeMillis());
data.setString("lastKnownName", handle.getName());
data.putInt("newExp", handle.newExp);
data.putInt("newTotalExp", handle.newTotalExp);
data.putInt("newLevel", handle.newLevel);
data.putInt("expToDrop", handle.expToDrop);
data.putBoolean("keepLevel", handle.keepLevel);
data.putLong("firstPlayed", getFirstPlayed());
data.putLong("lastPlayed", System.currentTimeMillis());
data.putString("lastKnownName", handle.getScoreboardName());
}
@Override
@@ -1283,7 +1283,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (channels.contains(channel)) {
channel = StandardMessenger.validateAndCorrectChannel(channel);
PacketPlayOutCustomPayload packet = new PacketPlayOutCustomPayload(new MinecraftKey(channel), new PacketDataSerializer(Unpooled.wrappedBuffer(message)));
getHandle().connection.sendPacket(packet);
getHandle().connection.send(packet);
}
}
@@ -1296,7 +1296,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setResourcePack(String url) {
Validate.notNull(url, "Resource pack URL cannot be null");
getHandle().setResourcePack(url, "null", false, null);
getHandle().sendTexturePack(url, "null", false, null);
}
@Override
@@ -1305,7 +1305,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Validate.notNull(hash, "Resource pack hash cannot be null");
Validate.isTrue(hash.length == 20, "Resource pack hash should be 20 bytes long but was " + hash.length);
getHandle().setResourcePack(url, BaseEncoding.base16().lowerCase().encode(hash), false, null);
getHandle().sendTexturePack(url, BaseEncoding.base16().lowerCase().encode(hash), false, null);
}
public void addChannel(String channel) {
@@ -1344,7 +1344,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}
getHandle().connection.sendPacket(new PacketPlayOutCustomPayload(new MinecraftKey("register"), new PacketDataSerializer(Unpooled.wrappedBuffer(stream.toByteArray()))));
getHandle().connection.send(new PacketPlayOutCustomPayload(new MinecraftKey("register"), new PacketDataSerializer(Unpooled.wrappedBuffer(stream.toByteArray()))));
}
}
@@ -1379,7 +1379,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (container.getBukkitView().getType() != prop.getType()) {
return false;
}
container.setContainerData(prop.getId(), value);
container.setData(prop.getId(), value);
return true;
}
@@ -1400,7 +1400,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
getHandle().getAbilities().flying = value;
getHandle().updateAbilities();
getHandle().onUpdateAbilities();
}
@Override
@@ -1415,7 +1415,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
getHandle().getAbilities().mayfly = value;
getHandle().updateAbilities();
getHandle().onUpdateAbilities();
}
@Override
@@ -1438,7 +1438,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
validateSpeed(value);
EntityPlayer player = getHandle();
player.getAbilities().flyingSpeed = value / 2f;
player.updateAbilities();
player.onUpdateAbilities();
}
@@ -1447,8 +1447,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
validateSpeed(value);
EntityPlayer player = getHandle();
player.getAbilities().walkingSpeed = value / 2f;
player.updateAbilities();
getHandle().getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(player.getAbilities().walkingSpeed); // SPIGOT-5833: combination of the two in 1.16+
player.onUpdateAbilities();
getHandle().getAttribute(GenericAttributes.MOVEMENT_SPEED).setBaseValue(player.getAbilities().walkingSpeed); // SPIGOT-5833: combination of the two in 1.16+
}
@Override
@@ -1477,13 +1477,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setMaxHealth(double amount) {
super.setMaxHealth(amount);
this.health = Math.min(this.health, health);
getHandle().triggerHealthUpdate();
getHandle().resetSentInfo();
}
@Override
public void resetMaxHealth() {
super.resetMaxHealth();
getHandle().triggerHealthUpdate();
getHandle().resetSentInfo();
}
@Override
@@ -1548,25 +1548,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void updateScaledHealth(boolean sendHealth) {
AttributeMapBase attributemapserver = getHandle().getAttributeMap();
Collection<AttributeModifiable> set = attributemapserver.b(); // PAIL: Rename
AttributeMapBase attributemapserver = getHandle().getAttributes();
Collection<AttributeModifiable> set = attributemapserver.getSyncableAttributes();
injectScaledMaxHealth(set, true);
// SPIGOT-3813: Attributes before health
if (getHandle().connection != null) {
getHandle().connection.sendPacket(new PacketPlayOutUpdateAttributes(getHandle().getId(), set));
getHandle().connection.send(new PacketPlayOutUpdateAttributes(getHandle().getId(), set));
if (sendHealth) {
sendHealthUpdate();
}
}
getHandle().getDataWatcher().set(EntityLiving.DATA_HEALTH_ID, (float) getScaledHealth());
getHandle().getEntityData().set(EntityLiving.DATA_HEALTH_ID, (float) getScaledHealth());
getHandle().maxHealthCache = getMaxHealth();
}
public void sendHealthUpdate() {
getHandle().connection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel()));
getHandle().connection.send(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().getFoodLevel(), getHandle().getFoodData().getSaturationLevel()));
}
public void injectScaledMaxHealth(Collection<AttributeModifiable> collection, boolean force) {
@@ -1580,20 +1580,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}
AttributeModifiable dummy = new AttributeModifiable(GenericAttributes.MAX_HEALTH, (attribute) -> { });
dummy.setValue(scaledHealth ? healthScale : getMaxHealth());
dummy.setBaseValue(scaledHealth ? healthScale : getMaxHealth());
collection.add(dummy);
}
@Override
public org.bukkit.entity.Entity getSpectatorTarget() {
Entity followed = getHandle().getSpecatorTarget();
Entity followed = getHandle().getCamera();
return followed == getHandle() ? null : followed.getBukkitEntity();
}
@Override
public void setSpectatorTarget(org.bukkit.entity.Entity entity) {
Preconditions.checkArgument(getGameMode() == GameMode.SPECTATOR, "Player must be in spectator mode");
getHandle().setSpectatorTarget((entity == null) ? null : ((CraftEntity) entity).getHandle());
getHandle().setCamera((entity == null) ? null : ((CraftEntity) entity).getHandle());
}
@Override
@@ -1604,23 +1604,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
ClientboundSetTitlesAnimationPacket times = new ClientboundSetTitlesAnimationPacket(fadeIn, stay, fadeOut);
getHandle().connection.sendPacket(times);
getHandle().connection.send(times);
if (title != null) {
ClientboundSetTitleTextPacket packetTitle = new ClientboundSetTitleTextPacket(CraftChatMessage.fromStringOrNull(title));
getHandle().connection.sendPacket(packetTitle);
getHandle().connection.send(packetTitle);
}
if (subtitle != null) {
ClientboundSetSubtitleTextPacket packetSubtitle = new ClientboundSetSubtitleTextPacket(CraftChatMessage.fromStringOrNull(subtitle));
getHandle().connection.sendPacket(packetSubtitle);
getHandle().connection.send(packetSubtitle);
}
}
@Override
public void resetTitle() {
ClientboundClearTitlesPacket packetReset = new ClientboundClearTitlesPacket(true);
getHandle().connection.sendPacket(packetReset);
getHandle().connection.send(packetReset);
}
@Override
@@ -1684,7 +1684,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass());
}
PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(CraftParticle.toNMS(particle, data), true, (float) x, (float) y, (float) z, (float) offsetX, (float) offsetY, (float) offsetZ, (float) extra, count);
getHandle().connection.sendPacket(packetplayoutworldparticles);
getHandle().connection.send(packetplayoutworldparticles);
}
@@ -1693,8 +1693,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
Preconditions.checkArgument(advancement != null, "advancement");
CraftAdvancement craft = (CraftAdvancement) advancement;
AdvancementDataPlayer data = getHandle().getAdvancementData();
AdvancementProgress progress = data.getProgress(craft.getHandle());
AdvancementDataPlayer data = getHandle().getAdvancements();
AdvancementProgress progress = data.getOrStartProgress(craft.getHandle());
return new CraftAdvancementProgress(craft, data, progress);
}
@@ -1718,7 +1718,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void updateCommands() {
if (getHandle().connection == null) return;
getHandle().server.getCommandDispatcher().a(getHandle());
getHandle().server.getCommands().sendCommands(getHandle());
}
@Override
@@ -1728,7 +1728,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
ItemStack hand = getInventory().getItemInMainHand();
getInventory().setItemInMainHand(book);
getHandle().openBook(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(book), net.minecraft.world.EnumHand.MAIN_HAND);
getHandle().openItemGui(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(book), net.minecraft.world.EnumHand.MAIN_HAND);
getInventory().setItemInMainHand(hand);
}
}

View File

@@ -19,9 +19,9 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj
@Override
public void setShooter(ProjectileSource shooter) {
if (shooter instanceof CraftLivingEntity) {
getHandle().setShooter((EntityLiving) ((CraftLivingEntity) shooter).entity);
getHandle().setOwner((EntityLiving) ((CraftLivingEntity) shooter).entity);
} else {
getHandle().setShooter(null);
getHandle().setOwner(null);
}
getHandle().projectileSource = shooter;
}

View File

@@ -42,9 +42,9 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
if (getRabbitType() == Type.THE_KILLER_BUNNY) {
// Reset goals and target finders.
World world = ((CraftWorld) this.getWorld()).getHandle();
entity.goalSelector = new PathfinderGoalSelector(world.getMethodProfilerSupplier());
entity.targetSelector = new PathfinderGoalSelector(world.getMethodProfilerSupplier());
entity.initPathfinder();
entity.goalSelector = new PathfinderGoalSelector(world.getProfilerSupplier());
entity.targetSelector = new PathfinderGoalSelector(world.getProfilerSupplier());
entity.registerGoals();
entity.initializePathFinderGoals();
}

View File

@@ -52,7 +52,7 @@ public abstract class CraftRaider extends CraftMonster implements Raider {
@Override
public boolean isCanJoinRaid() {
return getHandle().isCanJoinRaid();
return getHandle().canJoinRaid();
}
@Override

View File

@@ -14,12 +14,12 @@ public class CraftSheep extends CraftAnimals implements Sheep {
@Override
public DyeColor getColor() {
return DyeColor.getByWoolData((byte) getHandle().getColor().getColorIndex());
return DyeColor.getByWoolData((byte) getHandle().getColor().getId());
}
@Override
public void setColor(DyeColor color) {
getHandle().setColor(EnumColor.fromColorIndex(color.getWoolData()));
getHandle().setColor(EnumColor.byId(color.getWoolData()));
}
@Override

View File

@@ -32,23 +32,23 @@ public class CraftShulker extends CraftGolem implements Shulker {
@Override
public DyeColor getColor() {
return DyeColor.getByWoolData(getHandle().getDataWatcher().get(EntityShulker.DATA_COLOR_ID));
return DyeColor.getByWoolData(getHandle().getEntityData().get(EntityShulker.DATA_COLOR_ID));
}
@Override
public void setColor(DyeColor color) {
getHandle().getDataWatcher().set(EntityShulker.DATA_COLOR_ID, (color == null) ? 16 : color.getWoolData());
getHandle().getEntityData().set(EntityShulker.DATA_COLOR_ID, (color == null) ? 16 : color.getWoolData());
}
@Override
public float getPeek() {
return (float) getHandle().getPeek() / 100;
return (float) getHandle().getRawPeekAmount() / 100;
}
@Override
public void setPeek(float value) {
Preconditions.checkArgument(value >= 0 && value <= 1, "value needs to be in between or equal to 0 and 1");
getHandle().setPeek((int) (value * 100));
getHandle().setRawPeekAmount((int) (value * 100));
}
@Override

View File

@@ -22,9 +22,9 @@ public class CraftShulkerBullet extends AbstractProjectile implements ShulkerBul
@Override
public void setShooter(ProjectileSource shooter) {
if (shooter instanceof Entity) {
getHandle().setShooter(((CraftEntity) shooter).getHandle());
getHandle().setOwner(((CraftEntity) shooter).getHandle());
} else {
getHandle().setShooter(null);
getHandle().setOwner(null);
}
getHandle().projectileSource = shooter;
}

View File

@@ -15,10 +15,10 @@ public class CraftSizedFireball extends CraftFireball implements SizedFireball {
@Override
public ItemStack getDisplayItem() {
if (getHandle().getItem().isEmpty()) {
if (getHandle().getItemRaw().isEmpty()) {
return new ItemStack(Material.FIRE_CHARGE);
} else {
return CraftItemStack.asBukkitCopy(getHandle().getItem());
return CraftItemStack.asBukkitCopy(getHandle().getItemRaw());
}
}

View File

@@ -2,7 +2,6 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.world.entity.monster.EntitySkeleton;
import net.minecraft.world.entity.monster.EntitySkeletonAbstract;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Skeleton;
@@ -15,7 +14,7 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton {
@Override
public boolean isConverting() {
return this.getHandle().fw(); // PAIL rename isStrayConverting
return this.getHandle().isFreezeConverting();
}
@Override
@@ -28,9 +27,9 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton {
public void setConversionTime(int time) {
if (time < 0) {
this.getHandle().conversionTime = -1;
this.getHandle().getDataWatcher().set(EntitySkeleton.DATA_STRAY_CONVERSION_ID, false);
this.getHandle().getEntityData().set(EntitySkeleton.DATA_STRAY_CONVERSION_ID, false);
} else {
this.getHandle().a(time); // PAIL rename startStrayConversion
this.getHandle().startFreezeConversion(time);
}
}

View File

@@ -17,7 +17,7 @@ public class CraftSnowman extends CraftGolem implements Snowman {
@Override
public void setDerp(boolean derpMode) {
getHandle().setHasPumpkin(!derpMode);
getHandle().setPumpkin(!derpMode);
}
@Override

View File

@@ -24,14 +24,14 @@ public class CraftSpellcaster extends CraftIllager implements Spellcaster {
@Override
public Spell getSpell() {
return toBukkitSpell(getHandle().getSpell());
return toBukkitSpell(getHandle().getCurrentSpell());
}
@Override
public void setSpell(Spell spell) {
Preconditions.checkArgument(spell != null, "Use Spell.NONE");
getHandle().setSpell(toNMSSpell(spell));
getHandle().setIsCastingSpell(toNMSSpell(spell));
}
public static Spell toBukkitSpell(EntityIllagerWizard.Spell spell) {
@@ -39,6 +39,6 @@ public class CraftSpellcaster extends CraftIllager implements Spellcaster {
}
public static EntityIllagerWizard.Spell toNMSSpell(Spell spell) {
return EntityIllagerWizard.Spell.a(spell.ordinal());
return EntityIllagerWizard.Spell.byId(spell.ordinal());
}
}

View File

@@ -15,17 +15,17 @@ public class CraftStrider extends CraftAnimals implements Strider {
@Override
public boolean isShivering() {
return getHandle().isShivering();
return getHandle().isSuffocating();
}
@Override
public void setShivering(boolean shivering) {
this.getHandle().setShivering(shivering);
this.getHandle().setSuffocating(shivering);
}
@Override
public boolean hasSaddle() {
return getHandle().hasSaddle();
return getHandle().isSaddled();
}
@Override

View File

@@ -36,12 +36,12 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
@Override
public int getFuseTicks() {
return getHandle().getFuseTicks();
return getHandle().getFuse();
}
@Override
public void setFuseTicks(int fuseTicks) {
getHandle().setFuseTicks(fuseTicks);
getHandle().setFuse(fuseTicks);
}
@Override
@@ -61,7 +61,7 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
@Override
public Entity getSource() {
EntityLiving source = getHandle().getSource();
EntityLiving source = getHandle().getOwner();
return (source != null) ? source.getBukkitEntity() : null;
}

View File

@@ -45,14 +45,14 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
@Override
public boolean isTamed() {
return getHandle().isTamed();
return getHandle().isTame();
}
@Override
public void setOwner(AnimalTamer tamer) {
if (tamer != null) {
setTamed(true);
getHandle().setGoalTarget(null, null, false);
getHandle().setTarget(null, null, false);
setOwnerUUID(tamer.getUniqueId());
} else {
setTamed(false);
@@ -62,19 +62,19 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat
@Override
public void setTamed(boolean tame) {
getHandle().setTamed(tame);
getHandle().setTame(tame);
if (!tame) {
setOwnerUUID(null);
}
}
public boolean isSitting() {
return getHandle().isSitting();
return getHandle().isInSittingPose();
}
public void setSitting(boolean sitting) {
getHandle().setSitting(sitting);
getHandle().setWillSit(sitting);
getHandle().setInSittingPose(sitting);
getHandle().setOrderedToSit(sitting);
}
@Override

View File

@@ -14,10 +14,10 @@ public abstract class CraftThrowableProjectile extends CraftProjectile implement
@Override
public ItemStack getItem() {
if (getHandle().getItem().isEmpty()) {
if (getHandle().getItemRaw().isEmpty()) {
return CraftItemStack.asBukkitCopy(new net.minecraft.world.item.ItemStack(getHandle().getDefaultItemPublic()));
} else {
return CraftItemStack.asBukkitCopy(getHandle().getItem());
return CraftItemStack.asBukkitCopy(getHandle().getItemRaw());
}
}

View File

@@ -23,7 +23,7 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
@Override
public Collection<PotionEffect> getEffects() {
ImmutableList.Builder<PotionEffect> builder = ImmutableList.builder();
for (MobEffect effect : PotionUtil.getEffects(getHandle().getItem())) {
for (MobEffect effect : PotionUtil.getMobEffects(getHandle().getItemRaw())) {
builder.add(CraftPotionUtil.toBukkit(effect));
}
return builder.build();
@@ -31,7 +31,7 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
@Override
public ItemStack getItem() {
return CraftItemStack.asBukkitCopy(getHandle().getItem());
return CraftItemStack.asBukkitCopy(getHandle().getItemRaw());
}
@Override

View File

@@ -41,7 +41,7 @@ public class CraftTippedArrow extends CraftArrow implements Arrow {
int effectId = effect.getType().getId();
MobEffect existing = null;
for (MobEffect mobEffect : getHandle().effects) {
if (MobEffectList.getId(mobEffect.getMobEffect()) == effectId) {
if (MobEffectList.getId(mobEffect.getEffect()) == effectId) {
existing = mobEffect;
}
}
@@ -74,7 +74,7 @@ public class CraftTippedArrow extends CraftArrow implements Arrow {
@Override
public boolean hasCustomEffect(PotionEffectType type) {
for (MobEffect effect : getHandle().effects) {
if (CraftPotionUtil.equals(effect.getMobEffect(), type)) {
if (CraftPotionUtil.equals(effect.getEffect(), type)) {
return true;
}
}
@@ -91,7 +91,7 @@ public class CraftTippedArrow extends CraftArrow implements Arrow {
int effectId = effect.getId();
MobEffect existing = null;
for (MobEffect mobEffect : getHandle().effects) {
if (MobEffectList.getId(mobEffect.getMobEffect()) == effectId) {
if (MobEffectList.getId(mobEffect.getEffect()) == effectId) {
existing = mobEffect;
}
}
@@ -106,17 +106,17 @@ public class CraftTippedArrow extends CraftArrow implements Arrow {
@Override
public void setBasePotionData(PotionData data) {
Validate.notNull(data, "PotionData cannot be null");
getHandle().setType(CraftPotionUtil.fromBukkit(data));
getHandle().setPotionType(CraftPotionUtil.fromBukkit(data));
}
@Override
public PotionData getBasePotionData() {
return CraftPotionUtil.toBukkit(getHandle().getType());
return CraftPotionUtil.toBukkit(getHandle().getPotionType());
}
@Override
public void setColor(Color color) {
getHandle().setColor(color.asRGB());
getHandle().setFixedColor(color.asRGB());
}
@Override

View File

@@ -33,6 +33,6 @@ public class CraftVex extends CraftMonster implements Vex {
@Override
public void setCharging(boolean charging) {
getHandle().setCharging(charging);
getHandle().setIsCharging(charging);
}
}

View File

@@ -46,18 +46,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
@Override
public void setProfession(Profession profession) {
Validate.notNull(profession);
getHandle().setVillagerData(getHandle().getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(profession)));
getHandle().setVillagerData(getHandle().getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(profession)));
}
@Override
public Type getVillagerType() {
return Type.valueOf(IRegistry.VILLAGER_TYPE.getKey(getHandle().getVillagerData().getType()).getKey().toUpperCase(Locale.ROOT));
return Type.valueOf(IRegistry.VILLAGER_TYPE.getKey(getHandle().getVillagerData().getType()).getPath().toUpperCase(Locale.ROOT));
}
@Override
public void setVillagerType(Type type) {
Validate.notNull(type);
getHandle().setVillagerData(getHandle().getVillagerData().withType(IRegistry.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))));
getHandle().setVillagerData(getHandle().getVillagerData().setType(IRegistry.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))));
}
@Override
@@ -69,19 +69,19 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
public void setVillagerLevel(int level) {
Preconditions.checkArgument(1 <= level && level <= 5, "level must be between [1, 5]");
getHandle().setVillagerData(getHandle().getVillagerData().withLevel(level));
getHandle().setVillagerData(getHandle().getVillagerData().setLevel(level));
}
@Override
public int getVillagerExperience() {
return getHandle().getExperience();
return getHandle().getVillagerXp();
}
@Override
public void setVillagerExperience(int experience) {
Preconditions.checkArgument(experience >= 0, "Experience must be positive");
getHandle().setExperience(experience);
getHandle().setVillagerXp(experience);
}
@Override
@@ -92,12 +92,12 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
Preconditions.checkState(!getHandle().generation, "Cannot sleep during world generation");
BlockPosition position = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
IBlockData iblockdata = getHandle().level.getType(position);
IBlockData iblockdata = getHandle().level.getBlockState(position);
if (!(iblockdata.getBlock() instanceof BlockBed)) {
return false;
}
getHandle().entitySleep(position);
getHandle().startSleeping(position);
return true;
}
@@ -106,16 +106,16 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
Preconditions.checkState(isSleeping(), "Cannot wakeup if not sleeping");
Preconditions.checkState(!getHandle().generation, "Cannot wakeup during world generation");
getHandle().entityWakeup();
getHandle().stopSleeping();
}
@Override
public void shakeHead() {
getHandle().fT(); // PAIL rename shakeHead
getHandle().setUnhappy();
}
public static Profession nmsToBukkitProfession(VillagerProfession nms) {
return Profession.valueOf(IRegistry.VILLAGER_PROFESSION.getKey(nms).getKey().toUpperCase(Locale.ROOT));
return Profession.valueOf(IRegistry.VILLAGER_PROFESSION.getKey(nms).getPath().toUpperCase(Locale.ROOT));
}
public static VillagerProfession bukkitToNmsProfession(Profession bukkit) {

View File

@@ -39,24 +39,24 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager {
@Override
public Villager.Profession getVillagerProfession() {
return Villager.Profession.valueOf(IRegistry.VILLAGER_PROFESSION.getKey(getHandle().getVillagerData().getProfession()).getKey().toUpperCase(Locale.ROOT));
return Villager.Profession.valueOf(IRegistry.VILLAGER_PROFESSION.getKey(getHandle().getVillagerData().getProfession()).getPath().toUpperCase(Locale.ROOT));
}
@Override
public void setVillagerProfession(Villager.Profession profession) {
Validate.notNull(profession);
getHandle().setVillagerData(getHandle().getVillagerData().withProfession(IRegistry.VILLAGER_PROFESSION.get(new MinecraftKey(profession.name().toLowerCase(Locale.ROOT)))));
getHandle().setVillagerData(getHandle().getVillagerData().setProfession(IRegistry.VILLAGER_PROFESSION.get(new MinecraftKey(profession.name().toLowerCase(Locale.ROOT)))));
}
@Override
public Villager.Type getVillagerType() {
return Villager.Type.valueOf(IRegistry.VILLAGER_TYPE.getKey(getHandle().getVillagerData().getType()).getKey().toUpperCase(Locale.ROOT));
return Villager.Type.valueOf(IRegistry.VILLAGER_TYPE.getKey(getHandle().getVillagerData().getType()).getPath().toUpperCase(Locale.ROOT));
}
@Override
public void setVillagerType(Villager.Type type) {
Validate.notNull(type);
getHandle().setVillagerData(getHandle().getVillagerData().withType(IRegistry.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))));
getHandle().setVillagerData(getHandle().getVillagerData().setType(IRegistry.VILLAGER_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))));
}
@Override
@@ -75,12 +75,12 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager {
public void setConversionTime(int time) {
if (time < 0) {
getHandle().villagerConversionTime = -1;
getHandle().getDataWatcher().set(EntityZombieVillager.DATA_CONVERTING_ID, false);
getHandle().getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, false);
getHandle().setPersistenceRequired(false); // CraftBukkit - SPIGOT-4684 update persistence
getHandle().conversionStarter = null;
getHandle().removeEffect(MobEffects.DAMAGE_BOOST, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
} else {
getHandle().startConversion((UUID) null, time);
getHandle().startConverting((UUID) null, time);
}
}

View File

@@ -12,12 +12,12 @@ public class CraftWitherSkull extends CraftFireball implements WitherSkull {
@Override
public void setCharged(boolean charged) {
getHandle().setCharged(charged);
getHandle().setDangerous(charged);
}
@Override
public boolean isCharged() {
return getHandle().isCharged();
return getHandle().isDangerous();
}
@Override

View File

@@ -20,9 +20,9 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf {
@Override
public void setAngry(boolean angry) {
if (angry) {
getHandle().anger();
getHandle().startPersistentAngerTimer();
} else {
getHandle().pacify();
getHandle().stopBeingAngry();
}
}
@@ -38,11 +38,11 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf {
@Override
public DyeColor getCollarColor() {
return DyeColor.getByWoolData((byte) getHandle().getCollarColor().getColorIndex());
return DyeColor.getByWoolData((byte) getHandle().getCollarColor().getId());
}
@Override
public void setCollarColor(DyeColor color) {
getHandle().setCollarColor(EnumColor.fromColorIndex(color.getWoolData()));
getHandle().setCollarColor(EnumColor.byId(color.getWoolData()));
}
}

View File

@@ -61,7 +61,7 @@ public class CraftZombie extends CraftMonster implements Zombie {
@Override
public boolean isConverting() {
return getHandle().isDrownConverting();
return getHandle().isUnderWaterConverting();
}
@Override
@@ -75,9 +75,9 @@ public class CraftZombie extends CraftMonster implements Zombie {
public void setConversionTime(int time) {
if (time < 0) {
getHandle().conversionTime = -1;
getHandle().getDataWatcher().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, false);
getHandle().getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, false);
} else {
getHandle().startDrownedConversion(time);
getHandle().startUnderWaterConversion(time);
}
}

View File

@@ -47,10 +47,10 @@ public final class CraftMemoryMapper {
}
public static Location fromNms(GlobalPos globalPos) {
return new org.bukkit.Location(((CraftServer) Bukkit.getServer()).getServer().getWorldServer(globalPos.getDimensionManager()).getWorld(), globalPos.getBlockPosition().getX(), globalPos.getBlockPosition().getY(), globalPos.getBlockPosition().getZ());
return new org.bukkit.Location(((CraftServer) Bukkit.getServer()).getServer().getLevel(globalPos.dimension()).getWorld(), globalPos.pos().getX(), globalPos.pos().getY(), globalPos.pos().getZ());
}
public static GlobalPos toNms(Location location) {
return GlobalPos.create(((CraftWorld) location.getWorld()).getHandle().getDimensionKey(), new BlockPosition(location.getX(), location.getY(), location.getZ()));
return GlobalPos.of(((CraftWorld) location.getWorld()).getHandle().dimension(), new BlockPosition(location.getX(), location.getY(), location.getZ()));
}
}