3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/nms-patches/BlockPortal.patch
2014-11-28 11:23:19 +00:00

54 Zeilen
2.6 KiB
Diff

--- ../work/decompile-8eb82bde//net/minecraft/server/BlockPortal.java 2014-11-28 11:22:55.746823167 +0000
+++ src/main/java/net/minecraft/server/BlockPortal.java 2014-11-28 11:01:54.000000000 +0000
@@ -2,6 +2,8 @@
import java.util.Random;
+import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
+
public class BlockPortal extends BlockHalfTransparent {
public static final BlockStateEnum AXIS = BlockStateEnum.of("axis", EnumAxis.class, new EnumAxis[] { EnumAxis.X, EnumAxis.Z});
@@ -24,7 +26,8 @@
}
if (i > 0 && !world.getType(blockposition1.up()).getBlock().isOccluding()) {
- Entity entity = ItemMonsterEgg.a(world, 57, (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D);
+ // CraftBukkit - set spawn reason to NETHER_PORTAL
+ Entity entity = ItemMonsterEgg.spawnCreature(world, 57, (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
if (entity != null) {
entity.portalCooldown = entity.ar();
@@ -66,14 +69,16 @@
PortalCreator portalcreator = new PortalCreator(world, blockposition, EnumAxis.X);
if (portalcreator.b() && PortalCreator.a(portalcreator) == 0) {
- portalcreator.c();
- return true;
+ // CraftBukkit start - return portalcreator
+ return portalcreator.c();
+ // return true;
} else {
PortalCreator portalcreator1 = new PortalCreator(world, blockposition, EnumAxis.Z);
if (portalcreator1.b() && PortalCreator.a(portalcreator1) == 0) {
- portalcreator1.c();
- return true;
+ return portalcreator1.c();
+ // return true;
+ // CraftBukkit end
} else {
return false;
}
@@ -104,6 +109,10 @@
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (entity.vehicle == null && entity.passenger == null) {
+ // 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
entity.aq();
}