From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sun, 19 Mar 2023 14:35:46 -0700 Subject: [PATCH] Make CraftEntity#getHandle and overrides perform thread checks While these checks are painful, it should assist in debugging threading issues for plugins. diff --git a/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java b/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java index 41bf71d116ffc5431586ce54abba7f8def6c1dcf..519da6886613b8460e989767b1a21e3126cb1894 100644 --- a/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java +++ b/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java @@ -11,8 +11,16 @@ public class PaperSchoolableFish extends CraftFish implements SchoolableFish { super(server, entity); } + // Folia start - region threading + @Override + public AbstractSchoolingFish getHandleRaw() { + return (AbstractSchoolingFish)this.entity; + } + // Folia end - region threading + @Override public AbstractSchoolingFish getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AbstractSchoolingFish) super.getHandle(); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 39434804e84418e44d595012e8f2191176347e25..edb4ffe78e28755e061c46c6834bbc9b7a23ff16 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2927,6 +2927,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) { return false; } else { + if (this.valid) { // Folia - region threading - suppress entire event logic during worldgen // CraftBukkit start if (entity.getBukkitEntity() instanceof Vehicle && this.getBukkitEntity() instanceof LivingEntity) { VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.getBukkitEntity()); @@ -2948,6 +2949,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return false; } // CraftBukkit end + } // Folia - region threading - suppress entire event logic during worldgen if (this.isPassenger()) { this.stopRiding(); } @@ -3025,6 +3027,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { // CraftBukkit start + if (this.valid) { // Folia - region threading - suppress entire event logic during worldgen CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle(); Entity orig = craft == null ? null : craft.getHandle(); if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { @@ -3052,6 +3055,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S return false; } // CraftBukkit end + } // Folia - region threading - suppress entire event logic during worldgen if (this.passengers.size() == 1 && this.passengers.get(0) == entity) { this.passengers = ImmutableList.of(); } else { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java index 236f94348ff8da661e23e3e17b7fc1b143680da9..7d4cdb0c5cd24aee4c831e59836c5bdd0b9ea800 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/AbstractProjectile.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit.entity; +import net.minecraft.world.entity.Entity; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Projectile; @@ -38,6 +39,13 @@ public abstract class AbstractProjectile extends CraftEntity implements Projecti this.getHandle().hasBeenShot = beenShot; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.Projectile getHandleRaw() { + return (net.minecraft.world.entity.projectile.Projectile)this.entity; + } + // Folia end - region threading + @Override public boolean canHitEntity(org.bukkit.entity.Entity entity) { return this.getHandle().canHitEntity(((CraftEntity) entity).getHandle()); @@ -55,6 +63,7 @@ public abstract class AbstractProjectile extends CraftEntity implements Projecti @Override public net.minecraft.world.entity.projectile.Projectile getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.Projectile) entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java index f9cd595ec28f0284d11bae6bfc5bf92d56526ef9..a8479fa2839c77399be83dbf20051b33900044bb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java @@ -17,8 +17,16 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.horse.AbstractHorse getHandleRaw() { + return (net.minecraft.world.entity.animal.horse.AbstractHorse)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.horse.AbstractHorse getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.horse.AbstractHorse) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java index 5beaa2bb0d58fe477ce8d2de8b77600d3b416d8c..fa1bc80ae320c6d04acc20d6dec7df52a39d9920 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java @@ -15,8 +15,17 @@ public abstract class CraftAbstractSkeleton extends CraftMonster implements Abst throw new UnsupportedOperationException("Not supported."); } // Paper start + + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.AbstractSkeleton getHandleRaw() { + return (net.minecraft.world.entity.monster.AbstractSkeleton)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.AbstractSkeleton getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.AbstractSkeleton) super.getHandle(); } // Paper end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java index 34e4c763c7ec971885147ab2509281fad56e1ca6..a0a83e9111523a8080f30d0fdd35b9c9373ca359 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java @@ -17,8 +17,16 @@ public class CraftAbstractVillager extends CraftAgeable implements AbstractVilla super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.npc.AbstractVillager getHandleRaw() { + return (net.minecraft.world.entity.npc.AbstractVillager)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.npc.AbstractVillager getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (Villager) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java index ae16e8d1bfe8e9315391510eddb367a3fbdc9e03..bdbb54cc60c9afa8a7b89419563fcbe502554aac 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java @@ -63,8 +63,16 @@ public class CraftAgeable extends CraftCreature implements Ageable { } } + // Folia start - region threading + @Override + public AgeableMob getHandleRaw() { + return (AgeableMob)this.entity; + } + // Folia end - region threading + @Override public AgeableMob getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AgeableMob) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAllay.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAllay.java index c64918175ec08d20cde2bda9e0cac8b474385fe0..633c7581f9eec8a04598a62eae64adb617cf0fa7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAllay.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAllay.java @@ -16,8 +16,16 @@ public class CraftAllay extends CraftCreature implements org.bukkit.entity.Allay super(server, entity); } + // Folia start - region threading + @Override + public Allay getHandleRaw() { + return (Allay)this.entity; + } + // Folia end - region threading + @Override public Allay getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (Allay) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java index 2a2f9f0907eafcabef26a41d20f64a0aa953d181..8f654e3a210a332dc2d526b579d8fcf0c54e4d28 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAmbient.java @@ -9,8 +9,16 @@ public class CraftAmbient extends CraftMob implements Ambient { super(server, entity); } + // Folia start - region threading + @Override + public AmbientCreature getHandleRaw() { + return (AmbientCreature)this.entity; + } + // Folia end - region threading + @Override public AmbientCreature getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AmbientCreature) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java index ab42bc721d5b6c17c2ca6c7153b757571aea05e8..2887699c16b9452ce948f8b945c595ca55488cf7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAnimals.java @@ -15,8 +15,16 @@ public class CraftAnimals extends CraftAgeable implements Animals { super(server, entity); } + // Folia start - region threading + @Override + public Animal getHandleRaw() { + return (Animal)this.entity; + } + // Folia end - region threading + @Override public Animal getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (Animal) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java index a46b2dfb2f1c0c7c3b55d81fc881e481348f98b8..17f1d4bdd3ee642e5fa5e0d9f5a61348d9ee1e1d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java @@ -27,8 +27,16 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.AreaEffectCloud getHandleRaw() { + return (net.minecraft.world.entity.AreaEffectCloud)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.AreaEffectCloud getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.AreaEffectCloud) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java index ccda0d7a96c201905f0f62dcb0e5b278a51dee9f..3ba6c46e0f5bc5f6b5994d41aaa9c4dd8276df9b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java @@ -20,8 +20,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { return "CraftArmorStand"; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.decoration.ArmorStand getHandleRaw() { + return (net.minecraft.world.entity.decoration.ArmorStand)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.decoration.ArmorStand getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.decoration.ArmorStand) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java index 3a749f78be3968e499e096196eaaa0b433a53c06..6b2907f9fb74e5a5bbc7084d22318794b97dd1b7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -133,8 +133,16 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { this.getHandle().setShotFromCrossbow(shotFromCrossbow); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.AbstractArrow getHandleRaw() { + return (net.minecraft.world.entity.projectile.AbstractArrow)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.AbstractArrow getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.AbstractArrow) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java index cbfca242f820d238b112f8ce64e9de8398c48a1c..c5f0cd5e69a20f1fffcd017385bf9fab59630ffc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java @@ -10,8 +10,16 @@ public class CraftAxolotl extends CraftAnimals implements Axolotl, io.papermc.pa super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.axolotl.Axolotl getHandleRaw() { + return (net.minecraft.world.entity.animal.axolotl.Axolotl)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.axolotl.Axolotl getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.axolotl.Axolotl) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java index 1bb72f28085f3885bec068b586ec222111044884..1d09154b76d7f76e013a6980b5263215d26e81d9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBat.java @@ -8,8 +8,16 @@ public class CraftBat extends CraftAmbient implements Bat { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.ambient.Bat getHandleRaw() { + return (net.minecraft.world.entity.ambient.Bat)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.ambient.Bat getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.ambient.Bat) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java index 3dac93b0ab5d5acf5b33dc4b0efed60319eb657b..4fce53e012067f2cc91ae89b2254ebfd030017d5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBee.java @@ -13,8 +13,16 @@ public class CraftBee extends CraftAnimals implements Bee { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Bee getHandleRaw() { + return (net.minecraft.world.entity.animal.Bee)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Bee getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Bee) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java index a4c9c73691300880777483b0beb17e1bd6779d06..e19c8cb6cf3d4306d2779bc7329e0fdc7aef59da 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlaze.java @@ -8,8 +8,16 @@ public class CraftBlaze extends CraftMonster implements Blaze { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Blaze getHandleRaw() { + return (net.minecraft.world.entity.monster.Blaze)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Blaze getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Blaze) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlockDisplay.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlockDisplay.java index dd91de8f24c27b9318c2a898a49991d74c100bff..d7c34f601ce66a6b090ec431a0503462865155a8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBlockDisplay.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBlockDisplay.java @@ -12,8 +12,16 @@ public class CraftBlockDisplay extends CraftDisplay implements BlockDisplay { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.Display.BlockDisplay getHandleRaw() { + return (net.minecraft.world.entity.Display.BlockDisplay)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.Display.BlockDisplay getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.Display.BlockDisplay) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java index e33b1b6fd50a4eea57500cc00dba20d6edcab75d..f9a8e684a04c4ffdf566b29252e18dbfcf09ade9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java @@ -102,8 +102,16 @@ public class CraftBoat extends CraftVehicle implements Boat { return CraftBoat.boatStatusFromNms(this.getHandle().status); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.vehicle.Boat getHandleRaw() { + return (net.minecraft.world.entity.vehicle.Boat)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.vehicle.Boat getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.vehicle.Boat) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java index 80e571c977db5cdf43bfbfce035f37a3fa325c95..6fafba37dd7128a397ba046be7b33067c9e88f25 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCamel.java @@ -11,8 +11,16 @@ public class CraftCamel extends CraftAbstractHorse implements Camel { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.camel.Camel getHandleRaw() { + return (net.minecraft.world.entity.animal.camel.Camel)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.camel.Camel getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.camel.Camel) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java index 42342628227742aa7ee6b84caa0e1f13b498babe..8fa5a33a32ea0c9e5e7f941011612060db8ea826 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java @@ -16,8 +16,16 @@ public class CraftCat extends CraftTameableAnimal implements Cat { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Cat getHandleRaw() { + return (net.minecraft.world.entity.animal.Cat)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Cat getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Cat) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java index 4f661fbdb860cf550da0d952b775fe6f990b43b3..4a8b2b6bf80d43bba551c34a1a03fd5c9a9d7a02 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCaveSpider.java @@ -8,8 +8,16 @@ public class CraftCaveSpider extends CraftSpider implements CaveSpider { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.CaveSpider getHandleRaw() { + return (net.minecraft.world.entity.monster.CaveSpider)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.CaveSpider getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.CaveSpider) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java index f1844d697b91e61878ade5b922cf2a3a538365c7..c07479ea6eca28e47bb618b420e57814c861ef8d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestBoat.java @@ -18,8 +18,16 @@ public class CraftChestBoat extends CraftBoat implements org.bukkit.entity.Chest this.inventory = new CraftInventory(entity); } + // Folia start - region threading + @Override + public ChestBoat getHandleRaw() { + return (ChestBoat)this.entity; + } + // Folia end - region threading + @Override public ChestBoat getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (ChestBoat) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestedHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestedHorse.java index 40ee96e31dea64ab3a77553dbb6daad001736f2e..1a9986acde12881e32db67b9e7263072871331cb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChestedHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChestedHorse.java @@ -10,8 +10,16 @@ public abstract class CraftChestedHorse extends CraftAbstractHorse implements Ch super(server, entity); } + // Folia start - region threading + @Override + public AbstractChestedHorse getHandleRaw() { + return (AbstractChestedHorse)this.entity; + } + // Folia end - region threading + @Override public AbstractChestedHorse getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AbstractChestedHorse) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java index 96f6e2fd9c6b20d34122abfe5c7fba732502d5a0..a32874bc84a13c3be3512b46519e66b24a4dbce0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java @@ -9,8 +9,16 @@ public class CraftChicken extends CraftAnimals implements Chicken { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Chicken getHandleRaw() { + return (net.minecraft.world.entity.animal.Chicken)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Chicken getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Chicken) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java index 63e6b07e3b159c74d9ef17be20b5ab43d07f0f5f..7e3a560ff4a3d56e52534eb909eaf60424b84514 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java @@ -9,8 +9,16 @@ public class CraftCod extends io.papermc.paper.entity.PaperSchoolableFish implem super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Cod getHandleRaw() { + return (net.minecraft.world.entity.animal.Cod)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Cod getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Cod) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java index c2583982d84c736639eec511daba594d7806a628..963ef176acd9e3a182b51722544001e309f5d7ae 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java @@ -32,8 +32,16 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart { return this.getParent().isValid(); } + // Folia start - region threading + @Override + public EnderDragonPart getHandleRaw() { + return (EnderDragonPart)this.entity; + } + // Folia end - region threading + @Override public EnderDragonPart getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (EnderDragonPart) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java index 7babc404e4920cd264206d4e83b1be6f841cdb8c..6fef0910ee934aedc09bac212ef3fba4f546d5ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCow.java @@ -9,8 +9,16 @@ public class CraftCow extends CraftAnimals implements Cow { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Cow getHandleRaw() { + return (net.minecraft.world.entity.animal.Cow)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Cow getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Cow) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java index 664d9c1793b823ed03f198a936f2ebd9b7695898..da9a83f9b020f637e4485ca53bc97bb50596808c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java @@ -9,8 +9,16 @@ public class CraftCreature extends CraftMob implements Creature { super(server, entity); } + // Folia start - region threading + @Override + public PathfinderMob getHandleRaw() { + return (PathfinderMob)this.entity; + } + // Folia end - region threading + @Override public PathfinderMob getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (PathfinderMob) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java index 4191845bfe05d8691e50143c42090566522f7e74..7aea0d9f5c17c8dcab73ffe9906a456534c292b0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java @@ -79,8 +79,16 @@ public class CraftCreeper extends CraftMonster implements Creeper { this.getHandle().ignite(); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Creeper getHandleRaw() { + return (net.minecraft.world.entity.monster.Creeper)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Creeper getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Creeper) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDisplay.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDisplay.java index 48eeb1d9ba0ad6f895bfe507a6fbe4b9c9530e47..4eb5c99862c38cbaf3ba89be3ffc7a78b1a7276a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDisplay.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDisplay.java @@ -12,8 +12,16 @@ public class CraftDisplay extends CraftEntity implements Display { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.Display getHandleRaw() { + return (net.minecraft.world.entity.Display)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.Display getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.Display) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java index f93f8f6509b12eb9b1e07c829278bb0822dd7988..c693daa86c2e44165ca6a293563670dc82f30eb2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDolphin.java @@ -9,8 +9,16 @@ public class CraftDolphin extends CraftWaterMob implements Dolphin { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Dolphin getHandleRaw() { + return (net.minecraft.world.entity.animal.Dolphin)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Dolphin getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Dolphin) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java index 51fc4acae9f20e8891069704e4a27f212b870766..9afa5a291deb68fca8e03cb89d2c192ec9bb53d0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java @@ -9,8 +9,16 @@ public class CraftDrowned extends CraftZombie implements Drowned, com.destroysto super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Drowned getHandleRaw() { + return (net.minecraft.world.entity.monster.Drowned)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Drowned getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Drowned) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java index 010e9e922a6e30df4e40da151cfd398d1062633e..250479c6b9c5089c7cc260588ef1ce574c1ce24a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEgg.java @@ -9,8 +9,16 @@ public class CraftEgg extends CraftThrowableProjectile implements Egg { super(server, entity); } + // Folia start - region threading + @Override + public ThrownEgg getHandleRaw() { + return (ThrownEgg)this.entity; + } + // Folia end - region threading + @Override public ThrownEgg getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (ThrownEgg) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java index 676dd5331bec75407a74aea2a89e78ab72d69724..b87d6ccd12323f1760d83365c1bdd1d55baf3a0a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderCrystal.java @@ -39,8 +39,16 @@ public class CraftEnderCrystal extends CraftEntity implements EnderCrystal { } } + // Folia start - region threading + @Override + public EndCrystal getHandleRaw() { + return (EndCrystal)this.entity; + } + // Folia end - region threading + @Override public EndCrystal getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (EndCrystal) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java index 7b7b89e67d53ed70efae714192c5fa32977f3d9c..00f334e5449f76b735b844fed44c98725e607db3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java @@ -30,8 +30,16 @@ public class CraftEnderDragon extends CraftMob implements EnderDragon, CraftEnem return builder.build(); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.boss.enderdragon.EnderDragon getHandleRaw() { + return (net.minecraft.world.entity.boss.enderdragon.EnderDragon)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.boss.enderdragon.EnderDragon getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.boss.enderdragon.EnderDragon) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java index cc4194ac9d7501b5d15655674dade14d59cb6733..d89885eb1d4212bf26de5f32bce2b49ecd8182e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java @@ -16,8 +16,16 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago return (EnderDragon) super.getParent(); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.boss.EnderDragonPart getHandleRaw() { + return (net.minecraft.world.entity.boss.EnderDragonPart)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.boss.EnderDragonPart getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.boss.EnderDragonPart) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java index 3bb8d74f2b59c7f0c7c1cbde47a570d628ceceb2..83308195a3a55abeb4c28b9cc69dc98e61c351af 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderPearl.java @@ -9,8 +9,16 @@ public class CraftEnderPearl extends CraftThrowableProjectile implements EnderPe super(server, entity); } + // Folia start - region threading + @Override + public ThrownEnderpearl getHandleRaw() { + return (ThrownEnderpearl)this.entity; + } + // Folia end - region threading + @Override public ThrownEnderpearl getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (ThrownEnderpearl) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java index 27f56fa4b7ef92a9a4dfa6b782350424b88210f2..d0b2f8abba0eb5e29beccfebcf48f840715b7908 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderSignal.java @@ -15,8 +15,16 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal { super(server, entity); } + // Folia start - region threading + @Override + public EyeOfEnder getHandleRaw() { + return (EyeOfEnder)this.entity; + } + // Folia end - region threading + @Override public EyeOfEnder getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (EyeOfEnder) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java index 983b9d6ddb58eff297e96e5c8b28ec427efa267d..6ce0c8f24e5359c68e70092c8f488f1817221704 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java @@ -62,8 +62,16 @@ public class CraftEnderman extends CraftMonster implements Enderman { } // Paper end + // Folia start - region threading + @Override + public EnderMan getHandleRaw() { + return (EnderMan)this.entity; + } + // Folia end - region threading + @Override public EnderMan getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (EnderMan) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java index d657fd2c507a5b215aeab0a5f3e9c2ee892a27c8..9fc90b162aab15a9cd60b02aba56318130b394c4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEndermite.java @@ -9,8 +9,16 @@ public class CraftEndermite extends CraftMonster implements Endermite { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Endermite getHandleRaw() { + return (net.minecraft.world.entity.monster.Endermite)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Endermite getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Endermite) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 55ed79a802efa7a28cd487770a689119c64b7f40..73316307666674f9f6e7ddb964e2ec2583743c79 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -491,7 +491,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @Override public UUID getUniqueId() { - return this.getHandle().getUUID(); + return this.getHandleRaw().getUUID(); // Folia - region threading } @Override @@ -506,6 +506,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public Entity getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java index 3a890cccf1766758794f3a3b5d31428f42590049..06863afd6bd855130ac0e672824aa2755e141286 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java @@ -11,8 +11,16 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Evoker getHandleRaw() { + return (net.minecraft.world.entity.monster.Evoker)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Evoker getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Evoker) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvokerFangs.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvokerFangs.java index 19b368cc862cd7e3e1f0e89401a7d099e3eaefa3..5ae51638114a7931efdfc367b26791a22d7e8e2b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvokerFangs.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvokerFangs.java @@ -11,8 +11,16 @@ public class CraftEvokerFangs extends CraftEntity implements EvokerFangs { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.EvokerFangs getHandleRaw() { + return (net.minecraft.world.entity.projectile.EvokerFangs)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.EvokerFangs getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.EvokerFangs) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java index 5a7d314ec0562e472f5dc45924a7b24841cff126..4708a11935efe5cb6727f8fc6d4a3cd2470b7091 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java @@ -30,8 +30,16 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb { } // Paper end + // Folia start - region threading + @Override + public net.minecraft.world.entity.ExperienceOrb getHandleRaw() { + return (net.minecraft.world.entity.ExperienceOrb)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.ExperienceOrb getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.ExperienceOrb) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java index 1359d25a32b4a5d5e8e68ce737bd19f7b5afaf69..0be7f84a50b7568d0c639f5906b5ca76347d95fe 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java @@ -14,8 +14,16 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock { super(server, entity); } + // Folia start - region threading + @Override + public FallingBlockEntity getHandleRaw() { + return (FallingBlockEntity)this.entity; + } + // Folia end - region threading + @Override public FallingBlockEntity getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (FallingBlockEntity) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java index a8699b274b51c5f6691557c3c3db88436f05e304..45e900cd12c5615149c99a5dc85e8f78edb5483b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java @@ -60,8 +60,16 @@ public class CraftFireball extends AbstractProjectile implements Fireball { } // Paper end - Expose power on fireball projectiles + // Folia start - region threading + @Override + public AbstractHurtingProjectile getHandleRaw() { + return (AbstractHurtingProjectile)this.entity; + } + // Folia end - region threading + @Override public AbstractHurtingProjectile getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AbstractHurtingProjectile) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index 1309fabd357eb9b8f90f882ec7ff3de9e60f187d..7a98bcdd7c8a8934431cd50335f941ae79bc5763 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java @@ -37,8 +37,16 @@ public class CraftFirework extends CraftProjectile implements Firework { // Paper end - Expose firework item directly } + // Folia start - region threading + @Override + public FireworkRocketEntity getHandleRaw() { + return (FireworkRocketEntity)this.entity; + } + // Folia end - region threading + @Override public FireworkRocketEntity getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (FireworkRocketEntity) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java index eb10f94d5ed8ca89d3786138647dd43357609a6c..e0ad8cedd4d2646d87f3b5abda23c0c603adfd3a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java @@ -10,8 +10,16 @@ public class CraftFish extends CraftWaterMob implements Fish, io.papermc.paper.e super(server, entity); } + // Folia start - region threading + @Override + public AbstractFish getHandleRaw() { + return (AbstractFish)this.entity; + } + // Folia end - region threading + @Override public AbstractFish getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AbstractFish) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java index 116f23a3ee9fa409d7bc34c3769b94ed2bb07183..5951f9fa14177bf5c781990dd77016268280abe0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java @@ -14,8 +14,16 @@ public class CraftFishHook extends CraftProjectile implements FishHook { super(server, entity); } + // Folia start - region threading + @Override + public FishingHook getHandleRaw() { + return (FishingHook)this.entity; + } + // Folia end - region threading + @Override public FishingHook getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (FishingHook) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java index 8117faa0c89a966d057f4bf251c03a09d1e8797e..7bdd9e033862a7d86742e05a63848c2fb804f6b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFlying.java @@ -10,8 +10,16 @@ public class CraftFlying extends CraftMob implements Flying { super(server, entity); } + // Folia start - region threading + @Override + public FlyingMob getHandleRaw() { + return (FlyingMob)this.entity; + } + // Folia end - region threading + @Override public FlyingMob getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (FlyingMob) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java index c455deb4fd2a7684bcc01a8212c362a2375c190b..50ee6d3c3aa157fe69a483e02f33f23193628088 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java @@ -14,8 +14,16 @@ public class CraftFox extends CraftAnimals implements Fox { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Fox getHandleRaw() { + return (net.minecraft.world.entity.animal.Fox)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Fox getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Fox) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java index 65131d153b78a0787b977b9f65c15cfcbd395d11..e7501d8ec8f920939ef7599d5a88bd6ce7ab4f53 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFrog.java @@ -16,8 +16,16 @@ public class CraftFrog extends CraftAnimals implements org.bukkit.entity.Frog { super(server, entity); } + // Folia start - region threading + @Override + public Frog getHandleRaw() { + return (Frog)this.entity; + } + // Folia end - region threading + @Override public Frog getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (Frog) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java index 97fa4e1e70203194bd939618b2fad92665af6d59..8dc0e1332a5f8dd32e2b478432627a5d0c5cebcd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java @@ -9,8 +9,16 @@ public class CraftGhast extends CraftFlying implements Ghast, CraftEnemy { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Ghast getHandleRaw() { + return (net.minecraft.world.entity.monster.Ghast)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Ghast getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Ghast) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java index 5826205339e99e2536b93c8589d95917749f8417..300f06f78c2814aa5650c02f714fee594ba61f98 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGiant.java @@ -9,8 +9,16 @@ public class CraftGiant extends CraftMonster implements Giant { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Giant getHandleRaw() { + return (net.minecraft.world.entity.monster.Giant)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Giant getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Giant) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGlowItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGlowItemFrame.java index b9a7576d2481b64b7e5b46d66c1f55d1dc28c540..c288adee8ec60fa2bb83ae83f7be98c391379604 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGlowItemFrame.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGlowItemFrame.java @@ -9,8 +9,16 @@ public class CraftGlowItemFrame extends CraftItemFrame implements GlowItemFrame super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.decoration.GlowItemFrame getHandleRaw() { + return (net.minecraft.world.entity.decoration.GlowItemFrame)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.decoration.GlowItemFrame getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.decoration.GlowItemFrame) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGlowSquid.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGlowSquid.java index 253a0d2f987163cbbb28d261674b47137cbbcbe2..ad0b9025e38926555b47dee1e056c7c8714c91fe 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGlowSquid.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGlowSquid.java @@ -10,8 +10,16 @@ public class CraftGlowSquid extends CraftSquid implements GlowSquid { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.GlowSquid getHandleRaw() { + return (net.minecraft.world.entity.GlowSquid)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.GlowSquid getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.GlowSquid) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java index 2c21de478bff9cdf13ba46cd041831d54c11e924..ab87340df483787d59d8b1e2ce3a69235d39bba5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGoat.java @@ -9,8 +9,16 @@ public class CraftGoat extends CraftAnimals implements Goat { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.goat.Goat getHandleRaw() { + return (net.minecraft.world.entity.animal.goat.Goat)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.goat.Goat getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.goat.Goat) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGolem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGolem.java index e27e469894bdd17cf7a004a85fdf0eaa746111a6..9fde15e62fd99c842c7c22e97217cc6d68460dfd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGolem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGolem.java @@ -9,8 +9,16 @@ public class CraftGolem extends CraftCreature implements Golem { super(server, entity); } + // Folia start - region threading + @Override + public AbstractGolem getHandleRaw() { + return (AbstractGolem)this.entity; + } + // Folia end - region threading + @Override public AbstractGolem getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AbstractGolem) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java index e232350f2c6ef1900b05fda4d3f94099057d10e5..96e7759b64f075e9f803763403d22573a4e35feb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftGuardian.java @@ -13,8 +13,16 @@ public class CraftGuardian extends CraftMonster implements Guardian { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Guardian getHandleRaw() { + return (net.minecraft.world.entity.monster.Guardian)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Guardian getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Guardian) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java index cbdcf767c01e2c173913f56747d2dacbda2f0094..f45db5bb1a16bc3be5f70094c3f3902538f29b5b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java @@ -57,8 +57,16 @@ public class CraftHanging extends CraftEntity implements Hanging { return CraftBlock.notchToBlockFace(direction); } + // Folia start - region threading + @Override + public HangingEntity getHandleRaw() { + return (HangingEntity)this.entity; + } + // Folia end - region threading + @Override public HangingEntity getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (HangingEntity) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHoglin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHoglin.java index 37007775d27598e319c0c78929c6a808b697724a..17265ad2eaa38259f3c311c1c73576a79001aa7e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHoglin.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHoglin.java @@ -51,8 +51,16 @@ public class CraftHoglin extends CraftAnimals implements Hoglin, CraftEnemy { return this.getHandle().isConverting(); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.hoglin.Hoglin getHandleRaw() { + return (net.minecraft.world.entity.monster.hoglin.Hoglin)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.hoglin.Hoglin getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.hoglin.Hoglin) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java index 8746f80d08df5501b32958eb123aa7d814573ddf..c6c6eb55f4649e18beef9832c2ea7b9d1515666f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java @@ -13,8 +13,16 @@ public class CraftHorse extends CraftAbstractHorse implements Horse { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.horse.Horse getHandleRaw() { + return (net.minecraft.world.entity.animal.horse.Horse)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.horse.Horse getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.horse.Horse) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index acbb64010cd59668aa1bcb52ff1220789cadb1d3..35958bb85389ca0ed02f567e0fd9f4a9dbc66ff2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -291,8 +291,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { this.mode = mode; } + // Folia start - region threading + @Override + public Player getHandleRaw() { + return (Player)this.entity; + } + // Folia end - region threading + @Override public Player getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (Player) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllager.java index fb3c518f02cb4c428f022523d2f838625841332b..7becaa4d26df7309984b7aa271a0ae6f778acc0a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllager.java @@ -10,8 +10,16 @@ public class CraftIllager extends CraftRaider implements Illager { super(server, entity); } + // Folia start - region threading + @Override + public AbstractIllager getHandleRaw() { + return (AbstractIllager)this.entity; + } + // Folia end - region threading + @Override public AbstractIllager getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AbstractIllager) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java index 5b2af80e584977683cd39e6f440e65a76e929be9..89c0121c40da1596a4bf5db6e1d7d611d5053153 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java @@ -9,8 +9,16 @@ public class CraftIllusioner extends CraftSpellcaster implements Illusioner, com super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Illusioner getHandleRaw() { + return (net.minecraft.world.entity.monster.Illusioner)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Illusioner getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Illusioner) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftInteraction.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftInteraction.java index caa3016bf9742222205e3ea9a327fad3c4f912bb..4a77b1cf13cfae35331c1e5c5df0b3b9972a0ac1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftInteraction.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftInteraction.java @@ -12,8 +12,16 @@ public class CraftInteraction extends CraftEntity implements Interaction { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.Interaction getHandleRaw() { + return (net.minecraft.world.entity.Interaction)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.Interaction getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.Interaction) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java index 63cae1a2e95d8da17c45c4404a8dd0ca6a413c39..f57139f03da9519802ee156f37691d0824bc531b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIronGolem.java @@ -8,8 +8,16 @@ public class CraftIronGolem extends CraftGolem implements IronGolem { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.IronGolem getHandleRaw() { + return (net.minecraft.world.entity.animal.IronGolem)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.IronGolem getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.IronGolem) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java index 30d62ee4d5cd2ddacb8783b5bbbf475d592b3e02..c78498010a01b7d4c0b5c7350a11d0e1cf8ab013 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java @@ -18,8 +18,16 @@ public class CraftItem extends CraftEntity implements Item { super(server, entity); } + // Folia start - region threading + @Override + public ItemEntity getHandleRaw() { + return (ItemEntity)this.entity; + } + // Folia end - region threading + @Override public ItemEntity getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (ItemEntity) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemDisplay.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemDisplay.java index 787f91566fc53c2b4aeba1ec10d8f46ccf15cbe6..eb2b4272b09e5df06e49afc2ccf7063ebc3d42b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemDisplay.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemDisplay.java @@ -13,8 +13,16 @@ public class CraftItemDisplay extends CraftDisplay implements ItemDisplay { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.Display.ItemDisplay getHandleRaw() { + return (net.minecraft.world.entity.Display.ItemDisplay)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.Display.ItemDisplay getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.Display.ItemDisplay) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java index 2fcd9b836d42e3549a3b6b921c57a4c103146dff..051d15967436109d4267a800ab7e1bdf83cbd47a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java @@ -157,8 +157,16 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { this.getHandle().fixed = fixed; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.decoration.ItemFrame getHandleRaw() { + return (net.minecraft.world.entity.decoration.ItemFrame)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.decoration.ItemFrame getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.decoration.ItemFrame) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java index 0848963e61e03aa2a1740208ee372fd9edb7fc11..a55a329125775a7b78b3a779a8525ab1e734235b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLargeFireball.java @@ -14,8 +14,16 @@ public class CraftLargeFireball extends CraftSizedFireball implements LargeFireb this.getHandle().explosionPower = (int) yield; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.LargeFireball getHandleRaw() { + return (net.minecraft.world.entity.projectile.LargeFireball)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.LargeFireball getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.LargeFireball) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLeash.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLeash.java index 06fa256c5528af9c1d63fbd044f53b63bed324ee..896d34bd55e308fe322865f8cf7fd077a382df5e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLeash.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLeash.java @@ -24,8 +24,16 @@ public class CraftLeash extends CraftHanging implements LeashHitch { return BlockFace.SELF; } + // Folia start - region threading + @Override + public LeashFenceKnotEntity getHandleRaw() { + return (LeashFenceKnotEntity)this.entity; + } + // Folia end - region threading + @Override public LeashFenceKnotEntity getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (LeashFenceKnotEntity) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java index e9f471e60af0725ec34e2985d63ae9ea9f88590a..6a443f42ecec16abea3ddf7bc2e85bb8a6af726e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java @@ -41,8 +41,16 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike this.getHandle().setCause((player != null) ? ((CraftPlayer) player).getHandle() : null); } + // Folia start - region threading + @Override + public LightningBolt getHandleRaw() { + return (LightningBolt)this.entity; + } + // Folia end - region threading + @Override public LightningBolt getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (LightningBolt) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 993844ee3d76591be38e8d27eba37ff8723443b1..ac46baf473a9cf366b9b1ab3d59e8ab7097bc656 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -454,6 +454,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { this.getHandle().invulnerableTime = ticks; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.LivingEntity getHandleRaw() { + return (net.minecraft.world.entity.LivingEntity)this.entity; + } + // Folia end - region threading + @Override public int getNoActionTicks() { return this.getHandle().getNoActionTime(); @@ -467,6 +474,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public net.minecraft.world.entity.LivingEntity getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.LivingEntity) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java index 0ad16ee7b33582d214dab41eeee378d52c8e38ed..874c6690ec46d482757093296bbcf1864382e13b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java @@ -14,8 +14,16 @@ public class CraftLlama extends CraftChestedHorse implements Llama, com.destroys super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.horse.Llama getHandleRaw() { + return (net.minecraft.world.entity.animal.horse.Llama)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.horse.Llama getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.horse.Llama) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlamaSpit.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlamaSpit.java index 47633f05b4fab1dcabc2117e7645fe6d6949622a..f1e78960622b71aa63e172a1d856a757d6926a5a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlamaSpit.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlamaSpit.java @@ -10,8 +10,16 @@ public class CraftLlamaSpit extends AbstractProjectile implements LlamaSpit { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.LlamaSpit getHandleRaw() { + return (net.minecraft.world.entity.projectile.LlamaSpit)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.LlamaSpit getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.LlamaSpit) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java index 58b638ffd338e1b0f4962490c665c1eebcf33dcc..321e41e21723fa3e28f73176c9abe34d16a42fcc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMagmaCube.java @@ -9,8 +9,16 @@ public class CraftMagmaCube extends CraftSlime implements MagmaCube { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.MagmaCube getHandleRaw() { + return (net.minecraft.world.entity.monster.MagmaCube)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.MagmaCube getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.MagmaCube) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMarker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMarker.java index e6782a48d22ba1e683e3fe463e970e8a5ed60fbd..9c04388e9d38103b40a154b6f0e13920ede451f5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMarker.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMarker.java @@ -9,8 +9,16 @@ public class CraftMarker extends CraftEntity implements Marker { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.Marker getHandleRaw() { + return (net.minecraft.world.entity.Marker)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.Marker getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.Marker) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index 8920af5a0dfe737c1f38d906b53e6a278456d2aa..8bc87cfe29d61b09eee8ecfccda319b5610c6969 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -86,8 +86,16 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { } // Paper end + // Folia start - region threading + @Override + public AbstractMinecart getHandleRaw() { + return (AbstractMinecart)this.entity; + } + // Folia end - region threading + @Override public AbstractMinecart getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AbstractMinecart) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java index 0ee159d488b15e571f9b19ec852fe279755696fa..356ac7fcea71f173d8698f3de33bfe9616c08312 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java @@ -20,8 +20,16 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca super(server, entity); } + // Folia start - region threading + @Override + public MinecartCommandBlock getHandleRaw() { + return (MinecartCommandBlock)this.entity; + } + // Folia end - region threading + @Override public MinecartCommandBlock getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (MinecartCommandBlock) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..a0a136893a09185577cb46dfe8426fdb3a9a6ccd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java @@ -16,8 +16,16 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo super(server, entity); } + // Folia start - region threading + @Override + public AbstractMinecartContainer getHandleRaw() { + return (AbstractMinecartContainer)this.entity; + } + // Folia end - region threading + @Override public AbstractMinecartContainer getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AbstractMinecartContainer) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartFurnace.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartFurnace.java index 1b41026ab638bb2764b19429706eb0aded5aad12..c04acbffe5e0b1024f885490c5238cd40b36e701 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartFurnace.java @@ -11,8 +11,16 @@ public class CraftMinecartFurnace extends CraftMinecart implements PoweredMineca super(server, entity); } + // Folia start - region threading + @Override + public MinecartFurnace getHandleRaw() { + return (MinecartFurnace)this.entity; + } + // Folia end - region threading + @Override public MinecartFurnace getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (MinecartFurnace) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java index 3a3563a1bdbc0d84d973b3a04b50b78b4bc3d379..9a9f37b9c8931771d90ae22c4ca9a684e24fff32 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java @@ -34,8 +34,17 @@ public final class CraftMinecartHopper extends CraftMinecartContainer implements ((MinecartHopper) this.getHandle()).setEnabled(enabled); } // Paper start + + // Folia start - region threading + @Override + public net.minecraft.world.entity.vehicle.MinecartHopper getHandleRaw() { + return (net.minecraft.world.entity.vehicle.MinecartHopper)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.vehicle.MinecartHopper getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.vehicle.MinecartHopper) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java index 79b608e89d4d1f76a58868c585bb87c82e2689b1..7767a342b3d8bf9c07fbd73ad4ccacd8065c5869 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java @@ -42,8 +42,16 @@ public final class CraftMinecartTNT extends CraftMinecart implements ExplosiveMi this.getHandle().explode(power); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.vehicle.MinecartTNT getHandleRaw() { + return (net.minecraft.world.entity.vehicle.MinecartTNT)this.entity; + } + // Folia end - region threading + @Override public MinecartTNT getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (MinecartTNT) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java index 31f62fbb54ec7b270fbd8afba7bd7c4bfafa09e3..0c89084eae131ae91d6c6aa910b1e0d2fc47747d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java @@ -55,8 +55,16 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { return (sound != null) ? CraftSound.minecraftToBukkit(sound) : null; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.Mob getHandleRaw() { + return (net.minecraft.world.entity.Mob)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.Mob getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.Mob) this.entity; } @@ -64,7 +72,7 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { @Override public void setHandle(net.minecraft.world.entity.Entity entity) { super.setHandle(entity); - paperPathfinder.setHandle(getHandle()); + paperPathfinder.setHandle((net.minecraft.world.entity.Mob)entity); // Folia - region threading } // Paper end - Mob Pathfinding API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java index 706c74c832f6893df3797023f68add31139c7d57..80a612f16669e571e336dd6369a968b4664c98e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMonster.java @@ -9,8 +9,16 @@ public class CraftMonster extends CraftCreature implements Monster, CraftEnemy { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Monster getHandleRaw() { + return (net.minecraft.world.entity.monster.Monster)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Monster getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Monster) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java index 983e0cdbd1bd950807967a36cba49859fb956f31..7dc7e382d63cd5c42bb0ef72d4766d24be99c3a6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java @@ -19,6 +19,13 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.MushroomCow getHandleRaw() { + return (net.minecraft.world.entity.animal.MushroomCow)this.entity; + } + // Folia end - region threading + @Override public boolean hasEffectsForNextStew() { return this.getHandle().stewEffects != null && !this.getHandle().stewEffects.isEmpty(); @@ -100,6 +107,7 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm @Override public net.minecraft.world.entity.animal.MushroomCow getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.MushroomCow) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftOcelot.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftOcelot.java index 5c60a30e80448fbf04b5fa4b1ef12fb2ee99bfd5..77eefdff4a5102fbc3abba7d7037fa7a5bcc61fa 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftOcelot.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftOcelot.java @@ -9,8 +9,16 @@ public class CraftOcelot extends CraftAnimals implements Ocelot { super(server, ocelot); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Ocelot getHandleRaw() { + return (net.minecraft.world.entity.animal.Ocelot)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Ocelot getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Ocelot) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java index bcac1359c667ef1ee46384f9c7a5adf4010d2b08..f131a80df94a9f0d42a64a86424451fb06755b12 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java @@ -50,8 +50,16 @@ public class CraftPainting extends CraftHanging implements Painting { return false; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.decoration.Painting getHandleRaw() { + return (net.minecraft.world.entity.decoration.Painting)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.decoration.Painting getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.decoration.Painting) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java index 01d104d91de9e1319d27e39d3f474318c7809486..a4d201e832d59c64d932f8b26564a783bd4bbdf4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java @@ -11,8 +11,16 @@ public class CraftPanda extends CraftAnimals implements Panda { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Panda getHandleRaw() { + return (net.minecraft.world.entity.animal.Panda)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Panda getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Panda) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftParrot.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftParrot.java index 04d6cf6a1f3ae8316e3b2862c2d1b04e84a3b20a..b1cdcfee5e575b29d844f04140dd0b0486d1dc45 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftParrot.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftParrot.java @@ -11,8 +11,16 @@ public class CraftParrot extends CraftTameableAnimal implements Parrot { super(server, parrot); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Parrot getHandleRaw() { + return (net.minecraft.world.entity.animal.Parrot)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Parrot getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Parrot) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java index 8338effd39b1709dbe578e247710a8e58d83e3aa..1d998942280db00ba7dab1c9d9a0f818490fe328 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java @@ -9,8 +9,16 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Phantom getHandleRaw() { + return (net.minecraft.world.entity.monster.Phantom)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Phantom getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Phantom) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java index 8016c810aeaf6ee953bca549bc1e7f9a85f860fc..4566f5d84e70b0296aabb4bf0d2caf517809132a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPig.java @@ -55,8 +55,16 @@ public class CraftPig extends CraftAnimals implements Pig { return Material.CARROT_ON_A_STICK; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Pig getHandleRaw() { + return (net.minecraft.world.entity.animal.Pig)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Pig getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Pig) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java index 49beb836d2801aadf869feefa602616daebe633f..0de7eadb1cac6979ce7cffd38a3b250812cae260 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPigZombie.java @@ -30,8 +30,16 @@ public class CraftPigZombie extends CraftZombie implements PigZombie { return this.getAnger() > 0; } + // Folia start - region threading + @Override + public ZombifiedPiglin getHandleRaw() { + return (ZombifiedPiglin)this.entity; + } + // Folia end - region threading + @Override public ZombifiedPiglin getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (ZombifiedPiglin) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java index 5124a383b60b2c8de89fa992547d0c61db760c21..2ba9b61a164c6afed15a0919124c8241d2aebf78 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java @@ -75,8 +75,16 @@ public class CraftPiglin extends CraftPiglinAbstract implements Piglin, com.dest return new CraftInventory(this.getHandle().inventory); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.piglin.Piglin getHandleRaw() { + return (net.minecraft.world.entity.monster.piglin.Piglin)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.piglin.Piglin getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.piglin.Piglin) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglinAbstract.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglinAbstract.java index e7957d6051244ba410f8633f9c16eeb8c5ac3ce0..ce763867f9c6c2d4773d76387afc0ecb479b6259 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglinAbstract.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglinAbstract.java @@ -95,8 +95,16 @@ public class CraftPiglinAbstract extends CraftMonster implements PiglinAbstract public void setBreed(boolean b) { } + // Folia start - region threading + @Override + public AbstractPiglin getHandleRaw() { + return (AbstractPiglin)this.entity; + } + // Folia end - region threading + @Override public AbstractPiglin getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (AbstractPiglin) super.getHandle(); } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglinBrute.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglinBrute.java index be874dc973fe632e8ace86041392ca69beaefd16..6889b4599aac0bd03badeefd74c891857f566c30 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglinBrute.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglinBrute.java @@ -9,8 +9,16 @@ public class CraftPiglinBrute extends CraftPiglinAbstract implements PiglinBrute super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.piglin.PiglinBrute getHandleRaw() { + return (net.minecraft.world.entity.monster.piglin.PiglinBrute)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.piglin.PiglinBrute getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.piglin.PiglinBrute) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java index 2638c341bc02f201f7ab17fdebcdbdf3a7ec05bf..0f5c2d31a2dea13a46ba81e353393633d097dcc7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java @@ -11,8 +11,16 @@ public class CraftPillager extends CraftIllager implements Pillager, com.destroy super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Pillager getHandleRaw() { + return (net.minecraft.world.entity.monster.Pillager)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Pillager getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Pillager) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 14a5eda367dd46fe7c9b5f76df80840f938c06ea..d2902fc7f3b7af59f181bd1e12435d946db7ad23 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -580,7 +580,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void kick(net.kyori.adventure.text.Component message, org.bukkit.event.player.PlayerKickEvent.Cause cause) { - org.spigotmc.AsyncCatcher.catchOp("player kick"); + //org.spigotmc.AsyncCatcher.catchOp("player kick"); // Folia - region threading - no longer needed final ServerGamePacketListenerImpl connection = this.getHandle().connection; if (connection != null) { connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause); @@ -2209,9 +2209,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this; } + // Folia start - region threading + @Override + public ServerPlayer getHandleRaw() { + return (ServerPlayer)this.entity; + } + // Folia end - region threading + @Override public ServerPlayer getHandle() { - return (ServerPlayer) this.entity; + return (ServerPlayer) this.entity; // Folia - region threading - no checks for players, as it's a total mess } public void setHandle(final ServerPlayer entity) { @@ -3266,7 +3273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { { if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() ) { - CraftPlayer.this.server.getServer().getPlayerList().respawn( CraftPlayer.this.getHandle(), false, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason.PLUGIN ); + CraftPlayer.this.getHandle().respawn(null); // Folia - region threading } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java index fe075cfdf3097d6cb768e71b8cc360abb8eaf367..9147771e26d2dbd29754d3fc07c02596669cd602 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPolarBear.java @@ -8,8 +8,17 @@ public class CraftPolarBear extends CraftAnimals implements PolarBear { public CraftPolarBear(CraftServer server, net.minecraft.world.entity.animal.PolarBear entity) { super(server, entity); } + + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.PolarBear getHandleRaw() { + return (net.minecraft.world.entity.animal.PolarBear)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.PolarBear getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.PolarBear) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java index 4f1fa7dec78970bdfc184d3c1f1632dc9d75a574..d4889dbca359aab6e11fa6231b0ddcb6f33ef18b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java @@ -12,8 +12,16 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj // Paper - moved to AbstractProjectile + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.Projectile getHandleRaw() { + return (net.minecraft.world.entity.projectile.Projectile)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.Projectile getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.Projectile) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPufferFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPufferFish.java index 35a8219734633529325430810e88755b2dd23125..85ebd34ed143304c603078f2e949179a8e628ed2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPufferFish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPufferFish.java @@ -10,8 +10,16 @@ public class CraftPufferFish extends CraftFish implements PufferFish { super(server, entity); } + // Folia start - region threading + @Override + public Pufferfish getHandleRaw() { + return (Pufferfish)this.entity; + } + // Folia end - region threading + @Override public Pufferfish getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (Pufferfish) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java index 519ef701a7d6534f7cb516f6296b95ee521f661d..effbc1a3ef8c6c9cd424f49b8bfce05d40e0772a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRabbit.java @@ -10,8 +10,16 @@ public class CraftRabbit extends CraftAnimals implements Rabbit { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Rabbit getHandleRaw() { + return (net.minecraft.world.entity.animal.Rabbit)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Rabbit getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Rabbit) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java index 763c368e299588f9a0e085a8a5e04e97e1f33428..58de24aeb98f19b2cf3fa9b0ad17e8b14bc1e475 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRaider.java @@ -16,8 +16,16 @@ public abstract class CraftRaider extends CraftMonster implements Raider { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.raid.Raider getHandleRaw() { + return (net.minecraft.world.entity.raid.Raider)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.raid.Raider getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.raid.Raider) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java index 09796ce15658e3f7c223a265a547a51ee729ed40..824db5f9f0b5c5f79bc073acaeb4f46aade740af 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftRavager.java @@ -9,8 +9,16 @@ public class CraftRavager extends CraftRaider implements Ravager { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Ravager getHandleRaw() { + return (net.minecraft.world.entity.monster.Ravager)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Ravager getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Ravager) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java index d4d8ce60098c74508e2de9541bf6534988779764..081d7f454b3556110f5a300602fbe9239d9b77c7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java @@ -9,8 +9,16 @@ public class CraftSalmon extends io.papermc.paper.entity.PaperSchoolableFish imp super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Salmon getHandleRaw() { + return (net.minecraft.world.entity.animal.Salmon)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Salmon getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Salmon) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java index 37291d7ad9fdf0fe78894f82a418f40bb581f58b..1a0041a788f65ec30d329a86f65c04659a68ad7c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSheep.java @@ -29,8 +29,16 @@ public class CraftSheep extends CraftAnimals implements Sheep, io.papermc.paper. this.getHandle().setSheared(flag); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Sheep getHandleRaw() { + return (net.minecraft.world.entity.animal.Sheep)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Sheep getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Sheep) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java index 05ec06b71642ab1ef03829039f7ac1e4c527ee50..fd4168a8bcf1537ccc2496139f5c5b63c5e2f41a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftShulker.java @@ -18,8 +18,16 @@ public class CraftShulker extends CraftGolem implements Shulker, CraftEnemy { return "CraftShulker"; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Shulker getHandleRaw() { + return (net.minecraft.world.entity.monster.Shulker)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Shulker getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Shulker) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java index 636c4481e3afdf20197e502cf221f5d34d18f101..436a921106697916118cec8007ffd1cac1745fcd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftShulkerBullet.java @@ -65,8 +65,16 @@ public class CraftShulkerBullet extends AbstractProjectile implements ShulkerBul return "CraftShulkerBullet"; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.ShulkerBullet getHandleRaw() { + return (net.minecraft.world.entity.projectile.ShulkerBullet)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.ShulkerBullet getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.ShulkerBullet) this.entity; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java index 7c75d78e5e28d7320c6dbe979bcd576658fb310b..83de93bd751b1c15ad763819e4fe87ecb13bf6e8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSilverfish.java @@ -8,8 +8,16 @@ public class CraftSilverfish extends CraftMonster implements Silverfish { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Silverfish getHandleRaw() { + return (net.minecraft.world.entity.monster.Silverfish)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Silverfish getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Silverfish) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java index 824638b3428fd480419f559c07d1fc7fbd434a24..278ad88925fb5530fdeef35cb19002a0cdab68a0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSizedFireball.java @@ -27,8 +27,16 @@ public class CraftSizedFireball extends CraftFireball implements SizedFireball { this.getHandle().setItem(CraftItemStack.asNMSCopy(item)); } + // Folia start - region threading + @Override + public Fireball getHandleRaw() { + return (Fireball)this.entity; + } + // Folia end - region threading + @Override public Fireball getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (Fireball) this.entity; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java index 6f98da9be6aef35e3b5c940188b872459a383c8e..79465c30d59c50574b215e1f4ad75a2b426404a3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java @@ -31,8 +31,16 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton { } } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Skeleton getHandleRaw() { + return (net.minecraft.world.entity.monster.Skeleton)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Skeleton getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Skeleton) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java index fbb47491dcc75f8247dee9f123f946f99ef1467f..9dfd108be5185eb897faa802411297183a960cee 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java @@ -20,8 +20,16 @@ public class CraftSkeletonHorse extends CraftAbstractHorse implements SkeletonHo return Variant.SKELETON_HORSE; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.horse.SkeletonHorse getHandleRaw() { + return (net.minecraft.world.entity.animal.horse.SkeletonHorse)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.horse.SkeletonHorse getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.horse.SkeletonHorse) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java index e48f7d1cbec4a2319745ba48a5d44ab9925214e2..1ffb16e5e8e243f684c7c0b9fbdd2a7b885d412d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -19,8 +19,16 @@ public class CraftSlime extends CraftMob implements Slime, CraftEnemy { this.getHandle().setSize(size, /* true */ getHandle().isAlive()); // Paper - fix dead slime setSize invincibility } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Slime getHandleRaw() { + return (net.minecraft.world.entity.monster.Slime)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Slime getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Slime) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java index 072df206858944ef78179b0a6d61ed990a844d2b..c022ca9c630cfe9a37583c65afc6d390c13f5886 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSmallFireball.java @@ -8,8 +8,16 @@ public class CraftSmallFireball extends CraftSizedFireball implements SmallFireb super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.SmallFireball getHandleRaw() { + return (net.minecraft.world.entity.projectile.SmallFireball)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.SmallFireball getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.SmallFireball) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSniffer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSniffer.java index 555337018fe218ac5a296a5e6a1d82720fee05e1..a6929f512a99eed376878ae11aa7bac0b5828e27 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSniffer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSniffer.java @@ -16,8 +16,16 @@ public class CraftSniffer extends CraftAnimals implements Sniffer { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.sniffer.Sniffer getHandleRaw() { + return (net.minecraft.world.entity.animal.sniffer.Sniffer)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.sniffer.Sniffer getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.sniffer.Sniffer) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java index d959825fd11a94aba175934cd7739544a23958fc..e22be41875f2d772bcc1219e54f4f436813034a1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowball.java @@ -8,8 +8,16 @@ public class CraftSnowball extends CraftThrowableProjectile implements Snowball super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.Snowball getHandleRaw() { + return (net.minecraft.world.entity.projectile.Snowball)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.Snowball getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.Snowball) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java index 4ce2373ff71c3c1b8951646e057587a3ab09e145..9041c121b9bc41152640c8e2ed983b9ec29df81a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java @@ -19,8 +19,16 @@ public class CraftSnowman extends CraftGolem implements Snowman, com.destroystok this.getHandle().setPumpkin(!derpMode); } + // Folia start - region threading + @Override + public SnowGolem getHandleRaw() { + return (SnowGolem)this.entity; + } + // Folia end - region threading + @Override public SnowGolem getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (SnowGolem) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java index 6dff6db2e6a3a4fb2ada257041b168347d33bc6a..62b9c7fce1e3f7e17e9a1be999cf94760c057445 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpectralArrow.java @@ -9,8 +9,16 @@ public class CraftSpectralArrow extends CraftArrow implements SpectralArrow { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.SpectralArrow getHandleRaw() { + return (net.minecraft.world.entity.projectile.SpectralArrow)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.SpectralArrow getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.SpectralArrow) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpellcaster.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpellcaster.java index 525827f1747631fa108be7e1b7395b47d33aa397..3dbb5f7f88979d616e185980d96cc2c377977000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpellcaster.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpellcaster.java @@ -12,8 +12,16 @@ public class CraftSpellcaster extends CraftIllager implements Spellcaster { super(server, entity); } + // Folia start - region threading + @Override + public SpellcasterIllager getHandleRaw() { + return (SpellcasterIllager)this.entity; + } + // Folia end - region threading + @Override public SpellcasterIllager getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (SpellcasterIllager) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java index b4afc37c21fc478df44fca7ec3fbc33d337dc6b7..911822f4e2e1eba6a9d3e9b781499314d7f9427f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSpider.java @@ -9,8 +9,16 @@ public class CraftSpider extends CraftMonster implements Spider { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Spider getHandleRaw() { + return (net.minecraft.world.entity.monster.Spider)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Spider getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Spider) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java index a6e3b61c391a8b266d2b030d9ba600ac6be76952..f93b160ae82b7cae6b11d214531df4618fd79f74 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSquid.java @@ -9,8 +9,16 @@ public class CraftSquid extends CraftWaterMob implements Squid { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Squid getHandleRaw() { + return (net.minecraft.world.entity.animal.Squid)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Squid getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Squid) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftStrider.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftStrider.java index 9472a6f9c9584048abf1f8d11ab6254b7c7a287d..f2daf0fc0f07d90040887b0cee8f1924d3c146bc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftStrider.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftStrider.java @@ -65,8 +65,16 @@ public class CraftStrider extends CraftAnimals implements Strider { return Material.WARPED_FUNGUS_ON_A_STICK; } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Strider getHandleRaw() { + return (net.minecraft.world.entity.monster.Strider)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Strider getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Strider) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java index dac3d34677688ac560bc1be2087a08479ef71b87..b28221a616613698e6a627d461429cb1f91d738b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java @@ -42,8 +42,16 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { this.getHandle().setFuse(fuseTicks); } + // Folia start - region threading + @Override + public PrimedTnt getHandleRaw() { + return (PrimedTnt)this.entity; + } + // Folia end - region threading + @Override public PrimedTnt getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (PrimedTnt) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java index d7c6a0bbc5671ea8f2488230c94df5146a1e98b9..71faf263dd5ac43ab9b89b5a152dd0d1ee93b91b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java @@ -9,8 +9,16 @@ public class CraftTadpole extends CraftFish implements org.bukkit.entity.Tadpole super(server, entity); } + // Folia start - region threading + @Override + public Tadpole getHandleRaw() { + return (Tadpole)this.entity; + } + // Folia end - region threading + @Override public Tadpole getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (Tadpole) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java index a06679e1e5686d9bd601b3dcf8492add58918bc4..389ba1c170014f9d5b7e4acf10b494338f46efcb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java @@ -12,8 +12,16 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat super(server, entity); } + // Folia start - region threading + @Override + public TamableAnimal getHandleRaw() { + return (TamableAnimal)this.entity; + } + // Folia end - region threading + @Override public TamableAnimal getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (TamableAnimal) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java index 9ef939b76d06874b856e0c850addb364146f5a00..d3975a461778d9815f68f323e616e25c24bf649c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTextDisplay.java @@ -13,8 +13,16 @@ public class CraftTextDisplay extends CraftDisplay implements TextDisplay { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.Display.TextDisplay getHandleRaw() { + return (net.minecraft.world.entity.Display.TextDisplay)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.Display.TextDisplay getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.Display.TextDisplay) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java index 2a57a2ce8c21d2ab2376d34d1343315209715579..04a28b8bcd449d312dcb495e496913f470705c10 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrowableProjectile.java @@ -26,8 +26,16 @@ public abstract class CraftThrowableProjectile extends CraftProjectile implement this.getHandle().setItem(CraftItemStack.asNMSCopy(item)); } + // Folia start - region threading + @Override + public ThrowableItemProjectile getHandleRaw() { + return (ThrowableItemProjectile)this.entity; + } + // Folia end - region threading + @Override public ThrowableItemProjectile getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (ThrowableItemProjectile) this.entity; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownExpBottle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownExpBottle.java index 5e7fef664c56d6087502e56a0eb4fc07d34ade9f..7538d449e24a8d680628f31b22924e7de9e8b503 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownExpBottle.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownExpBottle.java @@ -9,8 +9,16 @@ public class CraftThrownExpBottle extends CraftThrowableProjectile implements Th super(server, entity); } + // Folia start - region threading + @Override + public ThrownExperienceBottle getHandleRaw() { + return (ThrownExperienceBottle)this.entity; + } + // Folia end - region threading + @Override public ThrownExperienceBottle getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (ThrownExperienceBottle) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java index d3aeb4b614b2b17d9613aa3ffa34ebfc81666f79..a8eba002d3620192781abcccd1b5172b77cdd1c5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java @@ -60,8 +60,17 @@ public class CraftThrownPotion extends CraftThrowableProjectile implements Throw this.getHandle().splash(null); } // Paper end + + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.ThrownPotion getHandleRaw() { + return (net.minecraft.world.entity.projectile.ThrownPotion)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.ThrownPotion getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.ThrownPotion) this.entity; } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java index b2747e37600cadc385e2e9e1115ba1d4ec22f5da..11f7c05740e68fdc171aa5cbf6f8b3f71026948f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java @@ -23,8 +23,16 @@ public class CraftTippedArrow extends CraftArrow implements Arrow { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.Arrow getHandleRaw() { + return (net.minecraft.world.entity.projectile.Arrow)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.Arrow getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.Arrow) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java index 4b3a764114c8372e1549dadeeced26dc7727f2d1..04cbe165b99d348a864da5d342225fc929b2bfd0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTraderLlama.java @@ -9,8 +9,16 @@ public class CraftTraderLlama extends CraftLlama implements TraderLlama { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.horse.TraderLlama getHandleRaw() { + return (net.minecraft.world.entity.animal.horse.TraderLlama)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.horse.TraderLlama getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.horse.TraderLlama) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java index 8a6af0db8e0aa0cffbf19584be747076c2c8ee44..b7c639a027001a064333fb4e8feb0e049e8cabbd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java @@ -12,8 +12,16 @@ public class CraftTrident extends CraftArrow implements Trident { super(server, entity); } + // Folia start - region threading + @Override + public ThrownTrident getHandleRaw() { + return (ThrownTrident)this.entity; + } + // Folia end - region threading + @Override public ThrownTrident getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (ThrownTrident) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java index 9e53c30801c700719c78c0fd521fd615c94e02c8..201d4db7a455cde7c6feb4263a054a5cb66ea672 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java @@ -13,8 +13,16 @@ public class CraftTropicalFish extends io.papermc.paper.entity.PaperSchoolableFi super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.TropicalFish getHandleRaw() { + return (net.minecraft.world.entity.animal.TropicalFish)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.TropicalFish getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.TropicalFish) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java index d44e6f4bb682d18c1497eee9fb2802f2bda6e840..f2d589721a335d1f92ab04ce70e7678a244314fd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java @@ -9,8 +9,16 @@ public class CraftTurtle extends CraftAnimals implements Turtle { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Turtle getHandleRaw() { + return (net.minecraft.world.entity.animal.Turtle)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Turtle getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Turtle) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java index e9ec3455eabc473e104b5342a615a38c1ac25a4f..2f0aac537bd71e6db8e3554ce8d615e521897e27 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java @@ -13,8 +13,16 @@ public class CraftVex extends CraftMonster implements Vex { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Vex getHandleRaw() { + return (net.minecraft.world.entity.monster.Vex)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Vex getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Vex) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index 6c15d40979fd3e3d246a447c432b321fbf29ada3..771eb799b032fcf4fc33c5e445b7fa252baee72b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -31,8 +31,16 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.npc.Villager getHandleRaw() { + return (net.minecraft.world.entity.npc.Villager)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.npc.Villager getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.npc.Villager) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java index 3aa23d9f22d5cd22231293fd7d1ca4cb79eb7cb3..f340cf90512a7097153d7fa1a2b38fe3e0f1e8d5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillagerZombie.java @@ -14,8 +14,16 @@ public class CraftVillagerZombie extends CraftZombie implements ZombieVillager { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.ZombieVillager getHandleRaw() { + return (net.minecraft.world.entity.monster.ZombieVillager)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.ZombieVillager getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.ZombieVillager) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java index bcd3370bc48520ea4bb53af25b892131d6ca0b33..c89dfec6f61d4f487bd6292d509a33922127162f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java @@ -9,8 +9,16 @@ public class CraftVindicator extends CraftIllager implements Vindicator { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Vindicator getHandleRaw() { + return (net.minecraft.world.entity.monster.Vindicator)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Vindicator getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Vindicator) super.getHandle(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java index 3cceefa0d6278924a19641a49bdf16bcdacb2233..0664afee1d66c44318f12ff38ac8c8509491b9d6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java @@ -9,8 +9,16 @@ public class CraftWanderingTrader extends CraftAbstractVillager implements Wande super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.npc.WanderingTrader getHandleRaw() { + return (net.minecraft.world.entity.npc.WanderingTrader)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.npc.WanderingTrader getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.npc.WanderingTrader) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java index c284eb96a1e330078076cbe61f0f6e2ff4ed89bd..68094bea75635376665ef850ed01484a2b27f630 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java @@ -15,8 +15,16 @@ public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warde super(server, entity); } + // Folia start - region threading + @Override + public Warden getHandleRaw() { + return (Warden)this.entity; + } + // Folia end - region threading + @Override public Warden getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (Warden) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java index 1b347deb6eb0b39c4a23936f7cd387421f06350d..4e5d311e10736f84964c22cb01a9fafe38bc445c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWaterMob.java @@ -10,8 +10,16 @@ public class CraftWaterMob extends CraftCreature implements WaterMob { super(server, entity); } + // Folia start - region threading + @Override + public WaterAnimal getHandleRaw() { + return (WaterAnimal)this.entity; + } + // Folia end - region threading + @Override public WaterAnimal getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (WaterAnimal) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java index 4b3d783cabcb2de1a67d7fbfb6f525bfb493aed1..b8d1fe35b9c0b00389b2aaca229f31a6d0de85c6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java @@ -15,8 +15,16 @@ public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo. super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Witch getHandleRaw() { + return (net.minecraft.world.entity.monster.Witch)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Witch getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Witch) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java index 7a8ce6956db56061af93ba9761f5d1057a90bc49..97891857b2c942c7f6e95c94e3c00abc3da2feea 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java @@ -21,8 +21,16 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok } } + // Folia start - region threading + @Override + public WitherBoss getHandleRaw() { + return (WitherBoss)this.entity; + } + // Folia end - region threading + @Override public WitherBoss getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (WitherBoss) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java index bc978391255c9414e06ff393f2e6707d329d020a..5af2d0f7c496d49dcb66b888047836c05299ffc7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitherSkull.java @@ -18,8 +18,16 @@ public class CraftWitherSkull extends CraftFireball implements WitherSkull { return this.getHandle().isDangerous(); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.projectile.WitherSkull getHandleRaw() { + return (net.minecraft.world.entity.projectile.WitherSkull)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.projectile.WitherSkull getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.projectile.WitherSkull) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java index 38b6d2c377800134de592a780b737b45c8096a11..ca35b9bdabc456b64272046cb069b8d7477aa1b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java @@ -23,8 +23,16 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf { } } + // Folia start - region threading + @Override + public net.minecraft.world.entity.animal.Wolf getHandleRaw() { + return (net.minecraft.world.entity.animal.Wolf)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.animal.Wolf getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.animal.Wolf) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZoglin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZoglin.java index c134c4bb8c0377ceb7f8a5c40c94fd6312a9e448..e119b2d0f9b3264a6105d18c9c67b91ae3466540 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZoglin.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZoglin.java @@ -19,8 +19,16 @@ public class CraftZoglin extends CraftMonster implements Zoglin { this.getHandle().setBaby(flag); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Zoglin getHandleRaw() { + return (net.minecraft.world.entity.monster.Zoglin)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Zoglin getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Zoglin) this.entity; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index 46336111dcf62a29390e724b1879c84c697076e9..ff6965694ffeee0e895a128351270361360c701d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -12,8 +12,16 @@ public class CraftZombie extends CraftMonster implements Zombie { super(server, entity); } + // Folia start - region threading + @Override + public net.minecraft.world.entity.monster.Zombie getHandleRaw() { + return (net.minecraft.world.entity.monster.Zombie)this.entity; + } + // Folia end - region threading + @Override public net.minecraft.world.entity.monster.Zombie getHandle() { + io.papermc.paper.util.TickThread.ensureTickThread(this.entity, "Accessing entity state off owning region's thread"); // Folia - region threading return (net.minecraft.world.entity.monster.Zombie) this.entity; }