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

@@ -0,0 +1,10 @@
--- a/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
+++ b/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
@@ -51,6 +51,7 @@
}
public void stopFollowing() {
+ if (this.leader == null) return; // Avoid NPE, plugins can now set the leader and certain fish goals might cause this method to be called
this.leader.removeFollower();
this.leader = null;
}

View File

@@ -110,7 +110,21 @@
}
boolean isHiveValid() {
@@ -671,8 +703,14 @@
@@ -533,11 +565,13 @@
this.setFlag(4, hasStung);
}
+ public net.kyori.adventure.util.TriState rollingOverride = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Rolling override
public boolean isRolling() {
return this.getFlag(2);
}
public void setRolling(boolean nearTarget) {
+ nearTarget = rollingOverride.toBooleanOrElse(nearTarget); // Paper - Rolling override
this.setFlag(2, nearTarget);
}
@@ -671,8 +705,14 @@
if (this.isInvulnerableTo(world, source)) {
return false;
} else {
@@ -126,7 +140,7 @@
}
}
@@ -1082,7 +1120,7 @@
@@ -1082,7 +1122,7 @@
BeeGoToHiveGoal() {
super();
@@ -135,7 +149,7 @@
this.blacklistedTargets = Lists.newArrayList();
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
}
@@ -1196,7 +1234,7 @@
@@ -1196,7 +1236,7 @@
BeeGoToKnownFlowerGoal() {
super();
@@ -144,7 +158,7 @@
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
}
@@ -1301,7 +1339,7 @@
@@ -1301,7 +1341,7 @@
}
}
@@ -153,7 +167,7 @@
Bee.this.level().levelEvent(2011, blockposition, 15);
Bee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
Bee.this.incrementNumCropsGrownSincePollination();
@@ -1378,7 +1416,7 @@
@@ -1378,7 +1418,7 @@
@Override
protected void alertOther(Mob mob, LivingEntity target) {
if (mob instanceof Bee && this.mob.hasLineOfSight(target)) {
@@ -162,7 +176,7 @@
}
}
@@ -1387,7 +1425,7 @@
@@ -1387,7 +1427,7 @@
private static class BeeBecomeAngryTargetGoal extends NearestAttackableTargetGoal<Player> {
BeeBecomeAngryTargetGoal(Bee bee) {

View File

@@ -1,6 +1,14 @@
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -74,7 +74,7 @@
@@ -50,6 +50,7 @@
public int age;
protected static final ImmutableList<SensorType<? extends Sensor<? super Tadpole>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.HURT_BY, SensorType.FROG_TEMPTATIONS);
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.NEAREST_VISIBLE_ADULT, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.BREED_TARGET, MemoryModuleType.IS_PANICKING);
+ public boolean ageLocked; // Paper
public Tadpole(EntityType<? extends AbstractFish> type, Level world) {
super(type, world);
@@ -74,7 +75,7 @@
@Override
public Brain<Tadpole> getBrain() {
@@ -9,7 +17,55 @@
}
@Override
@@ -225,12 +225,17 @@
@@ -102,7 +103,7 @@
@Override
public void aiStep() {
super.aiStep();
- if (!this.level().isClientSide) {
+ if (!this.level().isClientSide && !this.ageLocked) { // Paper
this.setAge(this.age + 1);
}
@@ -112,12 +113,14 @@
public void addAdditionalSaveData(CompoundTag nbt) {
super.addAdditionalSaveData(nbt);
nbt.putInt("Age", this.age);
+ nbt.putBoolean("AgeLocked", this.ageLocked); // Paper
}
@Override
public void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt);
this.setAge(nbt.getInt("Age"));
+ this.ageLocked = nbt.getBoolean("AgeLocked"); // Paper
}
@Nullable
@@ -169,6 +172,7 @@
Bucketable.saveDefaultDataToBucketTag(this, stack);
CustomData.update(DataComponents.BUCKET_ENTITY_DATA, stack, (nbttagcompound) -> {
nbttagcompound.putInt("Age", this.getAge());
+ nbttagcompound.putBoolean("AgeLocked", this.ageLocked); // Paper
});
}
@@ -179,6 +183,7 @@
this.setAge(nbt.getInt("Age"));
}
+ this.ageLocked = nbt.getBoolean("AgeLocked"); // Paper
}
@Override
@@ -210,6 +215,7 @@
}
private void ageUp(int seconds) {
+ if (this.ageLocked) return; // Paper
this.setAge(this.age + seconds * 20);
}
@@ -225,12 +231,17 @@
Level world = this.level();
if (world instanceof ServerLevel worldserver) {

View File

@@ -61,12 +61,12 @@
+ @Override
+ public InventoryHolder getOwner() {
+ return (org.bukkit.entity.AbstractHorse) AbstractHorse.this.getBukkitEntity();
+ }
}
+
+ @Override
+ public Location getLocation() {
+ return AbstractHorse.this.getBukkitEntity().getLocation();
}
+ }
+ // CraftBukkit end
};
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
@@ -118,7 +118,36 @@
}
if (this.canEatGrass()) {
@@ -883,6 +940,7 @@
@@ -720,7 +777,16 @@
}
}
+ }
+
+ // Paper start - Horse API
+ public void setMouthOpen(boolean open) {
+ this.setFlag(FLAG_OPEN_MOUTH, open);
+ }
+ public boolean isMouthOpen() {
+ return this.getFlag(FLAG_OPEN_MOUTH);
}
+ // Paper end - Horse API
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
@@ -764,6 +830,11 @@
this.setFlag(16, eatingGrass);
}
+ // Paper start - Horse API
+ public void setForceStanding(boolean standing) {
+ this.setFlag(FLAG_STANDING, standing);
+ }
+ // Paper end - Horse API
public void setStanding(boolean angry) {
if (angry) {
this.setEating(false);
@@ -883,6 +954,7 @@
if (this.getOwnerUUID() != null) {
nbt.putUUID("Owner", this.getOwnerUUID());
}
@@ -126,20 +155,19 @@
if (!this.inventory.getItem(0).isEmpty()) {
nbt.put("SaddleItem", this.inventory.getItem(0).save(this.registryAccess()));
@@ -909,7 +967,12 @@
@@ -910,6 +982,11 @@
if (uuid != null) {
this.setOwnerUUID(uuid);
+ }
}
+ // CraftBukkit start
+ if (nbt.contains("Bukkit.MaxDomestication")) {
+ this.maxDomestication = nbt.getInt("Bukkit.MaxDomestication");
}
+ }
+ // CraftBukkit end
if (nbt.contains("SaddleItem", 10)) {
ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbt.getCompound("SaddleItem")).orElse(ItemStack.EMPTY);
@@ -1012,6 +1075,17 @@
@@ -1012,6 +1089,17 @@
@Override
public void handleStartJump(int height) {

View File

@@ -1,6 +1,19 @@
--- a/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/net/minecraft/world/entity/animal/horse/Llama.java
@@ -82,6 +82,11 @@
@@ -71,17 +71,23 @@
@Nullable
private Llama caravanHead;
@Nullable
- private Llama caravanTail;
+ public Llama caravanTail; // Paper
public Llama(EntityType<? extends Llama> type, Level world) {
super(type, world);
this.getNavigation().setRequiredPathLength(40.0F);
+ this.maxDomestication = 30; // Paper - Missing entity API; configure max temper instead of a hardcoded value
}
public boolean isTraderLlama() {
return false;
}
@@ -12,3 +25,12 @@
private void setStrength(int strength) {
this.entityData.set(Llama.DATA_STRENGTH_ID, Math.max(1, Math.min(5, strength)));
}
@@ -289,7 +295,7 @@
@Override
public int getMaxTemper() {
- return 30;
+ return super.getMaxTemper(); // Paper - Missing entity API; delegate to parent
}
@Override

View File

@@ -38,7 +38,20 @@
public class WitherBoss extends Monster implements RangedAttackMob {
@@ -252,15 +261,42 @@
@@ -77,7 +86,12 @@
return !entityliving.getType().is(EntityTypeTags.WITHER_FRIENDS) && entityliving.attackable();
};
private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR);
+ // Paper start
+ private boolean canPortal = false;
+ public void setCanTravelThroughPortals(boolean canPortal) { this.canPortal = canPortal; }
+ // Paper end
+
public WitherBoss(EntityType<? extends WitherBoss> type, Level world) {
super(type, world);
this.bossEvent = (ServerBossEvent) (new ServerBossEvent(this.getDisplayName(), BossEvent.BossBarColor.PURPLE, BossEvent.BossBarOverlay.PROGRESS)).setDarkenScreen(true);
@@ -252,15 +266,42 @@
i = this.getInvulnerableTicks() - 1;
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
if (i <= 0) {
@@ -84,7 +97,7 @@
}
} else {
@@ -305,6 +341,7 @@
@@ -305,6 +346,7 @@
if (!list.isEmpty()) {
LivingEntity entityliving1 = (LivingEntity) list.get(this.random.nextInt(list.size()));
@@ -92,7 +105,7 @@
this.setAlternativeTarget(i, entityliving1.getId());
}
}
@@ -331,6 +368,11 @@
@@ -331,6 +373,11 @@
BlockState iblockdata = world.getBlockState(blockposition);
if (WitherBoss.canDestroy(iblockdata)) {
@@ -104,7 +117,7 @@
flag = world.destroyBlock(blockposition, true, this) || flag;
}
}
@@ -342,7 +384,7 @@
@@ -342,7 +389,7 @@
}
if (this.tickCount % 20 == 0) {
@@ -113,7 +126,7 @@
}
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
@@ -499,7 +541,7 @@
@@ -499,7 +546,7 @@
@Override
public void checkDespawn() {
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
@@ -122,3 +135,12 @@
} else {
this.noActionTime = 0;
}
@@ -549,7 +596,7 @@
@Override
public boolean canUsePortal(boolean allowVehicles) {
- return false;
+ return this.canPortal; // Paper
}
@Override

