Missing Entity API

== AT ==
public net.minecraft.world.entity.animal.Fox isDefending()Z
public net.minecraft.world.entity.animal.Fox setDefending(Z)V
public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V
public net.minecraft.world.entity.animal.Panda getEatCounter()I
public net.minecraft.world.entity.animal.Panda setEatCounter(I)V
public net.minecraft.world.entity.animal.Bee isRolling()Z
public net.minecraft.world.entity.animal.Bee setRolling(Z)V
public net.minecraft.world.entity.animal.Bee numCropsGrownSincePollination
public net.minecraft.world.entity.animal.Bee ticksWithoutNectarSinceExitingHive
public net.minecraft.world.entity.monster.piglin.Piglin isChargingCrossbow()Z
public net.minecraft.world.entity.ambient.Bat targetPosition
public net.minecraft.world.entity.monster.Ravager attackTick
public net.minecraft.world.entity.monster.Ravager stunnedTick
public net.minecraft.world.entity.monster.Ravager roarTick
public net.minecraft.world.entity.vehicle.MinecartTNT explode(D)V
public net.minecraft.world.entity.vehicle.MinecartTNT fuse
public net.minecraft.world.entity.monster.Endermite life
public net.minecraft.world.entity.projectile.AbstractArrow soundEvent
public net.minecraft.world.entity.monster.Phantom anchorPoint
public net.minecraft.world.entity.npc.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos;
public net.minecraft.world.entity.animal.AbstractSchoolingFish leader
public net.minecraft.world.entity.animal.AbstractSchoolingFish schoolSize
public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks
public net.minecraft.world.entity.AreaEffectCloud ownerUUID
public net.minecraft.world.entity.animal.MushroomCow stewEffects
public net.minecraft.world.entity.Entity FLAG_INVISIBLE
public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V
public net.minecraft.world.entity.animal.Cat isRelaxStateOne()Z

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
Co-authored-by: booky10 <boooky10@gmail.com>
Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
Co-authored-by: TrollyLoki <trollyloki@gmail.com>
Co-authored-by: FireInstall <kettnerl@hu-berlin.de>
Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com>
Co-authored-by: TotalledZebra <Holappa57@gmail.com>
This commit is contained in:
Owen1212055
2021-06-21 23:56:07 -04:00
parent ac687d7ecb
commit df822c00c9
47 changed files with 958 additions and 40 deletions

View File

@@ -164,7 +164,7 @@ public class MobGoalHelper {
bukkitMap.put(net.minecraft.world.entity.monster.Endermite.class, Endermite.class);
bukkitMap.put(net.minecraft.world.entity.monster.Evoker.class, Evoker.class);
bukkitMap.put(AbstractFish.class, Fish.class);
bukkitMap.put(AbstractSchoolingFish.class, Fish.class); // close enough
bukkitMap.put(AbstractSchoolingFish.class, io.papermc.paper.entity.SchoolableFish.class);
bukkitMap.put(FlyingMob.class, Flying.class);
bukkitMap.put(net.minecraft.world.entity.animal.Fox.class, Fox.class);
bukkitMap.put(net.minecraft.world.entity.monster.Ghast.class, Ghast.class);

View File

@@ -0,0 +1,52 @@
package io.papermc.paper.entity;
import net.minecraft.world.entity.animal.AbstractSchoolingFish;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftFish;
import org.jetbrains.annotations.NotNull;
public class PaperSchoolableFish extends CraftFish implements SchoolableFish {
public PaperSchoolableFish(CraftServer server, AbstractSchoolingFish entity) {
super(server, entity);
}
@Override
public AbstractSchoolingFish getHandle() {
return (AbstractSchoolingFish) super.getHandle();
}
@Override
public void startFollowing(@NotNull SchoolableFish fish) {
if (this.getHandle().isFollower()) { // If following a fish already, properly remove the old one
this.stopFollowing();
}
this.getHandle().startFollowing(((PaperSchoolableFish) fish).getHandle());
}
@Override
public void stopFollowing() {
this.getHandle().stopFollowing();
}
@Override
public int getSchoolSize() {
return this.getHandle().schoolSize;
}
@Override
public int getMaxSchoolSize() {
return this.getHandle().getMaxSchoolSize();
}
@Override
public SchoolableFish getSchoolLeader() {
AbstractSchoolingFish leader = this.getHandle().leader;
if (leader == null) {
return null;
}
return (SchoolableFish) leader.getBukkitEntity();
}
}

View File

@@ -114,4 +114,36 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
public AbstractHorseInventory getInventory() {
return new CraftSaddledInventory(getHandle().inventory);
}
// Paper start - Horse API
@Override
public boolean isEatingGrass() {
return this.getHandle().isEating();
}
@Override
public void setEatingGrass(boolean eating) {
this.getHandle().setEating(eating);
}
@Override
public boolean isRearing() {
return this.getHandle().isStanding();
}
@Override
public void setRearing(boolean rearing) {
this.getHandle().setForceStanding(rearing);
}
@Override
public boolean isEating() {
return this.getHandle().isMouthOpen();
}
@Override
public void setEating(boolean eating) {
this.getHandle().setMouthOpen(eating);
}
// Paper end - Horse API
}

