2021-06-22 09:44:02 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Mon, 21 Jun 2021 23:56:07 -0400
2023-07-13 23:26:42 +02:00
Subject: [PATCH] Missing Entity API
2021-06-22 09:44:02 +02:00
2022-11-20 00:53:20 +01:00
== 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
2023-02-26 17:01:43 +01:00
public net.minecraft.world.entity.vehicle.MinecartTNT explode(D)V
2022-11-20 00:53:20 +01:00
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;
2022-11-26 03:21:40 +01:00
public net.minecraft.world.entity.animal.AbstractSchoolingFish leader
public net.minecraft.world.entity.animal.AbstractSchoolingFish schoolSize
2022-12-10 01:56:13 +01:00
public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks
2023-07-13 23:26:42 +02:00
public net.minecraft.world.entity.AreaEffectCloud ownerUUID
2023-12-03 02:54:58 +01:00
public net.minecraft.world.entity.animal.MushroomCow stewEffects
2024-03-23 20:27:30 +01:00
public net.minecraft.world.entity.Entity FLAG_INVISIBLE
2024-04-25 21:16:00 +02:00
public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V
public net.minecraft.world.entity.animal.Cat isRelaxStateOne()Z
2022-11-20 00:53:20 +01:00
2022-08-01 16:01:20 +02:00
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
2022-03-11 15:24:45 +01:00
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2022-10-11 23:04:26 +02:00
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
2023-02-26 17:01:43 +01:00
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
2023-05-12 22:24:50 +02:00
Co-authored-by: booky10 <boooky10@gmail.com>
2023-09-14 12:54:43 +02:00
Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
2024-03-20 22:33:34 +01:00
Co-authored-by: TrollyLoki <trollyloki@gmail.com>
2024-03-23 20:27:30 +01:00
Co-authored-by: FireInstall <kettnerl@hu-berlin.de>
2024-03-23 22:26:17 +01:00
Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com>
2024-05-30 22:31:45 +02:00
Co-authored-by: TotalledZebra <Holappa57@gmail.com>
2021-06-22 09:44:02 +02:00
2022-11-26 03:21:40 +01:00
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
2024-10-26 18:03:25 +02:00
index 05e793e722bbb367ca64cd7f26156fa3dabb8474..3470720466fc81f977c18e3a97bb918926025a22 100644
2022-11-26 03:21:40 +01:00
--- a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
2024-07-17 19:24:53 +02:00
@@ -164,7 +164,7 @@ public class MobGoalHelper {
2022-11-26 03:21:40 +01:00
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);
diff --git a/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java b/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java
new file mode 100644
index 0000000000000000000000000000000000000000..41bf71d116ffc5431586ce54abba7f8def6c1dcf
--- /dev/null
+++ b/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java
@@ -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();
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
2024-10-23 20:15:25 +02:00
index 30095df7b64cfda4931dbfa22549ff5abefd53e0..c8ae49f58c254119c0e64a4e1501ebc5a70f9a46 100644
2022-11-26 03:21:40 +01:00
--- a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
+++ b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
2024-04-24 16:29:12 +02:00
@@ -51,6 +51,7 @@ public abstract class AbstractSchoolingFish extends AbstractFish {
2022-11-26 03:21:40 +01:00
}
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;
}
2022-03-19 15:30:16 +01:00
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
2024-10-25 13:34:01 +02:00
index adff3bec90786b87323653cf4f94a38c7b9ef7ff..048a357546c8f5ad5dbb86e2e1ada2730a52d061 100644
2022-03-19 15:30:16 +01:00
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
2024-10-23 20:15:25 +02:00
@@ -561,11 +561,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
2022-03-19 15:30:16 +01:00
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);
}
2022-12-23 21:50:32 +01:00
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
2024-10-23 20:15:25 +02:00
index b9d7aa4aa0fc3472a2a0700e526778daf62bdc6f..48ac8c3f6e00c3c2dc67b6c994be7c0ac6dfcf81 100644
2022-12-23 21:50:32 +01:00
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
2024-04-24 16:29:12 +02:00
@@ -50,6 +50,7 @@ public class Tadpole extends AbstractFish {
2022-12-23 21:50:32 +01:00
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);
2024-10-23 20:15:25 +02:00
@@ -102,7 +103,7 @@ public class Tadpole extends AbstractFish {
2022-12-23 21:50:32 +01:00
@Override
public void aiStep() {
super.aiStep();
2023-06-08 04:04:01 +02:00
- if (!this.level().isClientSide) {
+ if (!this.level().isClientSide && !this.ageLocked) { // Paper
2022-12-23 21:50:32 +01:00
this.setAge(this.age + 1);
}
2024-10-23 20:15:25 +02:00
@@ -112,12 +113,14 @@ public class Tadpole extends AbstractFish {
2022-12-23 21:50:32 +01:00
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
2024-10-23 20:15:25 +02:00
@@ -169,6 +172,7 @@ public class Tadpole extends AbstractFish {
2024-04-24 16:29:12 +02:00
Bucketable.saveDefaultDataToBucketTag(this, stack);
CustomData.update(DataComponents.BUCKET_ENTITY_DATA, stack, (nbttagcompound) -> {
nbttagcompound.putInt("Age", this.getAge());
+ nbttagcompound.putBoolean("AgeLocked", this.ageLocked); // Paper
});
2022-12-23 21:50:32 +01:00
}
2024-10-23 20:15:25 +02:00
@@ -179,6 +183,7 @@ public class Tadpole extends AbstractFish {
2022-12-23 21:50:32 +01:00
this.setAge(nbt.getInt("Age"));
}
+ this.ageLocked = nbt.getBoolean("AgeLocked"); // Paper
}
@Override
2024-10-23 20:15:25 +02:00
@@ -210,6 +215,7 @@ public class Tadpole extends AbstractFish {
2022-12-23 21:50:32 +01:00
}
private void ageUp(int seconds) {
+ if (this.ageLocked) return; // Paper
this.setAge(this.age + seconds * 20);
}
2021-10-21 03:09:42 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
2024-10-23 20:15:25 +02:00
index 709237639ef0ec1cb623f270302a27b0072e8685..74151d69380e4adede40c7d7fc20834553706730 100644
2021-10-21 03:09:42 +02:00
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
2024-10-23 20:15:25 +02:00
@@ -779,6 +779,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
2021-10-21 03:09:42 +02:00
}
2024-01-19 22:13:42 +01:00
+ // Paper start - Horse API
2021-10-21 03:09:42 +02:00
+ public void setMouthOpen(boolean open) {
+ this.setFlag(FLAG_OPEN_MOUTH, open);
+ }
+ public boolean isMouthOpen() {
+ return this.getFlag(FLAG_OPEN_MOUTH);
+ }
2024-01-19 22:13:42 +01:00
+ // Paper end - Horse API
2022-12-07 21:16:54 +01:00
+
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
if (!this.isVehicle() && !this.isBaby()) {
2024-10-23 20:15:25 +02:00
@@ -821,6 +830,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
2021-10-21 03:09:42 +02:00
this.setFlag(16, eatingGrass);
}
2024-01-19 22:13:42 +01:00
+ // Paper start - Horse API
2021-10-21 03:09:42 +02:00
+ public void setForceStanding(boolean standing) {
+ this.setFlag(FLAG_STANDING, standing);
+ }
2024-01-19 22:13:42 +01:00
+ // Paper end - Horse API
2021-10-21 03:09:42 +02:00
public void setStanding(boolean angry) {
if (angry) {
this.setEating(false);
2022-10-11 23:04:26 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
2024-10-23 20:15:25 +02:00
index 04842dd7b9beabcecbd492d0b98faaebeea1a5d9..d5808d0c190877554a4a8191f68e8b4a36f2ff46 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
2024-10-23 20:15:25 +02:00
@@ -71,11 +71,12 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
2022-10-11 23:04:26 +02:00
@Nullable
private Llama caravanHead;
@Nullable
- private Llama caravanTail;
+ public Llama caravanTail; // Paper
public Llama(EntityType<? extends Llama> type, Level world) {
super(type, world);
2024-10-23 20:15:25 +02:00
this.getNavigation().setRequiredPathLength(40.0F);
2024-05-29 20:17:56 +02:00
+ this.maxDomestication = 30; // Paper - Missing entity API; configure max temper instead of a hardcoded value
}
public boolean isTraderLlama() {
2024-10-23 20:15:25 +02:00
@@ -294,7 +295,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
2024-05-29 20:17:56 +02:00
@Override
public int getMaxTemper() {
- return 30;
+ return super.getMaxTemper(); // Paper - Missing entity API; delegate to parent
}
@Override
2022-03-11 15:24:45 +01:00
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
2024-10-23 20:15:25 +02:00
index 10c79cbc25383c0b65fb22a7347513134b7dee1d..b145023308e6a2823d83db97ff2d79c38b709ef9 100644
2022-03-11 15:24:45 +01:00
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
2024-10-23 20:15:25 +02:00
@@ -86,6 +86,11 @@ public class WitherBoss extends Monster implements RangedAttackMob {
2024-04-24 16:29:12 +02:00
return !entityliving.getType().is(EntityTypeTags.WITHER_FRIENDS) && entityliving.attackable();
2022-03-11 15:24:45 +01:00
};
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);
2024-10-23 20:15:25 +02:00
@@ -592,7 +597,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
2022-03-11 15:24:45 +01:00
@Override
2024-06-14 01:32:45 +02:00
public boolean canUsePortal(boolean allowVehicles) {
2022-03-11 15:24:45 +01:00
- return false;
2024-06-14 01:32:45 +02:00
+ return this.canPortal; // Paper
2022-03-11 15:24:45 +01:00
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
2024-10-23 20:15:25 +02:00
index 512de8e79a842d4389e8528983b94af4843ffd11..0e8349aa6cb23860a4dd884e730ac8f22d422205 100644
2022-03-11 15:24:45 +01:00
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
2024-10-23 20:15:25 +02:00
@@ -429,6 +429,16 @@ public class EnderMan extends Monster implements NeutralMob {
2022-03-11 15:24:45 +01:00
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;
2022-03-06 22:20:38 +01:00
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ghast.java b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
2024-10-23 20:15:25 +02:00
index 71259b92a01a4feca270a250b1964f25f6da2d33..a8c8c03e972aa6352843cf4c3e4aebfb8f493125 100644
2022-03-06 22:20:38 +01:00
--- a/src/main/java/net/minecraft/world/entity/monster/Ghast.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
2024-10-23 20:15:25 +02:00
@@ -66,6 +66,12 @@ public class Ghast extends FlyingMob implements Enemy {
2022-03-06 22:20:38 +01:00
return this.explosionPower;
}
+ // Paper start
+ public void setExplosionPower(int explosionPower) {
+ this.explosionPower = explosionPower;
+ }
+ // Paper end
+
@Override
protected boolean shouldDespawnInPeaceful() {
return true;
2022-07-07 23:43:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
2024-10-23 20:15:25 +02:00
index 69af895863a2d0fa25a128518bda99d1754f9ac0..533cb2eff3d56e7e8a70aba5e1047250e192bf2c 100644
2022-07-07 23:43:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
2024-10-23 20:15:25 +02:00
@@ -207,6 +207,12 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
2022-07-07 23:43:28 +02:00
}
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);
2024-10-23 20:15:25 +02:00
@@ -214,7 +220,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
2022-07-07 23:43:28 +02:00
this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
2023-06-08 04:04:01 +02:00
this.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, delay, Math.min(this.level().getDifficulty().getId() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
2022-07-07 23:43:28 +02:00
// CraftBukkit end
2023-06-08 04:04:01 +02:00
- this.level().broadcastEntityEvent(this, (byte) 16);
+ if (broadcastEntityEvent) this.level().broadcastEntityEvent(this, (byte) 16); // Paper - missing entity behaviour api - converting without entity event
2022-07-07 23:43:28 +02:00
}
@Override
2022-03-11 15:24:45 +01:00
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
2024-10-23 20:15:25 +02:00
index c26ef5e3ed4bb0e0729585167d696226f312c214..248410547de380e3195bbdc8b7b39cff908a0c32 100644
2022-03-11 15:24:45 +01:00
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
2024-10-23 20:15:25 +02:00
@@ -113,6 +113,20 @@ public class ThrownTrident extends AbstractArrow {
2022-03-11 15:24:45 +01:00
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) {
2021-10-21 03:09:42 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
2024-04-24 16:29:12 +02:00
index 3952e52b94c1cc97e1d2d3885f59d7690efb74ad..9bcc0931510607b8fbd01233e2b3c346369b214d 100644
2021-10-21 03:09:42 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
2023-06-13 01:51:45 +02:00
@@ -114,4 +114,36 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
2021-10-21 03:09:42 +02:00
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
}
2023-07-13 23:26:42 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
2024-10-23 20:15:25 +02:00
index 17bffb45453f15328ca91794e26f6be1defef700..6591513bb62226b6f85fd2ef9f6ebe376f0f7362 100644
2023-07-13 23:26:42 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
2024-05-11 23:48:37 +02:00
@@ -229,4 +229,17 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
2023-07-13 23:26:42 +02:00
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
}
2022-10-11 23:04:26 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
2023-10-27 01:34:58 +02:00
index b0a3531476f5a05ae846b68d825eddc35ebddea9..1bb72f28085f3885bec068b586ec222111044884 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
2023-08-14 01:32:51 +02:00
@@ -27,4 +27,25 @@ public class CraftBat extends CraftAmbient implements Bat {
2022-10-11 23:04:26 +02:00
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;
+ }
+
2023-06-08 22:56:13 +02:00
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
2022-10-11 23:04:26 +02:00
+ }
+
+ @Override
+ public void setTargetLocation(org.bukkit.Location location) {
+ net.minecraft.core.BlockPos pos = null;
+ if (location != null) {
2022-10-24 21:43:46 +02:00
+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
2022-10-11 23:04:26 +02:00
+ }
+
+ this.getHandle().targetPosition = pos;
+ }
+ // Paper end
}
2022-03-19 15:30:16 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java
2023-10-27 01:34:58 +02:00
index cfff1be6a4a4936a2dadb2590abc3d33c123d048..3dac93b0ab5d5acf5b33dc4b0efed60319eb657b 100644
2022-03-19 15:30:16 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java
2023-08-14 01:32:51 +02:00
@@ -86,4 +86,42 @@ public class CraftBee extends CraftAnimals implements Bee {
2022-03-19 15:30:16 +01:00
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;
+ }
2022-10-11 23:04:26 +02:00
+
+ @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;
+ }
2022-03-19 15:30:16 +01:00
+ // Paper end
}
2021-08-27 20:16:41 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
2024-07-18 10:13:20 +02:00
index 57664124968e6268ad6699c6bd932981cc2fe6ba..88e876da7df64b68a5b71fd1deab75b59c5a64e3 100644
2021-08-27 20:16:41 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
2024-07-18 10:13:20 +02:00
@@ -139,4 +139,26 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
return this.getKey().hashCode();
2023-09-23 04:06:03 +02:00
}
2021-08-27 20:16:41 +02:00
}
2023-09-23 04:06:03 +02:00
+
2024-01-19 22:13:42 +01:00
+ // Paper start - More cat api
2021-08-27 20:16:41 +02:00
+ @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();
+ }
2024-01-19 22:13:42 +01:00
+ // Paper end - More cat api
2021-08-27 20:16:41 +02:00
}
2022-10-11 23:04:26 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
2023-10-27 01:34:58 +02:00
index 64b75682a936e071353707f7615d6ff512fd617d..96f6e2fd9c6b20d34122abfe5c7fba732502d5a0 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
2023-08-14 01:32:51 +02:00
@@ -18,4 +18,26 @@ public class CraftChicken extends CraftAnimals implements Chicken {
public String toString() {
return "CraftChicken";
2022-10-11 23:04:26 +02:00
}
2023-08-14 01:32:51 +02:00
+
2022-10-11 23:04:26 +02:00
+ // 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
}
2022-11-26 03:21:40 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
2023-08-14 01:32:51 +02:00
index fa0bf7db880063427ba12df1df1c72240fff93e9..63e6b07e3b159c74d9ef17be20b5ab43d07f0f5f 100644
2022-11-26 03:21:40 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
2023-08-14 01:32:51 +02:00
@@ -3,7 +3,7 @@ package org.bukkit.craftbukkit.entity;
import org.bukkit.craftbukkit.CraftServer;
2022-11-26 03:21:40 +01:00
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);
2024-01-18 22:00:40 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
2024-10-23 20:15:25 +02:00
index 5bae70ad160d0d0912aa9ef054c5515812957289..83867b9c5497e6e793b21c482646cc419587e182 100644
2024-01-18 22:00:40 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java
2024-10-23 20:15:25 +02:00
@@ -18,4 +18,36 @@ public class CraftDolphin extends CraftAgeable implements Dolphin {
2024-01-18 22:00:40 +01:00
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
}
2024-05-30 22:31:45 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
index cc4194ac9d7501b5d15655674dade14d59cb6733..33ae03b78b01c005a291a343b42507fb539e81a6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
@@ -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();
2022-03-11 15:24:45 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
2023-10-27 01:34:58 +02:00
index 21dc209e6f98b6306833b41e2763e746047d5a94..983b9d6ddb58eff297e96e5c8b28ec427efa267d 100644
2022-03-11 15:24:45 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
2023-08-14 01:32:51 +02:00
@@ -40,6 +40,28 @@ public class CraftEnderman extends CraftMonster implements Enderman {
2022-03-11 15:24:45 +01:00
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() {
2023-10-27 01:34:58 +02:00
return (EnderMan) this.entity;
2022-10-11 23:04:26 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
2023-08-14 01:32:51 +02:00
index fc0f0e841dc974d080e1abb9bbafb5165801131f..d657fd2c507a5b215aeab0a5f3e9c2ee892a27c8 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
2023-08-14 01:32:51 +02:00
@@ -28,4 +28,15 @@ public class CraftEndermite extends CraftMonster implements Endermite {
2022-10-11 23:04:26 +02:00
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
}
2024-03-23 20:27:30 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
2024-11-09 21:17:42 +01:00
index 78afac72265e3f586c0203951b8237832fb7c6fb..888a75423ac90ca85308eeb6d67bac5348bf31e0 100644
2024-03-23 20:27:30 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
2024-11-09 21:17:42 +01:00
@@ -1082,4 +1082,27 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
2024-03-23 20:27:30 +01:00
return set;
}
2024-04-06 22:38:37 +02:00
// Paper end - tracked players API
2024-03-23 20:27:30 +01:00
+
2024-03-23 22:26:17 +01:00
+ // Paper start - missing entity api
2024-03-23 20:27:30 +01:00
+ @Override
2024-03-23 22:26:17 +01:00
+ public boolean isInvisible() { // Paper - moved up from LivingEntity
2024-03-23 20:27:30 +01:00
+ return this.getHandle().isInvisible();
+ }
+
+ @Override
2024-03-23 22:26:17 +01:00
+ public void setInvisible(boolean invisible) { // Paper - moved up from LivingEntity
2024-03-23 20:27:30 +01:00
+ this.getHandle().persistentInvisibility = invisible;
+ this.getHandle().setSharedFlag(Entity.FLAG_INVISIBLE, invisible);
+ }
2024-03-23 22:26:17 +01:00
+
+ @Override
+ public void setNoPhysics(boolean noPhysics) {
+ this.getHandle().noPhysics = noPhysics;
+ }
+
+ @Override
+ public boolean hasNoPhysics() {
+ return this.getHandle().noPhysics;
+ }
+ // Paper end - missing entity api
2024-03-23 20:27:30 +01:00
}
2024-03-20 22:33:34 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
2024-06-14 01:32:45 +02:00
index 142f3e3257afebb2e831fd0970678123d99a1717..1b084d63bdbb24dad45d28eed1693eb6e26e24dc 100644
2024-03-20 22:33:34 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
2024-06-13 16:45:27 +02:00
@@ -84,6 +84,18 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
2024-06-14 01:32:45 +02:00
return new Vector(delta.x, delta.y, delta.z);
2024-03-20 22:33:34 +01:00
}
+ // Paper start - Expose power on fireball projectiles
2024-06-13 16:45:27 +02:00
+ @Override
2024-03-20 22:33:34 +01:00
+ public void setPower(final Vector power) {
2024-06-13 16:45:27 +02:00
+ this.setAcceleration(power);
2024-03-20 22:33:34 +01:00
+ }
+
+ @Override
+ public Vector getPower() {
2024-06-13 16:45:27 +02:00
+ return this.getAcceleration();
+ }
2024-03-20 22:33:34 +01:00
+ // Paper end - Expose power on fireball projectiles
2024-06-13 16:45:27 +02:00
+
2024-03-20 22:33:34 +01:00
@Override
public AbstractHurtingProjectile getHandle() {
2024-06-13 16:45:27 +02:00
return (AbstractHurtingProjectile) this.entity;
2021-06-22 09:44:02 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
2024-10-23 20:15:25 +02:00
index dd912be2933864236cd4fb35631d505972082d77..bb2b59ce9775a0d1dd9828885e57c14cf40d9f04 100644
2021-06-22 09:44:02 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
2023-08-14 01:32:51 +02:00
@@ -113,4 +113,41 @@ public class CraftFox extends CraftAnimals implements Fox {
2022-07-22 20:18:00 +02:00
public boolean isFaceplanted() {
return this.getHandle().isFaceplanted();
2021-06-22 09:44:02 +02:00
}
2022-07-22 20:18:00 +02:00
+
2021-06-22 09:44:02 +02:00
+ // Paper start - Add more fox behavior API
+ @Override
+ public void setInterested(boolean interested) {
2021-08-27 20:16:41 +02:00
+ this.getHandle().setIsInterested(interested);
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public boolean isInterested() {
2021-08-27 20:16:41 +02:00
+ return this.getHandle().isInterested();
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public void setLeaping(boolean leaping) {
2021-08-27 20:16:41 +02:00
+ this.getHandle().setIsPouncing(leaping);
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public boolean isLeaping() {
2021-08-27 20:16:41 +02:00
+ return this.getHandle().isPouncing();
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public void setDefending(boolean defending) {
2021-08-27 20:16:41 +02:00
+ this.getHandle().setDefending(defending);
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public boolean isDefending() {
2021-08-27 20:16:41 +02:00
+ return this.getHandle().isDefending();
2021-06-22 09:44:02 +02:00
+ }
+
+ @Override
+ public void setFaceplanted(boolean faceplanted) {
2021-08-27 20:16:41 +02:00
+ this.getHandle().setFaceplanted(faceplanted);
2021-06-22 09:44:02 +02:00
+ }
+ // Paper end - Add more fox behavior API
}
2022-03-06 22:20:38 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
2023-10-27 01:34:58 +02:00
index 2cec61a1bb050c1ef81c5fc3d0afafe9ff29d459..97fa4e1e70203194bd939618b2fad92665af6d59 100644
2022-03-06 22:20:38 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
2023-08-14 01:32:51 +02:00
@@ -28,4 +28,17 @@ public class CraftGhast extends CraftFlying implements Ghast, CraftEnemy {
2022-07-22 20:18:00 +02:00
public void setCharging(boolean flag) {
this.getHandle().setCharging(flag);
2022-03-06 22:20:38 +01:00
}
+
+ // 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
}
2023-11-11 22:04:34 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
2024-10-23 20:15:25 +02:00
index b5830f31c3444fcc6fea83a3b71a05bf07ce379d..00db6ba96bda7ceaae8bc69a6b3a42e7a3929485 100644
2023-11-11 22:04:34 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
2024-10-23 20:15:25 +02:00
@@ -128,6 +128,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
2024-05-30 22:31:45 +02:00
}
}
+ // 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();
2024-10-23 20:15:25 +02:00
@@ -939,14 +946,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
2024-03-23 20:27:30 +01:00
@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
2023-11-11 22:04:34 +01:00
}
+ // 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
2022-10-11 23:04:26 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
2024-05-11 23:48:37 +02:00
index bf297388c75521266c93580a9caafe6bad70ab45..351f42842b780d053cd2e5bad9ae299449141b10 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
2023-08-14 01:32:51 +02:00
@@ -58,4 +58,36 @@ public class CraftLlama extends CraftChestedHorse implements Llama, com.destroys
public String toString() {
return "CraftLlama";
2022-10-11 23:04:26 +02:00
}
+
+ // 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
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
2023-10-27 01:34:58 +02:00
index 17f5684cba9d3ed22d9925d1951520cc4751dfe2..3a3563a1bdbc0d84d973b3a04b50b78b4bc3d379 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
2023-08-14 01:32:51 +02:00
@@ -33,4 +33,20 @@ public final class CraftMinecartHopper extends CraftMinecartContainer implements
2022-10-11 23:04:26 +02:00
public void setEnabled(boolean enabled) {
2023-10-27 01:34:58 +02:00
((MinecartHopper) this.getHandle()).setEnabled(enabled);
2022-10-11 23:04:26 +02:00
}
+ // Paper start
+ @Override
+ public net.minecraft.world.entity.vehicle.MinecartHopper getHandle() {
+ return (net.minecraft.world.entity.vehicle.MinecartHopper) super.getHandle();
+ }
+
+ @Override
+ public int getPickupCooldown() {
2023-03-15 00:10:18 +01:00
+ throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
2022-10-11 23:04:26 +02:00
+ }
+
+ @Override
+ public void setPickupCooldown(int cooldown) {
2023-03-15 00:10:18 +01:00
+ throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
2022-10-11 23:04:26 +02:00
+ }
2023-11-11 22:17:36 +01:00
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
2024-10-23 20:15:25 +02:00
index bd739428a7e5e35ebcdb70cd187379b3d222339b..7cf42f62d91c131b1cab576979f85c58c3cecb3b 100644
2023-11-11 22:17:36 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
2024-10-23 20:15:25 +02:00
@@ -146,4 +146,16 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
2023-11-11 22:17:36 +01:00
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);
+ }
2022-10-11 23:04:26 +02:00
+ // Paper end
}
2022-01-18 00:23:44 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
2023-11-04 21:28:23 +01:00
index 5467e4a74b70ff57b49d9e6bc686c493178f8511..01d104d91de9e1319d27e39d3f474318c7809486 100644
2022-01-18 00:23:44 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
2023-11-04 21:28:23 +01:00
@@ -41,6 +41,38 @@ public class CraftPanda extends CraftAnimals implements Panda {
2022-01-18 00:23:44 +01:00
this.getHandle().setHiddenGene(CraftPanda.toNms(gene));
}
2023-11-04 21:28:23 +01:00
2022-01-18 00:23:44 +01:00
+ // 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);
+ }
2023-11-04 21:28:23 +01:00
+
+ @Override
+ public Gene getCombinedGene() {
+ return CraftPanda.fromNms(this.getHandle().getVariant());
+ }
2022-01-18 00:23:44 +01:00
+ // Paper end - Panda API
2023-11-04 21:28:23 +01:00
+
2022-07-22 20:18:00 +02:00
@Override
public boolean isRolling() {
2023-11-04 21:28:23 +01:00
return this.getHandle().isRolling();
2022-10-11 23:04:26 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
2024-06-24 00:42:44 +02:00
index 9304e201db1ec96d0916aa8ea781f3e4bc7991e6..83e77c6d287d8e239d2f55f3e9f19ef74946be7c 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
2024-06-24 00:42:44 +02:00
@@ -44,5 +44,17 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
2022-10-11 23:04:26 +02:00
public void setShouldBurnInDay(boolean shouldBurnInDay) {
getHandle().setShouldBurnInDay(shouldBurnInDay);
}
+
+ @Override
+ public org.bukkit.Location getAnchorLocation() {
+ net.minecraft.core.BlockPos pos = this.getHandle().anchorPoint;
2023-06-08 22:56:13 +02:00
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
2022-10-11 23:04:26 +02:00
+ }
+
+ @Override
+ public void setAnchorLocation(org.bukkit.Location location) {
2024-06-24 00:42:44 +02:00
+ com.google.common.base.Preconditions.checkArgument(location != null, "location cannot be null");
+ this.getHandle().anchorPoint = io.papermc.paper.util.MCUtil.toBlockPosition(location);
2022-10-11 23:04:26 +02:00
+ }
// Paper end
}
2022-03-19 15:30:16 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
2024-01-14 13:33:47 +01:00
index f5ecb8c1dc92e5a4b123effd2859123b17a586d3..5124a383b60b2c8de89fa992547d0c61db760c21 100644
2022-03-19 15:30:16 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
2023-09-14 12:54:43 +02:00
@@ -84,4 +84,37 @@ public class CraftPiglin extends CraftPiglinAbstract implements Piglin, com.dest
2022-03-19 15:30:16 +01:00
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();
+ }
2023-09-14 12:54:43 +02:00
+
+ @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();
+ }
2022-03-19 15:30:16 +01:00
+ // Paper end
}
2022-03-11 15:24:45 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
2023-10-27 01:34:58 +02:00
index c7aec6f28e5d3546235b30f6b1112440a76163c5..fe075cfdf3097d6cb768e71b8cc360abb8eaf367 100644
2022-03-11 15:24:45 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
2023-08-14 01:32:51 +02:00
@@ -17,4 +17,16 @@ public class CraftPolarBear extends CraftAnimals implements PolarBear {
public String toString() {
return "CraftPolarBear";
2022-03-11 15:24:45 +01:00
}
+
+ // Paper start
+ @Override
+ public boolean isStanding() {
+ return this.getHandle().isStanding();
+ }
+
+ @Override
+ public void setStanding(boolean standing) {
+ this.getHandle().setStanding(standing);
+ }
2022-12-10 01:56:13 +01:00
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
Updated Upstream (Bukkit/CraftBukkit) (#10034)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries
CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion
Spigot Changes:
06d602e7 Rebuild patches
2023-12-17 03:09:28 +01:00
index 6b48b117a9cba12aae055c0ea981dfb5bc03a86e..519ef701a7d6534f7cb516f6296b95ee521f661d 100644
2022-12-10 01:56:13 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
Updated Upstream (Bukkit/CraftBukkit) (#10034)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries
CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion
Spigot Changes:
06d602e7 Rebuild patches
2023-12-17 03:09:28 +01:00
@@ -29,4 +29,15 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
2023-07-04 10:22:56 +02:00
public void setRabbitType(Type type) {
this.getHandle().setVariant(net.minecraft.world.entity.animal.Rabbit.Variant.values()[type.ordinal()]);
2022-12-10 01:56:13 +01:00
}
+ // Paper start
+ @Override
+ public void setMoreCarrotTicks(int ticks) {
+ this.getHandle().moreCarrotTicks = ticks;
+ }
+
+ @Override
+ public int getMoreCarrotTicks() {
+ return this.getHandle().moreCarrotTicks;
+ }
2022-10-11 23:04:26 +02:00
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java
2023-08-14 01:32:51 +02:00
index cae59f77c704a5b9515dc4917ed5fdc89631ecfb..09796ce15658e3f7c223a265a547a51ee729ed40 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java
2023-08-14 01:32:51 +02:00
@@ -18,4 +18,35 @@ public class CraftRavager extends CraftRaider implements Ravager {
2022-10-11 23:04:26 +02:00
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;
+ }
2022-03-11 15:24:45 +01:00
+ // Paper end
}
2022-11-26 03:21:40 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
2024-10-23 20:15:25 +02:00
index 551c30cb0fb41dfe4a03663d34ecf9764566c215..7660cc21e936002ebb23510f0ec2b58d71e5157d 100644
2022-11-26 03:21:40 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
2024-10-23 20:15:25 +02:00
@@ -4,7 +4,7 @@ import com.google.common.base.Preconditions;
2023-08-14 01:32:51 +02:00
import org.bukkit.craftbukkit.CraftServer;
2022-11-26 03:21:40 +01:00
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);
2024-01-20 00:01:12 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
2024-10-23 20:15:25 +02:00
index 36ab282e2c4060bdea4e57f3ab9dfef9f6cd622c..a61aec087fa7cec27a803668bdc1b9e6eb336755 100644
2024-01-20 00:01:12 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
@@ -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
}
2022-12-23 21:50:32 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java
2023-10-27 01:34:58 +02:00
index 451a9bfd9b9b6945e224f1bb05c7951ed934b4e3..d7c6a0bbc5671ea8f2488230c94df5146a1e98b9 100644
2022-12-23 21:50:32 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java
2023-08-14 01:32:51 +02:00
@@ -28,4 +28,15 @@ public class CraftTadpole extends CraftFish implements org.bukkit.entity.Tadpole
2022-12-23 21:50:32 +01:00
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
}
2022-03-11 15:24:45 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
2024-04-24 16:29:12 +02:00
index 33d6e8121755ad6cddacb4fc69e795f9831c27bd..e374b9f40eddca13b30855d25a2030f8df98138f 100644
2022-03-11 15:24:45 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
2024-04-24 16:29:12 +02:00
@@ -31,4 +31,27 @@ public class CraftTrident extends CraftAbstractArrow implements Trident {
2023-08-14 01:32:51 +02:00
public String toString() {
return "CraftTrident";
2022-03-11 15:24:45 +01:00
}
+
+ // 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
}
2022-11-26 03:21:40 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
2023-10-27 01:34:58 +02:00
index e3bde6d1c0e03407af1382a61748470063bb2e18..9e53c30801c700719c78c0fd521fd615c94e02c8 100644
2022-11-26 03:21:40 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
2023-08-14 01:32:51 +02:00
@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.CraftServer;
2022-11-26 03:21:40 +01:00
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);
2022-03-19 15:30:16 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
2023-10-27 01:34:58 +02:00
index 1cfbe9c476f4a254edf3edf4b70696bbaba78558..e9ec3455eabc473e104b5342a615a38c1ac25a4f 100644
2022-03-19 15:30:16 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
2023-08-14 01:32:51 +02:00
@@ -29,6 +29,26 @@ public class CraftVex extends CraftMonster implements Vex {
2022-03-19 15:30:16 +01:00
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
2022-07-07 23:43:28 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
2024-01-21 19:37:09 +01:00
index e2a0c11867abee6add8775259c54f2052de7b1ad..3aa23d9f22d5cd22231293fd7d1ca4cb79eb7cb3 100644
2022-07-07 23:43:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
2023-09-23 04:06:03 +02:00
@@ -60,13 +60,20 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager {
2022-07-07 23:43:28 +02:00
@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) {
2024-01-21 19:37:09 +01:00
+ // Paper end - missing entity behaviour api - converting without entity event
2022-07-07 23:43:28 +02:00
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 {
2023-06-13 01:51:45 +02:00
- this.getHandle().startConverting(null, time);
+ this.getHandle().startConverting(null, time, broadcastEntityEvent); // Paper - missing entity behaviour api - converting without entity event
2022-07-07 23:43:28 +02:00
}
}
2022-10-11 23:04:26 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
2023-10-27 01:34:58 +02:00
index 0e597394a3dd08f022614fc9777302fea581eb55..3cceefa0d6278924a19641a49bdf16bcdacb2233 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
2023-08-14 01:32:51 +02:00
@@ -49,5 +49,25 @@ public class CraftWanderingTrader extends CraftAbstractVillager implements Wande
2022-10-11 23:04:26 +02:00
public boolean canDrinkMilk() {
return getHandle().canDrinkMilk;
}
+
+ @Override
+ public org.bukkit.Location getWanderingTowards() {
2022-11-20 00:53:20 +01:00
+ net.minecraft.core.BlockPos pos = this.getHandle().getWanderTarget();
2022-10-11 23:04:26 +02:00
+ if (pos == null) {
+ return null;
+ }
+
2023-06-08 22:56:13 +02:00
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
2022-10-11 23:04:26 +02:00
+ }
+
+ @Override
+ public void setWanderingTowards(org.bukkit.Location location) {
+ net.minecraft.core.BlockPos pos = null;
+ if (location != null) {
2022-10-24 21:43:46 +02:00
+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
2022-10-11 23:04:26 +02:00
+ }
+
2022-11-20 00:53:20 +01:00
+ this.getHandle().setWanderTarget(pos);
2022-10-11 23:04:26 +02:00
+ }
// Paper end
}
2022-08-14 10:25:28 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
2023-10-27 01:34:58 +02:00
index 794e4fe0a3fbd967f665b2707865c15491370c76..c284eb96a1e330078076cbe61f0f6e2ff4ed89bd 100644
2022-08-14 10:25:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
2023-08-14 01:32:51 +02:00
@@ -37,6 +37,13 @@ public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warde
2022-08-14 10:25:28 +02:00
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");
2022-03-11 15:24:45 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
2024-06-16 18:04:11 +02:00
index 1113533d281ed159bb735040fb1f913482debf3a..7881c6253c1d652c0c0d54a9a8accdf0a1ff0f3e 100644
2022-03-11 15:24:45 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
2023-08-14 01:32:51 +02:00
@@ -67,4 +67,36 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
2023-05-12 13:10:08 +02:00
this.getHandle().setInvulnerableTicks(ticks);
2022-03-11 15:24:45 +01:00
}
+
+ // 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() {
2024-06-16 18:04:11 +02:00
+ return getHandle().canUsePortal(false);
2022-03-11 15:24:45 +01:00
+ }
+
+ @Override
+ public void setCanTravelThroughPortals(boolean value) {
+ getHandle().setCanTravelThroughPortals(value);
+ }
2023-05-12 22:24:50 +02:00
+
+ @Override
+ public void enterInvulnerabilityPhase() {
+ this.getHandle().makeInvulnerable();
+ }
2022-03-11 15:24:45 +01:00
+ // Paper end
}