--- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
+++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java
@@ -47,6 +47,12 @@
 import net.minecraft.world.phys.Vec3D;
 import net.minecraft.world.phys.shapes.VoxelShapeCollision;
 
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.block.BlockDispenseLootEvent;
+// CraftBukkit end
+
 public final class TrialSpawner {
 
     public static final String NORMAL_CONFIG_TAG_NAME = "normal_config";
@@ -219,13 +225,18 @@
                                 }
 
                                 entityinsentient.setPersistenceRequired();
-                                Optional optional1 = mobspawnerdata.getEquipment();
+                                Optional<net.minecraft.world.entity.EquipmentTable> optional1 = mobspawnerdata.getEquipment(); // CraftBukkit - decompile error
 
                                 Objects.requireNonNull(entityinsentient);
                                 optional1.ifPresent(entityinsentient::equip);
                             }
 
-                            if (!worldserver.tryAddFreshEntityWithPassengers(entity)) {
+                            // CraftBukkit start
+                            if (org.bukkit.craftbukkit.event.CraftEventFactory.callTrialSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
+                                return Optional.empty();
+                            }
+                            if (!worldserver.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRIAL_SPAWNER)) {
+                                // CraftBukkit end
                                 return Optional.empty();
                             } else {
                                 TrialSpawner.a trialspawner_a = this.isOminous ? TrialSpawner.a.OMINOUS : TrialSpawner.a.NORMAL;
@@ -248,6 +259,15 @@
         ObjectArrayList<ItemStack> objectarraylist = loottable.getRandomItems(lootparams);
 
         if (!objectarraylist.isEmpty()) {
+            // CraftBukkit start
+            BlockDispenseLootEvent spawnerDispenseLootEvent = CraftEventFactory.callBlockDispenseLootEvent(worldserver, blockposition, null, objectarraylist);
+            if (spawnerDispenseLootEvent.isCancelled()) {
+                return;
+            }
+
+            objectarraylist = new ObjectArrayList<>(spawnerDispenseLootEvent.getDispensedLoot().stream().map(CraftItemStack::asNMSCopy).toList());
+            // CraftBukkit end
+
             ObjectListIterator objectlistiterator = objectarraylist.iterator();
 
             while (objectlistiterator.hasNext()) {