View File

@@ -229,4 +229,17 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
this.getHandle().setOwner(null);
}
}
// Paper start - owner API
@Override
public java.util.UUID getOwnerUniqueId() {
return this.getHandle().ownerUUID;
}
@Override
public void setOwnerUniqueId(final java.util.UUID ownerUuid) {
this.getHandle().setOwner(null);
this.getHandle().ownerUUID = ownerUuid;
}
// Paper end
}

View File

@@ -27,4 +27,25 @@ public class CraftBat extends CraftAmbient implements Bat {
public void setAwake(boolean state) {
this.getHandle().setResting(!state);
}
// Paper start
@Override
public org.bukkit.Location getTargetLocation() {
net.minecraft.core.BlockPos pos = this.getHandle().targetPosition;
if (pos == null) {
return null;
}
return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
}
@Override
public void setTargetLocation(org.bukkit.Location location) {
net.minecraft.core.BlockPos pos = null;
if (location != null) {
pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
}
this.getHandle().targetPosition = pos;
}
// Paper end
}

View File

@@ -86,4 +86,42 @@ public class CraftBee extends CraftAnimals implements Bee {
public void setCannotEnterHiveTicks(int ticks) {
this.getHandle().setStayOutOfHiveCountdown(ticks);
}
// Paper start
@Override
public void setRollingOverride(net.kyori.adventure.util.TriState rolling) {
this.getHandle().rollingOverride = rolling;
this.getHandle().setRolling(this.getHandle().isRolling()); // Refresh rolling state
}
@Override
public boolean isRolling() {
return this.getRollingOverride().toBooleanOrElse(this.getHandle().isRolling());
}
@Override
public net.kyori.adventure.util.TriState getRollingOverride() {
return this.getHandle().rollingOverride;
}
@Override
public void setCropsGrownSincePollination(int crops) {
this.getHandle().numCropsGrownSincePollination = crops;
}
@Override
public int getCropsGrownSincePollination() {
return this.getHandle().numCropsGrownSincePollination;
}
@Override
public void setTicksSincePollination(int ticks) {
this.getHandle().ticksWithoutNectarSinceExitingHive = ticks;
}
@Override
public int getTicksSincePollination() {
return this.getHandle().ticksWithoutNectarSinceExitingHive;
}
// Paper end
}

View File

@@ -139,4 +139,26 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
return this.getKey().hashCode();
}
}
// Paper start - More cat api
@Override
public void setLyingDown(boolean lyingDown) {
this.getHandle().setLying(lyingDown);
}
@Override
public boolean isLyingDown() {
return this.getHandle().isLying();
}
@Override
public void setHeadUp(boolean headUp) {
this.getHandle().setRelaxStateOne(headUp);
}
@Override
public boolean isHeadUp() {
return this.getHandle().isRelaxStateOne();
}
// Paper end - More cat api
}

