2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockPortal.java
|
|
|
|
+++ b/net/minecraft/server/BlockPortal.java
|
2020-08-11 23:00:00 +02:00
|
|
|
@@ -2,6 +2,13 @@
|
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
import java.util.Random;
|
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.block.CraftBlock;
|
2019-05-05 02:51:43 +02:00
|
|
|
+import org.bukkit.craftbukkit.block.CraftBlockState;
|
2018-07-15 02:00:00 +02:00
|
|
|
+import org.bukkit.event.entity.EntityPortalEnterEvent;
|
|
|
|
+import org.bukkit.event.world.PortalCreateEvent;
|
|
|
|
+// CraftBukkit end
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2018-07-15 02:00:00 +02:00
|
|
|
public class BlockPortal extends Block {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.E;
|
2020-08-11 23:00:00 +02:00
|
|
|
@@ -32,7 +39,8 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
if (worldserver.getType(blockposition).a((IBlockAccess) worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
|
|
|
|
- Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit - set spawn reason to NETHER_PORTAL
|
2020-06-25 02:00:00 +02:00
|
|
|
+ Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
if (entity != null) {
|
2020-08-11 23:00:00 +02:00
|
|
|
entity.resetPortalCooldown();
|
|
|
|
@@ -54,6 +62,10 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2018-07-15 02:00:00 +02:00
|
|
|
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
2019-04-23 04:00:00 +02:00
|
|
|
if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start - Entity in portal
|
|
|
|
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
|
|
|
+ world.getServer().getPluginManager().callEvent(event);
|
|
|
|
+ // CraftBukkit end
|
2020-06-25 02:00:00 +02:00
|
|
|
entity.d(blockposition);
|
2015-02-26 23:41:06 +01:00
|
|
|
}
|
|
|
|
|