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.animal.MushroomCow effect
public net.minecraft.world.entity.animal.MushroomCow effectDuration
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.vehicle.MinecartHopper cooldownTime
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
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>
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
2023-04-07 20:39:13 +02:00
index f80a6ad7638453348ee82ea00b166a3aac029142..a08c00b8c0488d18be5e182f7892e5ab71d12247 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
2022-12-08 19:23:12 +01: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
2023-06-08 04:04:01 +02:00
index 39ed3ca76d6b64ef3917280ec822721cc02afada..86b437836cb4b1f6e8ca9acd5f1f93b925cf9e51 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
@@ -52,6 +52,7 @@ public abstract class AbstractSchoolingFish extends AbstractFish {
}
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
2023-07-04 10:22:56 +02:00
index 9c7c59d1230110010033a9c9959b375eac3ebc2b..7c81c6ebe200a029a5944b65827223e81ab08938 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
2023-07-04 10:22:56 +02:00
@@ -546,11 +546,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
2023-06-08 04:04:01 +02:00
index 71a08510a928d4570822282bb31f14013ec3834a..4aeab90e778629c355189dfe79c39c4b21f5f5ac 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
@@ -44,6 +44,7 @@ public class Tadpole extends AbstractFish {
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);
@@ -94,7 +95,7 @@ public class Tadpole extends AbstractFish {
@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);
}
@@ -104,12 +105,14 @@ public class Tadpole extends AbstractFish {
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
@@ -162,6 +165,7 @@ public class Tadpole extends AbstractFish {
CompoundTag nbttagcompound = stack.getOrCreateTag();
nbttagcompound.putInt("Age", this.getAge());
+ nbttagcompound.putBoolean("AgeLocked", this.ageLocked); // Paper
}
@Override
@@ -171,6 +175,7 @@ public class Tadpole extends AbstractFish {
this.setAge(nbt.getInt("Age"));
}
+ this.ageLocked = nbt.getBoolean("AgeLocked"); // Paper
}
@Override
@@ -205,6 +210,7 @@ public class Tadpole extends AbstractFish {
}
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
2023-09-22 09:24:44 +02:00
index 9f46eb8417ad19e6f1bbf369f4c6b94fdb915f5b..a974b57dfb007d14194c566421216003ffb0c5d6 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
2023-09-22 09:24:44 +02:00
@@ -698,6 +698,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
2021-10-21 03:09:42 +02:00
}
+ // 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
2022-12-07 21:16:54 +01:00
+
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
if (!this.isVehicle() && !this.isBaby()) {
2023-09-22 09:24:44 +02:00
@@ -740,6 +749,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
2021-10-21 03:09:42 +02:00
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);
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
2023-09-22 09:24:44 +02:00
index edbb933d1f6f7fc6432f7a8b074c5dc20f47adfb..91fb62807b3c5600c83d4dc8d3fadf36e94e2133 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
2023-09-22 09:24:44 +02:00
@@ -74,7 +74,7 @@ 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);
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
2023-07-04 10:22:56 +02:00
index c23f05f0d951e0036fe2cf524989747fe236730b..cd59500565a305757872aaf41b03b49ffc005af5 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
2023-03-14 21:25:13 +01:00
@@ -84,6 +84,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
2022-03-11 15:24:45 +01:00
return entityliving.getMobType() != MobType.UNDEAD && 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);
2023-03-14 21:25:13 +01:00
@@ -595,7 +600,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
2022-03-11 15:24:45 +01:00
@Override
public boolean canChangeDimensions() {
- return false;
+ return super.canChangeDimensions() && canPortal; // Paper
}
@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
2023-09-22 09:24:44 +02:00
index 5b3da07def02830e4332d7d3a7f7b968e5663c7b..74a4b1cdfe643007e0afd73f8eb0b1fbe29722cf 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
2023-09-22 09:24:44 +02:00
@@ -457,6 +457,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
2023-09-22 09:24:44 +02:00
index e398a7d5c560b1d94b21fe3241365ef8592d9fc8..c135bc245f59a1af706f98b9d140dee77016b12f 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
2023-09-22 09:24:44 +02:00
@@ -67,6 +67,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
2023-09-22 09:24:44 +02:00
index 4657bfce13ad95edf1964eb361d5679f93ca2ab2..4b2cd6d34ea4081cad86041f57ccda41807d4279 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
2023-09-22 09:24:44 +02:00
@@ -201,6 +201,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);
2023-09-22 09:24:44 +02:00
@@ -208,7 +214,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
2023-06-08 04:04:01 +02:00
index 61d4877b4f74362e38104bfeacb7d66534ad798e..454dd67920826b8b62c2654abfd43fc08c2648e4 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
@@ -105,6 +105,20 @@ public class ThrownTrident extends AbstractArrow {
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) {
2022-11-26 03:21:40 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
2023-09-10 04:28:03 +02:00
index 5a949e1d482e2485742e24b63395204b7fc7d1f5..977012bfa4c42d619f2e9729c2be032999c403f7 100644
2022-11-26 03:21:40 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
2023-06-13 01:51:45 +02:00
@@ -828,14 +828,19 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
2022-11-26 03:21:40 +01:00
} else if (Phantom.class.isAssignableFrom(clazz)) {
entity = net.minecraft.world.entity.EntityType.PHANTOM.create(world);
} else if (Fish.class.isAssignableFrom(clazz)) {
- if (Cod.class.isAssignableFrom(clazz)) {
- entity = net.minecraft.world.entity.EntityType.COD.create(world);
+ // Paper start - Schooling Fish API
+ if (io.papermc.paper.entity.SchoolableFish.class.isAssignableFrom(clazz)) {
+ if (Cod.class.isAssignableFrom(clazz)) {
+ entity = net.minecraft.world.entity.EntityType.COD.create(world);
+ } else if (Salmon.class.isAssignableFrom(clazz)) {
+ entity = net.minecraft.world.entity.EntityType.SALMON.create(world);
+ } else if (TropicalFish.class.isAssignableFrom(clazz)) {
+ entity = net.minecraft.world.entity.EntityType.TROPICAL_FISH.create(world);
+ }
+ // Paper stop
} else if (PufferFish.class.isAssignableFrom(clazz)) {
entity = net.minecraft.world.entity.EntityType.PUFFERFISH.create(world);
- } else if (Salmon.class.isAssignableFrom(clazz)) {
- entity = net.minecraft.world.entity.EntityType.SALMON.create(world);
- } else if (TropicalFish.class.isAssignableFrom(clazz)) {
- entity = net.minecraft.world.entity.EntityType.TROPICAL_FISH.create(world);
+ // Paper - remove old fish impl
} else if (Tadpole.class.isAssignableFrom(clazz)) {
entity = net.minecraft.world.entity.EntityType.TADPOLE.create(world);
}
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
2023-06-13 01:51:45 +02:00
index 3f1f4d65525562b3117fdc21c8a7f535b12c3c46..90a989c7c9de6f9ba55ab640761915e98320642a 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
2023-09-22 09:24:44 +02:00
index 1d910c34bc1154243b5a3bd774c70f1808d60a25..e2cfb4a162efaa3cae1fdae95ec74efe4a3af627 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
2023-09-22 09:24:44 +02:00
@@ -223,4 +223,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-08-14 01:32:51 +02:00
index f049fd8b8fdfca6e64010741d000a2e3efddc83b..7592ecac3d0893974d9d22ce40c50f1008ab9695 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-08-14 01:32:51 +02:00
index 86ad6073a130100258908d3f2c93c54e21e998f3..17608e0e8cc5288905d2e42ae1429f7d947511fb 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
2023-08-14 01:32:51 +02:00
index 566da8f88d9ee76baf41e5a4cdf0b73fd424c6b9..533a339a2c7369475f1a66ae2c8bb1df04914614 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
2023-08-14 01:32:51 +02:00
@@ -44,4 +44,25 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
2021-08-27 20:16:41 +02:00
public void setCollarColor(DyeColor color) {
this.getHandle().setCollarColor(net.minecraft.world.item.DyeColor.byId(color.getWoolData()));
}
+ // 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
}
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-08-14 01:32:51 +02:00
index c2c653e269330b8494eca98e9cf5a4abb79a6933..5e0b611db52452c00bf3cd2fc07dd713f238a581 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);
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-08-14 01:32:51 +02:00
index cb161c3d1a08d9c143201040018664298e98eafe..92eb829161079c4a96447698aee58cc6e7cbd29f 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() {
return (EnderMan) 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
}
2022-11-26 03:21:40 +01:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
2023-09-22 09:24:44 +02:00
index de7deb9c27ffb7628124270091a5ba81b075c824..4fe558a882e87912e408b5bbd223666969e30029 100644
2022-11-26 03:21:40 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
2023-08-14 01:32:51 +02:00
@@ -233,10 +233,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
2022-11-26 03:21:40 +01:00
else { return new CraftSquid(server, (Squid) entity); }
}
else if (entity instanceof AbstractFish) {
- if (entity instanceof Cod) { return new CraftCod(server, (Cod) entity); }
+ // Paper start - Schooling Fish API
+ if (entity instanceof net.minecraft.world.entity.animal.AbstractSchoolingFish abstractSchoolingFish) {
+ if (entity instanceof Cod) { return new CraftCod(server, (Cod) entity); }
+ else if (entity instanceof Salmon) { return new CraftSalmon(server, (Salmon) entity); }
+ else if (entity instanceof TropicalFish) { return new CraftTropicalFish(server, (TropicalFish) entity); }
+ else { return new io.papermc.paper.entity.PaperSchoolableFish(server, abstractSchoolingFish); }
+ }
+ // Paper end
else if (entity instanceof Pufferfish) { return new CraftPufferFish(server, (Pufferfish) entity); }
- else if (entity instanceof Salmon) { return new CraftSalmon(server, (Salmon) entity); }
- else if (entity instanceof TropicalFish) { return new CraftTropicalFish(server, (TropicalFish) entity); }
+ // Paper - move fish
else if (entity instanceof Tadpole) { return new CraftTadpole(server, (Tadpole) entity); }
else { return new CraftFish(server, (AbstractFish) 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
2023-08-14 01:32:51 +02:00
index 08911b340c45f0b6d4657bfe46f0b153997e4d49..6149067a14b950e727d3387055016a19e55c0fc6 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-08-14 01:32:51 +02:00
index 24938472b7898c4111a1f7244b207fd32fcf6e80..3adcf36c7b4beb0f752f91b7333593a610ec118c 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
}
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
2023-08-14 01:32:51 +02:00
index 9986ac517e11b076a29a8c8e3f480ec286fa5825..0ad16ee7b33582d214dab41eeee378d52c8e38ed 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-08-14 01:32:51 +02:00
index 3ba7e8ef1035e1de2c195b6919fe57aee398af51..fbabf86510c582e372b0b1ac5585c7287734c985 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) {
((MinecartHopper) 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() {
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
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
2023-08-14 01:32:51 +02:00
index de54d45d1764228bdbfb5a73173b551f25440898..3e0049c2442c5941e02da0b0fb643784746cb2a1 100644
2022-10-11 23:04:26 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
2023-08-14 01:32:51 +02:00
@@ -27,6 +27,38 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow {
2022-12-07 21:16:54 +01:00
this.getHandle().setVariant(net.minecraft.world.entity.animal.MushroomCow.MushroomType.values()[variant.ordinal()]);
2022-10-11 23:04:26 +02:00
}
+ // Paper start
+ @Override
+ public int getStewEffectDuration() {
+ return this.getHandle().effectDuration;
+ }
+
+ @Override
+ public void setStewEffectDuration(int duration) {
+ this.getHandle().effectDuration = duration;
+ }
+
+ @Override
+ public org.bukkit.potion.PotionEffectType getStewEffectType() {
+ net.minecraft.world.effect.MobEffect effect = this.getHandle().effect;
+ if (effect == null) {
+ return null;
+ }
+
+ return org.bukkit.potion.PotionEffectType.getById(net.minecraft.world.effect.MobEffect.getId(effect));
+ }
+
+ @Override
+ public void setStewEffect(org.bukkit.potion.PotionEffectType type) {
+ net.minecraft.world.effect.MobEffect effect = null;
+ if (type != null) {
+ effect = net.minecraft.world.effect.MobEffect.byId(type.getId());
+ }
+
+ this.getHandle().effect = effect;
+ }
+ // Paper end
+
@Override
public String toString() {
return "CraftMushroomCow";
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-08-14 01:32:51 +02:00
index 5467e4a74b70ff57b49d9e6bc686c493178f8511..56f9630dbe5d18d5ec33dc85f6531723022d6a3b 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-08-14 01:32:51 +02:00
@@ -40,6 +40,32 @@ public class CraftPanda extends CraftAnimals implements Panda {
2022-01-18 00:23:44 +01:00
public void setHiddenGene(Gene gene) {
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);
+ }
+ // Paper end - Panda API
2022-07-22 20:18:00 +02:00
@Override
public boolean 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
2023-08-14 01:32:51 +02:00
index 9304e201db1ec96d0916aa8ea781f3e4bc7991e6..8338effd39b1709dbe578e247710a8e58d83e3aa 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
2023-08-14 01:32:51 +02:00
@@ -44,5 +44,25 @@ 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;
+ 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 setAnchorLocation(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().anchorPoint = pos;
+ }
// 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
2023-09-14 12:54:43 +02:00
index 8b9695de6e3411cbcc2f97e4a4e243ec1d1dd076..03e74b29ebf0f9b9a0dbc6ffc872e22a22be20f0 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-08-14 01:32:51 +02:00
index bf216a7b5438a16f1f50fa6d2fb67eebe1408ad3..3c4cbde06c768912332edf57768eabe082e47345 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
2023-08-14 01:32:51 +02:00
index 3c86feb0fea21d37e0c5175776a3d7844272e911..1a1dfb9e5164f9962059ebf11a9c3334a1987153 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
2023-08-14 01:32:51 +02:00
@@ -30,4 +30,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
2023-08-14 01:32:51 +02:00
index b8140aa25a25870259b5644091c6643da1e14b54..d4d8ce60098c74508e2de9541bf6534988779764 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
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.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);
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-08-14 01:32:51 +02:00
index 0e23bb2d8754a4124126803a6bbca22129d32381..730a25ef2fe934f64f65c21e4e007cf1dbab8bf2 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
2023-08-14 01:32:51 +02:00
index 2d1fcbbaba2b88f2c19ae7553d89e50b30cf6581..c628594b981f276acae7b9337100d811f919631b 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
2023-08-14 01:32:51 +02:00
@@ -31,4 +31,27 @@ public class CraftTrident extends CraftArrow implements Trident {
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-08-14 01:32:51 +02:00
index 9982d94f19d0f201840653c227f1875c83de0723..d1d932dd27cff00e0ab69443a58715e3cbc1e57c 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-08-14 01:32:51 +02:00
index c4f7216c7ca7a49048fcf5240ef2a8f80e843f1c..6079581ba2eef8ac9272d0bbbf77e31f593edf0f 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
2023-08-14 01:32:51 +02:00
index d83c0e08610fff76f7bce1103acfa48be674c018..3c14554a6a657223441eee97258734ea05965bc7 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-08-14 01:32:51 +02:00
@@ -64,13 +64,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) {
+ // Paper stop - 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 {
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-08-14 01:32:51 +02:00
index 4a6700d7d2f40cf516054e2e3d09049f1ce4fd17..fd6ac99dae7e54b90f2b0e01430ac6db9410ccd4 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-08-14 01:32:51 +02:00
index 360c971f73a85e3841063dee9bc1da2ddfda4dae..46e3cc146a4b109c4baaf94f42d825646abade68 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
2023-08-14 01:32:51 +02:00
index 83353863e0c58995d3699d5f812d38cae056f695..5a97c92f9b044d8ab7bd3346ceb464455a09046e 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() {
+ return getHandle().canChangeDimensions();
+ }
+
+ @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
}