View File

@@ -18,4 +18,26 @@ public class CraftChicken extends CraftAnimals implements Chicken {
public String toString() {
return "CraftChicken";
}
// Paper start
@Override
public boolean isChickenJockey() {
return this.getHandle().isChickenJockey();
}
@Override
public void setIsChickenJockey(boolean isChickenJockey) {
this.getHandle().setChickenJockey(isChickenJockey);
}
@Override
public int getEggLayTime() {
return this.getHandle().eggTime;
}
@Override
public void setEggLayTime(int eggLayTime) {
this.getHandle().eggTime = eggLayTime;
}
// Paper end
}

View File

@@ -3,7 +3,7 @@ package org.bukkit.craftbukkit.entity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Cod;
public class CraftCod extends CraftFish implements Cod {
public class CraftCod extends io.papermc.paper.entity.PaperSchoolableFish implements Cod { // Paper - School Fish API
public CraftCod(CraftServer server, net.minecraft.world.entity.animal.Cod entity) {
super(server, entity);

View File

@@ -18,4 +18,36 @@ public class CraftDolphin extends CraftAgeable implements Dolphin {
public String toString() {
return "CraftDolphin";
}
// Paper start - Missing Dolphin API
@Override
public int getMoistness() {
return this.getHandle().getMoistnessLevel();
}
@Override
public void setMoistness(int moistness) {
this.getHandle().setMoisntessLevel(moistness);
}
@Override
public void setHasFish(boolean hasFish) {
this.getHandle().setGotFish(hasFish);
}
@Override
public boolean hasFish() {
return this.getHandle().gotFish();
}
@Override
public org.bukkit.Location getTreasureLocation() {
return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), this.getHandle().getTreasurePos());
}
@Override
public void setTreasureLocation(org.bukkit.Location location) {
this.getHandle().setTreasurePos(io.papermc.paper.util.MCUtil.toBlockPosition(location));
}
// Paper end - Missing Dolphin API
}

View File

@@ -51,6 +51,13 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago
this.getParent().setHealth(health);
}
// Paper start - entity heal API
@Override
public void heal(final double amount, final org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason) {
this.getParent().heal(amount, reason);
}
// Paper end - entity heal API
@Override
public double getAbsorptionAmount() {
return this.getParent().getAbsorptionAmount();

View File

@@ -40,6 +40,28 @@ public class CraftEnderman extends CraftMonster implements Enderman {
this.getHandle().setCarriedBlock(blockData == null ? null : ((CraftBlockData) blockData).getState());
}
// Paper start
@Override
public boolean isScreaming() {
return this.getHandle().isCreepy();
}
@Override
public void setScreaming(boolean screaming) {
this.getHandle().setCreepy(screaming);
}
@Override
public boolean hasBeenStaredAt() {
return this.getHandle().hasBeenStaredAt();
}
@Override
public void setHasBeenStaredAt(boolean hasBeenStaredAt) {
this.getHandle().setHasBeenStaredAt(hasBeenStaredAt);
}
// Paper end
@Override
public EnderMan getHandle() {
return (EnderMan) this.entity;

View File

@@ -28,4 +28,15 @@ public class CraftEndermite extends CraftMonster implements Endermite {
public void setPlayerSpawned(boolean playerSpawned) {
// Nop
}
// Paper start
@Override
public void setLifetimeTicks(int ticks) {
this.getHandle().life = ticks;
}
@Override
public int getLifetimeTicks() {
return this.getHandle().life;
}
// Paper end
}

View File

@@ -1082,4 +1082,27 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return set;
}
// Paper end - tracked players API
// Paper start - missing entity api
@Override
public boolean isInvisible() { // Paper - moved up from LivingEntity
return this.getHandle().isInvisible();
}
@Override
public void setInvisible(boolean invisible) { // Paper - moved up from LivingEntity
this.getHandle().persistentInvisibility = invisible;
this.getHandle().setSharedFlag(Entity.FLAG_INVISIBLE, invisible);
}
@Override
public void setNoPhysics(boolean noPhysics) {
this.getHandle().noPhysics = noPhysics;
}
@Override
public boolean hasNoPhysics() {
return this.getHandle().noPhysics;
}
// Paper end - missing entity api
}