View File

@@ -86,7 +86,24 @@
return flag1;
}
@@ -457,7 +488,8 @@
@@ -397,6 +428,16 @@
this.entityData.set(EnderMan.DATA_STARED_AT, true);
}
+ // Paper start
+ public void setCreepy(boolean creepy) {
+ this.entityData.set(EnderMan.DATA_CREEPY, creepy);
+ }
+
+ public void setHasBeenStaredAt(boolean hasBeenStaredAt) {
+ this.entityData.set(EnderMan.DATA_STARED_AT, hasBeenStaredAt);
+ }
+ // Paper end
+
@Override
public boolean requiresCustomPersistence() {
return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
@@ -457,7 +498,8 @@
int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 2.0D);
int k = Mth.floor(this.enderman.getZ() - 1.0D + randomsource.nextDouble() * 2.0D);
BlockPos blockposition = new BlockPos(i, j, k);
@@ -96,7 +113,7 @@
BlockPos blockposition1 = blockposition.below();
BlockState iblockdata1 = world.getBlockState(blockposition1);
BlockState iblockdata2 = this.enderman.getCarriedBlock();
@@ -465,9 +497,11 @@
@@ -465,9 +507,11 @@
if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
@@ -108,7 +125,7 @@
}
}
@@ -499,16 +533,19 @@
@@ -499,16 +543,19 @@
int j = Mth.floor(this.enderman.getY() + randomsource.nextDouble() * 3.0D);
int k = Mth.floor(this.enderman.getZ() - 2.0D + randomsource.nextDouble() * 4.0D);
BlockPos blockposition = new BlockPos(i, j, k);
@@ -129,7 +146,7 @@
}
}
@@ -592,7 +629,7 @@
@@ -592,7 +639,7 @@
} else {
if (this.target != null && !this.enderman.isPassenger()) {
if (this.enderman.isBeingStaredBy((Player) this.target)) {

View File

@@ -1,6 +1,20 @@
--- a/net/minecraft/world/entity/monster/Ghast.java
+++ b/net/minecraft/world/entity/monster/Ghast.java
@@ -333,6 +333,8 @@
@@ -64,7 +64,13 @@
public int getExplosionPower() {
return this.explosionPower;
+ }
+
+ // Paper start
+ public void setExplosionPower(int explosionPower) {
+ this.explosionPower = explosionPower;
}
+ // Paper end
@Override
protected boolean shouldDespawnInPeaceful() {
@@ -333,6 +339,8 @@
LargeFireball entitylargefireball = new LargeFireball(world, this.ghast, vec3d1.normalize(), this.ghast.getExplosionPower());

View File

@@ -81,20 +81,31 @@
}
@Override
@@ -197,8 +210,10 @@
@@ -194,12 +207,20 @@
}
public void startConverting(@Nullable UUID uuid, int delay) {
+ // Paper start - missing entity behaviour api - converting without entity event
+ this.startConverting(uuid, delay, true);
+ }
+
+ public void startConverting(@Nullable UUID uuid, int delay, boolean broadcastEntityEvent) {
+ // Paper end - missing entity behaviour api - converting without entity event
this.conversionStarter = uuid;
this.villagerConversionTime = delay;
this.getEntityData().set(ZombieVillager.DATA_CONVERTING_ID, true);
- this.removeEffect(MobEffects.WEAKNESS);
- this.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, delay, Math.min(this.level().getDifficulty().getId() - 1, 0)));
- this.level().broadcastEntityEvent(this, (byte) 16);
+ // CraftBukkit start
+ this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
+ this.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, delay, Math.min(this.level().getDifficulty().getId() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
+ // CraftBukkit end
this.level().broadcastEntityEvent(this, (byte) 16);
+ if (broadcastEntityEvent) this.level().broadcastEntityEvent(this, (byte) 16); // Paper - missing entity behaviour api - converting without entity event
}
@@ -215,10 +230,11 @@
@Override
@@ -215,10 +236,11 @@
}
private void finishConversion(ServerLevel world) {
@@ -107,7 +118,7 @@
while (iterator.hasNext()) {
EquipmentSlot enumitemslot = (EquipmentSlot) iterator.next();
@@ -248,12 +264,16 @@
@@ -248,12 +270,16 @@
}
}

View File

@@ -23,7 +23,28 @@
return;
}
@@ -137,7 +140,7 @@
@@ -111,6 +114,20 @@
return (Boolean) this.entityData.get(ThrownTrident.ID_FOIL);
}
+ // Paper start
+ public void setFoil(boolean foil) {
+ this.entityData.set(ThrownTrident.ID_FOIL, foil);
+ }
+
+ public int getLoyalty() {
+ return this.entityData.get(ThrownTrident.ID_LOYALTY);
+ }
+
+ public void setLoyalty(byte loyalty) {
+ this.entityData.set(ThrownTrident.ID_LOYALTY, loyalty);
+ }
+ // Paper end
+
@Nullable
@Override
protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) {
@@ -137,7 +154,7 @@
world = this.level();
if (world instanceof ServerLevel) {