mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-31 12:23:51 -07:00
@@ -1,4 +1,4 @@
|
||||
From 6257069117c3870c0b8640386252867a3f4f5c0a Mon Sep 17 00:00:00 2001
|
||||
From d16b6fed78847a022e2898b61512adc00a86f6ac Mon Sep 17 00:00:00 2001
|
||||
From: Andy Shulman <andy.shulman@hotmail.com>
|
||||
Date: Mon, 15 Apr 2013 20:06:37 -0500
|
||||
Subject: [PATCH] Implement SpawnerSpawnEvent.
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Implement SpawnerSpawnEvent.
|
||||
Adds BUKKIT-267
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
index 4ba4735..d860c88 100644
|
||||
index 108b375..4edd5e3 100644
|
||||
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
||||
@@ -5,7 +5,11 @@ import java.util.Collection;
|
||||
@@ -30,13 +30,13 @@ index 4ba4735..d860c88 100644
|
||||
+ // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled
|
||||
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d());
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER);
|
||||
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound1;
|
||||
@@ -150,6 +159,12 @@ public abstract class MobSpawnerAbstract {
|
||||
@@ -150,6 +159,11 @@ public abstract class MobSpawnerAbstract {
|
||||
|
||||
entity2.f(nbttagcompound2);
|
||||
entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch);
|
||||
@@ -45,29 +45,28 @@ index 4ba4735..d860c88 100644
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.a().addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit);
|
||||
entity1.mount(entity2);
|
||||
}
|
||||
@@ -158,7 +173,12 @@ public abstract class MobSpawnerAbstract {
|
||||
if (entity.world != null) {
|
||||
entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
}
|
||||
@@ -161,7 +175,12 @@ public abstract class MobSpawnerAbstract {
|
||||
}
|
||||
} else if (entity instanceof EntityLiving && entity.world != null) {
|
||||
((EntityLiving) entity).bJ();
|
||||
- this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit);
|
||||
((EntityInsentient) entity).a((GroupDataEntity) null);
|
||||
- this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ // CraftBukkit start - call SpawnerSpawnEvent, abort if cancelled
|
||||
+ SpawnerSpawnEvent event = CraftEventFactory.callSpawnerSpawnEvent(entity, this.b(), this.c(), this.d());
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER);
|
||||
+ this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return entity;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 2b56c75..4ba43a0 100644
|
||||
index 9986b7a..b026e54 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -34,6 +34,7 @@ import org.bukkit.Material;
|
||||
@@ -35,6 +35,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
@@ -75,7 +74,7 @@ index 2b56c75..4ba43a0 100644
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
@@ -115,6 +116,22 @@ public class CraftEventFactory {
|
||||
@@ -116,6 +117,22 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user