View File

@@ -84,6 +84,18 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
return new Vector(delta.x, delta.y, delta.z);
}
// Paper start - Expose power on fireball projectiles
@Override
public void setPower(final Vector power) {
this.setAcceleration(power);
}
@Override
public Vector getPower() {
return this.getAcceleration();
}
// Paper end - Expose power on fireball projectiles
@Override
public AbstractHurtingProjectile getHandle() {
return (AbstractHurtingProjectile) this.entity;

View File

@@ -113,4 +113,41 @@ public class CraftFox extends CraftAnimals implements Fox {
public boolean isFaceplanted() {
return this.getHandle().isFaceplanted();
}
// Paper start - Add more fox behavior API
@Override
public void setInterested(boolean interested) {
this.getHandle().setIsInterested(interested);
}
@Override
public boolean isInterested() {
return this.getHandle().isInterested();
}
@Override
public void setLeaping(boolean leaping) {
this.getHandle().setIsPouncing(leaping);
}
@Override
public boolean isLeaping() {
return this.getHandle().isPouncing();
}
@Override
public void setDefending(boolean defending) {
this.getHandle().setDefending(defending);
}
@Override
public boolean isDefending() {
return this.getHandle().isDefending();
}
@Override
public void setFaceplanted(boolean faceplanted) {
this.getHandle().setFaceplanted(faceplanted);
}
// Paper end - Add more fox behavior API
}

View File

@@ -28,4 +28,17 @@ public class CraftGhast extends CraftFlying implements Ghast, CraftEnemy {
public void setCharging(boolean flag) {
this.getHandle().setCharging(flag);
}
// Paper start
@Override
public int getExplosionPower() {
return this.getHandle().getExplosionPower();
}
@Override
public void setExplosionPower(int explosionPower) {
com.google.common.base.Preconditions.checkArgument(explosionPower >= 0 && explosionPower <= 127, "The explosion power has to be between 0 and 127");
this.getHandle().setExplosionPower(explosionPower);
}
// Paper end
}

View File

@@ -128,6 +128,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
}
// Paper start - entity heal API
@Override
public void heal(final double amount, final org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason) {
this.getHandle().heal((float) amount, reason);
}
// Paper end - entity heal API
@Override
public double getAbsorptionAmount() {
return this.getHandle().getAbsorptionAmount();
@@ -939,14 +946,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean isInvisible() {
return this.getHandle().isInvisible();
return super.isInvisible(); // Paper - move invisibility up to Entity - diff on change
}
@Override
public void setInvisible(boolean invisible) {
this.getHandle().persistentInvisibility = invisible;
this.getHandle().setSharedFlag(5, invisible);
super.setInvisible(invisible); // Paper - move invisibility up to Entity
}
// Paper start
@Override
public float getSidewaysMovement() {
return this.getHandle().xxa;
}
@Override
public float getForwardsMovement() {
return this.getHandle().zza;
}
@Override
public float getUpwardsMovement() {
return this.getHandle().yya;
}
// Paper end
// Paper start
@Override

View File

@@ -58,4 +58,36 @@ public class CraftLlama extends CraftChestedHorse implements Llama, com.destroys
public String toString() {
return "CraftLlama";
}
// Paper start
@Override
public boolean inCaravan() {
return this.getHandle().inCaravan();
}
@Override
public void joinCaravan(@org.jetbrains.annotations.NotNull Llama llama) {
this.getHandle().joinCaravan(((CraftLlama) llama).getHandle());
}
@Override
public void leaveCaravan() {
this.getHandle().leaveCaravan();
}
@Override
public boolean hasCaravanTail() {
return this.getHandle().hasCaravanTail();
}
@Override
public Llama getCaravanHead() {
return this.getHandle().getCaravanHead() == null ? null : (Llama) this.getHandle().getCaravanHead().getBukkitEntity();
}
@Override
public Llama getCaravanTail() {
return this.getHandle().caravanTail == null ? null : (Llama) this.getHandle().caravanTail.getBukkitEntity();
}
// Paper end
}

