Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
275173e538
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: 0c5d8709 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends 255c4fdb SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot CraftBukkit Changes: b6b514b7e SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends fcff84de9 SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd 44a4b5649 SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot 676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
1248 Zeilen
53 KiB
Diff
1248 Zeilen
53 KiB
Diff
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
|
|
Subject: [PATCH] Missing Entity Behavior API
|
|
|
|
== AT ==
|
|
public net.minecraft.world.entity.animal.Fox isDefending()Z
|
|
public net.minecraft.world.entity.animal.Fox setDefending(Z)V
|
|
public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V
|
|
public net.minecraft.world.entity.animal.Panda getEatCounter()I
|
|
public net.minecraft.world.entity.animal.Panda setEatCounter(I)V
|
|
public net.minecraft.world.entity.animal.Bee isRolling()Z
|
|
public net.minecraft.world.entity.animal.Bee setRolling(Z)V
|
|
public net.minecraft.world.entity.animal.Bee numCropsGrownSincePollination
|
|
public net.minecraft.world.entity.animal.Bee ticksWithoutNectarSinceExitingHive
|
|
public net.minecraft.world.entity.monster.piglin.Piglin isChargingCrossbow()Z
|
|
public net.minecraft.world.entity.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
|
|
public net.minecraft.world.entity.vehicle.MinecartTNT explode(D)V
|
|
public net.minecraft.world.entity.vehicle.MinecartTNT fuse
|
|
public net.minecraft.world.entity.monster.Endermite life
|
|
public net.minecraft.world.entity.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;
|
|
public net.minecraft.world.entity.animal.AbstractSchoolingFish leader
|
|
public net.minecraft.world.entity.animal.AbstractSchoolingFish schoolSize
|
|
public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks
|
|
|
|
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
|
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
|
|
Co-authored-by: booky10 <boooky10@gmail.com>
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
|
index f80a6ad7638453348ee82ea00b166a3aac029142..a08c00b8c0488d18be5e182f7892e5ab71d12247 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
|
@@ -164,7 +164,7 @@ public class MobGoalHelper {
|
|
bukkitMap.put(net.minecraft.world.entity.monster.Endermite.class, Endermite.class);
|
|
bukkitMap.put(net.minecraft.world.entity.monster.Evoker.class, Evoker.class);
|
|
bukkitMap.put(AbstractFish.class, Fish.class);
|
|
- bukkitMap.put(AbstractSchoolingFish.class, Fish.class); // close enough
|
|
+ bukkitMap.put(AbstractSchoolingFish.class, io.papermc.paper.entity.SchoolableFish.class);
|
|
bukkitMap.put(FlyingMob.class, Flying.class);
|
|
bukkitMap.put(net.minecraft.world.entity.animal.Fox.class, Fox.class);
|
|
bukkitMap.put(net.minecraft.world.entity.monster.Ghast.class, Ghast.class);
|
|
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
|
|
index 39ed3ca76d6b64ef3917280ec822721cc02afada..86b437836cb4b1f6e8ca9acd5f1f93b925cf9e51 100644
|
|
--- 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;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
|
index 2824792295dab6e52015b479a77c61efb1150041..c2f56c44e824e3d4f169691b557483a4f0f5b3c6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
|
@@ -541,11 +541,13 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
|
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);
|
|
}
|
|
|
|
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
|
|
index 71a08510a928d4570822282bb31f14013ec3834a..4aeab90e778629c355189dfe79c39c4b21f5f5ac 100644
|
|
--- 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();
|
|
- if (!this.level().isClientSide) {
|
|
+ if (!this.level().isClientSide && !this.ageLocked) { // Paper
|
|
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);
|
|
}
|
|
|
|
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
|
|
index bb2a75f25a2959c8d387836f806b544b73e2e7c7..64b1668856bb2afda3707f7ccc11764fab33ae9f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
@@ -693,6 +693,15 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
|
|
|
}
|
|
|
|
+ // Paper Start - Horse API
|
|
+ public void setMouthOpen(boolean open) {
|
|
+ this.setFlag(FLAG_OPEN_MOUTH, open);
|
|
+ }
|
|
+ public boolean isMouthOpen() {
|
|
+ return this.getFlag(FLAG_OPEN_MOUTH);
|
|
+ }
|
|
+ // Paper End - Horse API
|
|
+
|
|
@Override
|
|
public InteractionResult mobInteract(Player player, InteractionHand hand) {
|
|
if (!this.isVehicle() && !this.isBaby()) {
|
|
@@ -735,6 +744,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
|
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);
|
|
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
|
|
index 80ba55e9bbbc69dab0d420a5cd846aa78424bbe4..4033945cb992e2c9bf42b8a7eda581319a6c6917 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
|
|
@@ -72,7 +72,7 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
|
|
@Nullable
|
|
private Llama caravanHead;
|
|
@Nullable
|
|
- private Llama caravanTail;
|
|
+ public Llama caravanTail; // Paper
|
|
|
|
public Llama(EntityType<? extends Llama> type, Level world) {
|
|
super(type, world);
|
|
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
|
|
index 4576c96f85fe5a614a78e53926dfbc2705618423..9adff51029781795c2cdf479a89111b3a1f102c0 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
|
@@ -84,6 +84,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
|
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);
|
|
@@ -595,7 +600,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
|
|
|
|
@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
|
|
index 58c52872d07130825922bcde32011647d46e171f..5519ccf558c09f32e19b35f4b403fc9ed966ed65 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
|
@@ -446,6 +446,16 @@ public class EnderMan extends Monster implements NeutralMob {
|
|
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;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ghast.java b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
|
|
index f535564035b80bc531198575acd0a7846a1197c2..592b0dae251800552a0771ec46b4b8532b63075d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Ghast.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Ghast.java
|
|
@@ -66,6 +66,12 @@ public class Ghast extends FlyingMob implements Enemy {
|
|
return this.explosionPower;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public void setExplosionPower(int explosionPower) {
|
|
+ this.explosionPower = explosionPower;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
protected boolean shouldDespawnInPeaceful() {
|
|
return true;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
|
index d673c4ff3274452433c9aa630ff320a38f68163a..59ed51907fc21784b37a55ee01207d8a730ae29a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
|
@@ -198,6 +198,12 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
|
}
|
|
|
|
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);
|
|
@@ -205,7 +211,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
|
this.removeEffect(MobEffects.WEAKNESS, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
|
|
this.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, delay, Math.min(this.level().getDifficulty().getId() - 1, 0)), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION);
|
|
// CraftBukkit end
|
|
- this.level().broadcastEntityEvent(this, (byte) 16);
|
|
+ if (broadcastEntityEvent) this.level().broadcastEntityEvent(this, (byte) 16); // Paper - missing entity behaviour api - converting without entity event
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownTrident.java
|
|
index 61d4877b4f74362e38104bfeacb7d66534ad798e..454dd67920826b8b62c2654abfd43fc08c2648e4 100644
|
|
--- 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) {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
index 248c8abf6620ac78b8a4fd1476d7b20862c6125b..7318209de454b233e22c20b176cb207de7f86674 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
@@ -828,14 +828,19 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
|
} 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);
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
|
index 3f1f4d65525562b3117fdc21c8a7f535b12c3c46..90a989c7c9de6f9ba55ab640761915e98320642a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
|
@@ -114,4 +114,36 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac
|
|
public AbstractHorseInventory getInventory() {
|
|
return new CraftSaddledInventory(getHandle().inventory);
|
|
}
|
|
+
|
|
+ // Paper start - Horse API
|
|
+ @Override
|
|
+ public boolean isEatingGrass() {
|
|
+ return this.getHandle().isEating();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setEatingGrass(boolean eating) {
|
|
+ this.getHandle().setEating(eating);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isRearing() {
|
|
+ return this.getHandle().isStanding();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setRearing(boolean rearing) {
|
|
+ this.getHandle().setForceStanding(rearing);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isEating() {
|
|
+ return this.getHandle().isMouthOpen();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setEating(boolean eating) {
|
|
+ this.getHandle().setMouthOpen(eating);
|
|
+ }
|
|
+ // Paper end - Horse API
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
|
|
index 3b960a832df1fe496ea036962083f1ac507a7db7..e405488ba5e0159ff84a72fac1d2da6e9c45238e 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java
|
|
@@ -33,4 +33,25 @@ public class CraftBat extends CraftAmbient implements Bat {
|
|
public void setAwake(boolean state) {
|
|
this.getHandle().setResting(!state);
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public org.bukkit.Location getTargetLocation() {
|
|
+ net.minecraft.core.BlockPos pos = this.getHandle().targetPosition;
|
|
+ if (pos == null) {
|
|
+ return null;
|
|
+ }
|
|
+
|
|
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setTargetLocation(org.bukkit.Location location) {
|
|
+ net.minecraft.core.BlockPos pos = null;
|
|
+ if (location != null) {
|
|
+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
|
|
+ }
|
|
+
|
|
+ this.getHandle().targetPosition = pos;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java
|
|
index 099c2422d03ebb6ee36f5c93f4cfad5acd2fdeeb..e222a6ab6afbc43a3d358a79855a818b0e481fdb 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java
|
|
@@ -92,4 +92,42 @@ public class CraftBee extends CraftAnimals implements Bee {
|
|
public void setCannotEnterHiveTicks(int ticks) {
|
|
this.getHandle().setStayOutOfHiveCountdown(ticks);
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void setRollingOverride(net.kyori.adventure.util.TriState rolling) {
|
|
+ this.getHandle().rollingOverride = rolling;
|
|
+
|
|
+ this.getHandle().setRolling(this.getHandle().isRolling()); // Refresh rolling state
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isRolling() {
|
|
+ return this.getRollingOverride().toBooleanOrElse(this.getHandle().isRolling());
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public net.kyori.adventure.util.TriState getRollingOverride() {
|
|
+ return this.getHandle().rollingOverride;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCropsGrownSincePollination(int crops) {
|
|
+ this.getHandle().numCropsGrownSincePollination = crops;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getCropsGrownSincePollination() {
|
|
+ return this.getHandle().numCropsGrownSincePollination;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setTicksSincePollination(int ticks) {
|
|
+ this.getHandle().ticksWithoutNectarSinceExitingHive = ticks;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getTicksSincePollination() {
|
|
+ return this.getHandle().ticksWithoutNectarSinceExitingHive;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
|
|
index d2531a2a323be74169324a5cb2c558655c380ea6..273a062090f4c6f6ffd5a4238623b32af497f6b6 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java
|
|
@@ -50,4 +50,25 @@ public class CraftCat extends CraftTameableAnimal implements Cat {
|
|
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
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
|
|
index 178328042ad62f32ca2ae14a6bcf2b694418eb8c..fd87f979ee207dac13e4028d76bdd40911509e56 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java
|
|
@@ -24,4 +24,25 @@ public class CraftChicken extends CraftAnimals implements Chicken {
|
|
public EntityType getType() {
|
|
return EntityType.CHICKEN;
|
|
}
|
|
+ // 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
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
|
|
index fb4b3d30eded561f526dbd2daa74e49149eb55ac..801ed8241cad4ac890a6d99cd19a3dd7490d9339 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
|
|
@@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
|
import org.bukkit.entity.Cod;
|
|
import org.bukkit.entity.EntityType;
|
|
|
|
-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);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
|
index fe829a74e23442c93bb5565589e8f33300ea01e1..57704564acc11ea688026aad8be4e612e36803ff 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
|
@@ -41,6 +41,28 @@ public class CraftEnderman extends CraftMonster implements Enderman {
|
|
this.getHandle().setCarriedBlock(blockData == null ? null : ((CraftBlockData) blockData).getState());
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public boolean isScreaming() {
|
|
+ return this.getHandle().isCreepy();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setScreaming(boolean screaming) {
|
|
+ this.getHandle().setCreepy(screaming);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean hasBeenStaredAt() {
|
|
+ return this.getHandle().hasBeenStaredAt();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setHasBeenStaredAt(boolean hasBeenStaredAt) {
|
|
+ this.getHandle().setHasBeenStaredAt(hasBeenStaredAt);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public EnderMan getHandle() {
|
|
return (EnderMan) entity;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
|
|
index 04976616da8c85b1278dad33ff05554aa74a6b33..75c7645fb5732c43d1da15181cf5c7ee4c3ecd6c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java
|
|
@@ -34,4 +34,15 @@ public class CraftEndermite extends CraftMonster implements Endermite {
|
|
public void setPlayerSpawned(boolean playerSpawned) {
|
|
// Nop
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void setLifetimeTicks(int ticks) {
|
|
+ this.getHandle().life = ticks;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getLifetimeTicks() {
|
|
+ return this.getHandle().life;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
index d3eaf054b1815003934e7f2d904a05a5d8abc3a5..02dc40b6f7b82ce503c33fb4af26cbb20c9d5b7a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
@@ -227,10 +227,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|
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); }
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
|
index 007b69c201672483103397c945634d7518f5861c..9e5c9b1c4299986b2fae7e191d7661549376a331 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
|
@@ -119,4 +119,41 @@ public class CraftFox extends CraftAnimals implements Fox {
|
|
public boolean isFaceplanted() {
|
|
return this.getHandle().isFaceplanted();
|
|
}
|
|
+
|
|
+ // Paper start - Add more fox behavior API
|
|
+ @Override
|
|
+ public void setInterested(boolean interested) {
|
|
+ this.getHandle().setIsInterested(interested);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isInterested() {
|
|
+ return this.getHandle().isInterested();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setLeaping(boolean leaping) {
|
|
+ this.getHandle().setIsPouncing(leaping);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isLeaping() {
|
|
+ return this.getHandle().isPouncing();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setDefending(boolean defending) {
|
|
+ this.getHandle().setDefending(defending);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isDefending() {
|
|
+ return this.getHandle().isDefending();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setFaceplanted(boolean faceplanted) {
|
|
+ this.getHandle().setFaceplanted(faceplanted);
|
|
+ }
|
|
+ // Paper end - Add more fox behavior API
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
|
|
index 9e7a9520737f56a20a130b624ae66f3ee90fa3e7..814cded47a04c25391575af036f53dc409121813 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java
|
|
@@ -34,4 +34,17 @@ public class CraftGhast extends CraftFlying implements Ghast, CraftEnemy {
|
|
public void setCharging(boolean flag) {
|
|
this.getHandle().setCharging(flag);
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public int getExplosionPower() {
|
|
+ return this.getHandle().getExplosionPower();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setExplosionPower(int explosionPower) {
|
|
+ com.google.common.base.Preconditions.checkArgument(explosionPower >= 0 && explosionPower <= 127, "The explosion power has to be between 0 and 127");
|
|
+ this.getHandle().setExplosionPower(explosionPower);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
|
index 5500d5768bb22f70b99aa28cf4541b4871e12139..4d7a2c4c1001aefe9fcd4be8dbcb414f721bfff9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
|
|
@@ -64,4 +64,36 @@ public class CraftLlama extends CraftChestedHorse implements Llama, com.destroys
|
|
public EntityType getType() {
|
|
return EntityType.LLAMA;
|
|
}
|
|
+
|
|
+ // 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
|
|
index ee9648739fb39c5842063d7442df6eb5c9336d7f..67fe56cc4c2af24f6bd883c6e14851019b0b9523 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
|
|
@@ -39,4 +39,20 @@ public final class CraftMinecartHopper extends CraftMinecartContainer implements
|
|
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() {
|
|
+ throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setPickupCooldown(int cooldown) {
|
|
+ throw new UnsupportedOperationException("Hopper minecarts don't have cooldowns");
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
|
|
index 383c6d464e8077eeb900d61baa6a02f15a818b01..20eaa3424428b8b30fd15591b660983cb7fc4375 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java
|
|
@@ -28,6 +28,38 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow {
|
|
this.getHandle().setVariant(net.minecraft.world.entity.animal.MushroomCow.MushroomType.values()[variant.ordinal()]);
|
|
}
|
|
|
|
+ // 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";
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
|
|
index ff9f711b83a8ea1bf4135751a9ba865224bce787..1f6dcad764240e15083731d017f9bb1c5c84622f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java
|
|
@@ -46,6 +46,32 @@ public class CraftPanda extends CraftAnimals implements Panda {
|
|
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
|
|
|
|
@Override
|
|
public boolean isRolling() {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
index 6b71f8b373ef524f5df16023b773e92249bb2532..63e31c237dc3cf37a5e06c1cf3f030c9f1df3d38 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
@@ -50,5 +50,25 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
|
|
public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
|
getHandle().setShouldBurnInDay(shouldBurnInDay);
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public org.bukkit.Location getAnchorLocation() {
|
|
+ net.minecraft.core.BlockPos pos = this.getHandle().anchorPoint;
|
|
+ if (pos == null) {
|
|
+ return null;
|
|
+ }
|
|
+
|
|
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setAnchorLocation(org.bukkit.Location location) {
|
|
+ net.minecraft.core.BlockPos pos = null;
|
|
+ if (location != null) {
|
|
+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
|
|
+ }
|
|
+
|
|
+ this.getHandle().anchorPoint = pos;
|
|
+ }
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
|
|
index aeda5fc001fe4ce55ee467240b275b6050a29f98..48d0a4e42e1b90d1323784d1284acabfe9497dd6 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java
|
|
@@ -90,4 +90,15 @@ public class CraftPiglin extends CraftPiglinAbstract implements Piglin, com.dest
|
|
public String toString() {
|
|
return "CraftPiglin";
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void setChargingCrossbow(boolean chargingCrossbow) {
|
|
+ this.getHandle().setChargingCrossbow(chargingCrossbow);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isChargingCrossbow() {
|
|
+ return this.getHandle().isChargingCrossbow();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
|
|
index da1488c9cae53bd554727c850da2192adda2478a..30a0eac179c86b0fe94a2a40b5bfcd3eee01e53b 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java
|
|
@@ -23,4 +23,16 @@ public class CraftPolarBear extends CraftAnimals implements PolarBear {
|
|
public EntityType getType() {
|
|
return EntityType.POLAR_BEAR;
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public boolean isStanding() {
|
|
+ return this.getHandle().isStanding();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setStanding(boolean standing) {
|
|
+ this.getHandle().setStanding(standing);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
|
|
index 3bdcc754a5afb6506178bd5c0d4f9c6e02bc24da..3cb4860fea30bfaf2147b4f29a34336b6e417d6c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java
|
|
@@ -48,4 +48,15 @@ public class CraftRabbit extends CraftAnimals implements Rabbit {
|
|
|
|
entity.setVariant(net.minecraft.world.entity.animal.Rabbit.Variant.values()[type.ordinal()]);
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void setMoreCarrotTicks(int ticks) {
|
|
+ this.getHandle().moreCarrotTicks = ticks;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getMoreCarrotTicks() {
|
|
+ return this.getHandle().moreCarrotTicks;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
|
|
index 7345a644b57c8022d9e326575419c87551c4e8fc..f0b061979f9acdce6d06f70b651692c841418d96 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java
|
|
@@ -63,4 +63,16 @@ public abstract class CraftRaider extends CraftMonster implements Raider {
|
|
public Sound getCelebrationSound() {
|
|
return CraftSound.getBukkit(this.getHandle().getCelebrateSound());
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public boolean isCelebrating() {
|
|
+ return this.getHandle().isCelebrating();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCelebrating(boolean celebrating) {
|
|
+ this.getHandle().setCelebrating(celebrating);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java
|
|
index 796b784d7a50e3a4aea5c67b7cd16d288ed392b0..84899714b96a7ed31ceee10373a62c37cab2ad2a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java
|
|
@@ -24,4 +24,35 @@ public class CraftRavager extends CraftRaider implements Ravager {
|
|
public String toString() {
|
|
return "CraftRavager";
|
|
}
|
|
+ // Paper start - Missing Entity Behavior
|
|
+ @Override
|
|
+ public int getAttackTicks() {
|
|
+ return this.getHandle().getAttackTick();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setAttackTicks(int ticks) {
|
|
+ this.getHandle().attackTick = ticks;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getStunnedTicks() {
|
|
+ return this.getHandle().getStunnedTick();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setStunnedTicks(int ticks) {
|
|
+ this.getHandle().stunnedTick = ticks;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getRoarTicks() {
|
|
+ return this.getHandle().getRoarTick();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setRoarTicks(int ticks) {
|
|
+ this.getHandle().roarTick = ticks;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
|
|
index f27a451f2e2343ab66c8cae24053fd1b6a0ea086..c888415f9b4f19db69667525e37279ab8be794f6 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
|
|
@@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
|
import org.bukkit.entity.EntityType;
|
|
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);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java
|
|
index 1dfd4d92dfcb55d26fc5e9adfd1df3fbc9f02ca0..43c2d820d164d36a28c4920d70aea2fe5096763a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java
|
|
@@ -34,4 +34,15 @@ public class CraftTadpole extends CraftFish implements org.bukkit.entity.Tadpole
|
|
public void setAge(int age) {
|
|
this.getHandle().age = age;
|
|
}
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void setAgeLock(boolean lock) {
|
|
+ this.getHandle().ageLocked = lock;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean getAgeLock() {
|
|
+ return this.getHandle().ageLocked;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
|
|
index bf5b2fd6676c4430578db4cc6c603c501cc5e349..832981b07ef5c633ef00a382f56798ee87eec0df 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
|
|
@@ -37,4 +37,27 @@ public class CraftTrident extends CraftArrow implements Trident {
|
|
public EntityType getType() {
|
|
return EntityType.TRIDENT;
|
|
}
|
|
+
|
|
+ // 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
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
|
|
index ee84a90772381f7cfe864642c860880b827d25ea..4352af0a76ce4a4cd4afbea96f4851ef2b64ac7d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
|
|
@@ -8,7 +8,7 @@ import org.bukkit.entity.EntityType;
|
|
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);
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
|
index 50b07045cd17a7576a436c64662ad039d4aa2132..bcfca66c7b99b9d514fe850d6cc6abd7e36ccaf7 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
|
@@ -30,6 +30,26 @@ public class CraftVex extends CraftMonster implements Vex {
|
|
public void setSummoner(org.bukkit.entity.Mob summoner) {
|
|
getHandle().setOwner(summoner == null ? null : ((CraftMob) summoner).getHandle());
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public boolean hasLimitedLifetime() {
|
|
+ return this.getHandle().hasLimitedLife;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setLimitedLifetime(boolean hasLimitedLifetime) {
|
|
+ this.getHandle().hasLimitedLife = hasLimitedLifetime;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getLimitedLifetimeTicks() {
|
|
+ return this.getHandle().limitedLifeTicks;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setLimitedLifetimeTicks(int ticks) {
|
|
+ this.getHandle().limitedLifeTicks = ticks;
|
|
+ }
|
|
// Paper end
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
|
|
index 20e11bb0ae8949988b3499ad85016379fbe83218..7d63e9b8c92da089886ce9118bea07077f0541cd 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java
|
|
@@ -70,13 +70,20 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager {
|
|
|
|
@Override
|
|
public void setConversionTime(int time) {
|
|
+ // Paper start - missing entity behaviour api - converting without entity event
|
|
+ this.setConversionTime(time, true);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setConversionTime(int time, boolean broadcastEntityEvent) {
|
|
+ // Paper 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 {
|
|
- this.getHandle().startConverting(null, time);
|
|
+ this.getHandle().startConverting(null, time, broadcastEntityEvent); // Paper - missing entity behaviour api - converting without entity event
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
|
|
index fa7107593b20e0151d8d67104e4a92dcc697d461..f9a3d060ff4da6047d11f2b024d144572c513399 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java
|
|
@@ -55,5 +55,25 @@ public class CraftWanderingTrader extends CraftAbstractVillager implements Wande
|
|
public boolean canDrinkMilk() {
|
|
return getHandle().canDrinkMilk;
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public org.bukkit.Location getWanderingTowards() {
|
|
+ net.minecraft.core.BlockPos pos = this.getHandle().getWanderTarget();
|
|
+ if (pos == null) {
|
|
+ return null;
|
|
+ }
|
|
+
|
|
+ return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setWanderingTowards(org.bukkit.Location location) {
|
|
+ net.minecraft.core.BlockPos pos = null;
|
|
+ if (location != null) {
|
|
+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location);
|
|
+ }
|
|
+
|
|
+ this.getHandle().setWanderTarget(pos);
|
|
+ }
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
|
|
index 08c55cb00c8ff3c39dd99c64227d5d60abee2a51..6ecdc4bf1f6b8f0363e667135ba463433be5c0fb 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
|
|
@@ -43,6 +43,13 @@ public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warde
|
|
return this.getHandle().getAngerManagement().getActiveAnger(((CraftEntity) entity).getHandle());
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public int getHighestAnger() {
|
|
+ return this.getHandle().getAngerManagement().getActiveAnger(null);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public void increaseAnger(Entity entity, int increase) {
|
|
Preconditions.checkArgument(entity != null, "Entity cannot be null");
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
|
index f9c3a14bf4674f21ed32f6dc2a4296a935dd2b6d..1477c2c04d8f5c5639ce94808fe2a7029cedaeb2 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
|
|
@@ -73,4 +73,36 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
|
|
|
|
this.getHandle().setInvulnerableTicks(ticks);
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public boolean isCharged() {
|
|
+ return getHandle().isPowered();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public int getInvulnerableTicks() {
|
|
+ return getHandle().getInvulnerableTicks();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setInvulnerableTicks(int ticks) {
|
|
+ getHandle().setInvulnerableTicks(ticks);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean canTravelThroughPortals() {
|
|
+ return getHandle().canChangeDimensions();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCanTravelThroughPortals(boolean value) {
|
|
+ getHandle().setCanTravelThroughPortals(value);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void enterInvulnerabilityPhase() {
|
|
+ this.getHandle().makeInvulnerable();
|
|
+ }
|
|
+ // Paper end
|
|
}
|