View File

@@ -33,4 +33,20 @@ public final class CraftMinecartHopper extends CraftMinecartContainer implements
public void setEnabled(boolean enabled) {
((MinecartHopper) this.getHandle()).setEnabled(enabled);
}
// Paper start
@Override
public net.minecraft.world.entity.vehicle.MinecartHopper getHandle() {
return (net.minecraft.world.entity.vehicle.MinecartHopper) super.getHandle();
}
@Override
public int getPickupCooldown() {
throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
}
@Override
public void setPickupCooldown(int cooldown) {
throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
}
// Paper end
}

View File

@@ -146,4 +146,16 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
return getHandle().getMaxHeadXRot();
}
// Paper end
// Paper start
@Override
public boolean isAggressive() {
return this.getHandle().isAggressive();
}
@Override
public void setAggressive(boolean aggressive) {
this.getHandle().setAggressive(aggressive);
}
// Paper end
}

View File

@@ -41,6 +41,38 @@ public class CraftPanda extends CraftAnimals implements Panda {
this.getHandle().setHiddenGene(CraftPanda.toNms(gene));
}
// Paper start - Panda API
@Override
public void setSneezeTicks(int ticks) {
this.getHandle().setSneezeCounter(ticks);
}
@Override
public int getSneezeTicks() {
return this.getHandle().getSneezeCounter();
}
@Override
public void setEatingTicks(int ticks) {
this.getHandle().setEatCounter(ticks);
}
@Override
public int getEatingTicks() {
return this.getHandle().getEatCounter();
}
@Override
public void setUnhappyTicks(int ticks) {
this.getHandle().setUnhappyCounter(ticks);
}
@Override
public Gene getCombinedGene() {
return CraftPanda.fromNms(this.getHandle().getVariant());
}
// Paper end - Panda API
@Override
public boolean isRolling() {
return this.getHandle().isRolling();

View File

@@ -44,5 +44,17 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
public void setShouldBurnInDay(boolean shouldBurnInDay) {
getHandle().setShouldBurnInDay(shouldBurnInDay);
}
@Override
public org.bukkit.Location getAnchorLocation() {
net.minecraft.core.BlockPos pos = this.getHandle().anchorPoint;
return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
}
@Override
public void setAnchorLocation(org.bukkit.Location location) {
com.google.common.base.Preconditions.checkArgument(location != null, "location cannot be null");
this.getHandle().anchorPoint = io.papermc.paper.util.MCUtil.toBlockPosition(location);
}
// Paper end
}

View File

@@ -84,4 +84,37 @@ public class CraftPiglin extends CraftPiglinAbstract implements Piglin, com.dest
public String toString() {
return "CraftPiglin";
}
// Paper start
@Override
public void setChargingCrossbow(boolean chargingCrossbow) {
this.getHandle().setChargingCrossbow(chargingCrossbow);
}
@Override
public boolean isChargingCrossbow() {
return this.getHandle().isChargingCrossbow();
}
@Override
public void setDancing(boolean dancing) {
if (dancing) {
this.getHandle().getBrain().setMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.DANCING, true);
this.getHandle().getBrain().setMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.CELEBRATE_LOCATION, this.getHandle().getOnPos());
} else {
this.getHandle().getBrain().eraseMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.DANCING);
this.getHandle().getBrain().eraseMemory(net.minecraft.world.entity.ai.memory.MemoryModuleType.CELEBRATE_LOCATION);
}
}
@Override
public void setDancing(long duration) {
this.getHandle().getBrain().setMemoryWithExpiry(net.minecraft.world.entity.ai.memory.MemoryModuleType.DANCING, true, duration);
this.getHandle().getBrain().setMemoryWithExpiry(net.minecraft.world.entity.ai.memory.MemoryModuleType.CELEBRATE_LOCATION, this.getHandle().getOnPos(), duration);
}
@Override
public boolean isDancing() {
return this.getHandle().isDancing();
}
// Paper end
}

View File

@@ -17,4 +17,16 @@ public class CraftPolarBear extends CraftAnimals implements PolarBear {
public String toString() {
return "CraftPolarBear";
}
// Paper start
@Override
public boolean isStanding() {
return this.getHandle().isStanding();
}
@Override
public void setStanding(boolean standing) {
this.getHandle().setStanding(standing);
}
// Paper end
}

View File

@@ -29,4 +29,15 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
public void setRabbitType(Type type) {
this.getHandle().setVariant(net.minecraft.world.entity.animal.Rabbit.Variant.values()[type.ordinal()]);
}
// Paper start
@Override
public void setMoreCarrotTicks(int ticks) {
this.getHandle().moreCarrotTicks = ticks;
}
@Override
public int getMoreCarrotTicks() {
return this.getHandle().moreCarrotTicks;
}
// Paper end
}

View File

@@ -18,4 +18,35 @@ public class CraftRavager extends CraftRaider implements Ravager {
public String toString() {
return "CraftRavager";
}
// Paper start - Missing Entity Behavior
@Override
public int getAttackTicks() {
return this.getHandle().getAttackTick();
}
@Override
public void setAttackTicks(int ticks) {
this.getHandle().attackTick = ticks;
}
@Override
public int getStunnedTicks() {
return this.getHandle().getStunnedTick();
}
@Override
public void setStunnedTicks(int ticks) {
this.getHandle().stunnedTick = ticks;
}
@Override
public int getRoarTicks() {
return this.getHandle().getRoarTick();
}
@Override
public void setRoarTicks(int ticks) {
this.getHandle().roarTick = ticks;
}
// Paper end
}

View File

@@ -4,7 +4,7 @@ import com.google.common.base.Preconditions;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Salmon;
public class CraftSalmon extends CraftFish implements Salmon {
public class CraftSalmon extends io.papermc.paper.entity.PaperSchoolableFish implements Salmon { // Paper - Schooling Fish API
public CraftSalmon(CraftServer server, net.minecraft.world.entity.animal.Salmon entity) {
super(server, entity);

View File

@@ -67,4 +67,17 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
this.getHandle().owner = null;
}
}
// Paper start
@Override
public void setBlockData(org.bukkit.block.data.BlockData data) {
com.google.common.base.Preconditions.checkArgument(data != null, "The visual block data of this tnt cannot be null. To reset it just set to the TNT default block data");
this.getHandle().setBlockState(((org.bukkit.craftbukkit.block.data.CraftBlockData) data).getState());
}
@Override
public org.bukkit.block.data.BlockData getBlockData() {
return org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.getHandle().getBlockState());
}
// Paper end
}

View File

@@ -28,4 +28,15 @@ public class CraftTadpole extends CraftFish implements org.bukkit.entity.Tadpole
public void setAge(int age) {
this.getHandle().age = age;
}
// Paper start
@Override
public void setAgeLock(boolean lock) {
this.getHandle().ageLocked = lock;
}
@Override
public boolean getAgeLock() {
return this.getHandle().ageLocked;
}
// Paper end
}

View File

@@ -31,4 +31,27 @@ public class CraftTrident extends CraftAbstractArrow implements Trident {
public String toString() {
return "CraftTrident";
}
// Paper start
@Override
public boolean hasGlint() {
return this.getHandle().isFoil();
}
@Override
public void setGlint(boolean glint) {
this.getHandle().setFoil(glint);
}
@Override
public int getLoyaltyLevel() {
return this.getHandle().getLoyalty();
}
@Override
public void setLoyaltyLevel(int loyaltyLevel) {
com.google.common.base.Preconditions.checkArgument(loyaltyLevel >= 0 && loyaltyLevel <= 127, "The loyalty level has to be between 0 and 127");
this.getHandle().setLoyalty((byte) loyaltyLevel);
}
// Paper end
}

View File

@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.TropicalFish;
import org.bukkit.entity.TropicalFish.Pattern;
public class CraftTropicalFish extends CraftFish implements TropicalFish {
public class CraftTropicalFish extends io.papermc.paper.entity.PaperSchoolableFish implements TropicalFish { // Paper - Schooling Fish API
public CraftTropicalFish(CraftServer server, net.minecraft.world.entity.animal.TropicalFish entity) {
super(server, entity);

View File

@@ -29,6 +29,26 @@ public class CraftVex extends CraftMonster implements Vex {
public void setSummoner(org.bukkit.entity.Mob summoner) {
getHandle().setOwner(summoner == null ? null : ((CraftMob) summoner).getHandle());
}
@Override
public boolean hasLimitedLifetime() {
return this.getHandle().hasLimitedLife;
}
@Override
public void setLimitedLifetime(boolean hasLimitedLifetime) {
this.getHandle().hasLimitedLife = hasLimitedLifetime;
}
@Override
public int getLimitedLifetimeTicks() {
return this.getHandle().limitedLifeTicks;
}
@Override
public void setLimitedLifetimeTicks(int ticks) {
this.getHandle().limitedLifeTicks = ticks;
}
// Paper end
@Override

View File

@@ -60,13 +60,20 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager {
@Override
public void setConversionTime(int time) {
// Paper start - missing entity behaviour api - converting without entity event
this.setConversionTime(time, true);
}
@Override
public void setConversionTime(int time, boolean broadcastEntityEvent) {
// Paper end - missing entity behaviour api - converting without entity event
if (time < 0) {
this.getHandle().villagerConversionTime = -1;
this.getHandle().getEntityData().set(net.minecraft.world.entity.monster.ZombieVillager.DATA_CONVERTING_ID, false);
this.getHandle().conversionStarter = null;
this.getHandle().removeEffect(MobEffects.DAMAGE_BOOST, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
} else {
this.getHandle().startConverting(null, time);
this.getHandle().startConverting(null, time, broadcastEntityEvent); // Paper - missing entity behaviour api - converting without entity event
}
}

View File

@@ -49,5 +49,25 @@ public class CraftWanderingTrader extends CraftAbstractVillager implements Wande
public boolean canDrinkMilk() {
return getHandle().canDrinkMilk;
}
@Override
public org.bukkit.Location getWanderingTowards() {
net.minecraft.core.BlockPos pos = this.getHandle().getWanderTarget();
if (pos == null) {
return null;
}
return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
}
@Override
public void setWanderingTowards(org.bukkit.Location location) {
net.minecraft.core.BlockPos pos = null;
if (location != null) {
pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
}
this.getHandle().setWanderTarget(pos);
}
// Paper end
}

View File

@@ -37,6 +37,13 @@ public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warde
return this.getHandle().getAngerManagement().getActiveAnger(((CraftEntity) entity).getHandle());
}
// Paper start
@Override
public int getHighestAnger() {
return this.getHandle().getAngerManagement().getActiveAnger(null);
}
// Paper end
@Override
public void increaseAnger(Entity entity, int increase) {
Preconditions.checkArgument(entity != null, "Entity cannot be null");

View File

@@ -67,4 +67,36 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
this.getHandle().setInvulnerableTicks(ticks);
}
// Paper start
@Override
public boolean isCharged() {
return getHandle().isPowered();
}
@Override
public int getInvulnerableTicks() {
return getHandle().getInvulnerableTicks();
}
@Override
public void setInvulnerableTicks(int ticks) {
getHandle().setInvulnerableTicks(ticks);
}
@Override
public boolean canTravelThroughPortals() {
return getHandle().canUsePortal(false);
}
@Override
public void setCanTravelThroughPortals(boolean value) {
getHandle().setCanTravelThroughPortals(value);
}
@Override
public void enterInvulnerabilityPhase() {
this.getHandle().makeInvulnerable();
}
// Paper end
}