Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 04:50:06 +01:00
#724: Re-implement player portal event search radius and creation API
This also fixes that the nether/end portals would be created even if the event was cancelled as well as that the EntityPortalEvent would be called for player portal usage which is not according to its API specification
Dieser Commit ist enthalten in:
Ursprung
f26d8e84ce
Commit
1e76d09fad
@ -7,7 +7,7 @@
|
|||||||
+// CraftBukkit start
|
+// CraftBukkit start
|
||||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
+import org.bukkit.craftbukkit.block.CraftBlockState;
|
+import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
+import org.bukkit.event.entity.EntityPortalEnterEvent;
|
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||||
+import org.bukkit.event.world.PortalCreateEvent;
|
+import org.bukkit.event.world.PortalCreateEvent;
|
||||||
+// CraftBukkit end
|
+// CraftBukkit end
|
||||||
+
|
+
|
||||||
@ -62,11 +62,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean c() {
|
public boolean c() {
|
||||||
|
@@ -194,7 +221,7 @@
|
||||||
|
return new Vec3D(d2, d3, d4);
|
||||||
|
}
|
||||||
|
|
||||||
|
- public static ShapeDetectorShape a(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, EntitySize entitysize, Vec3D vec3d1, float f, float f1) {
|
||||||
|
+ public static ShapeDetectorShape a(WorldServer worldserver, BlockUtil.Rectangle blockutil_rectangle, EnumDirection.EnumAxis enumdirection_enumaxis, Vec3D vec3d, EntitySize entitysize, Vec3D vec3d1, float f, float f1, CraftPortalEvent portalEventInfo) { // CraftBukkit // PAIL rename toDetectorShape
|
||||||
|
BlockPosition blockposition = blockutil_rectangle.origin;
|
||||||
|
IBlockData iblockdata = worldserver.getType(blockposition);
|
||||||
|
EnumDirection.EnumAxis enumdirection_enumaxis1 = (EnumDirection.EnumAxis) iblockdata.get(BlockProperties.E);
|
||||||
@@ -208,6 +235,6 @@
|
@@ -208,6 +235,6 @@
|
||||||
boolean flag = enumdirection_enumaxis1 == EnumDirection.EnumAxis.X;
|
boolean flag = enumdirection_enumaxis1 == EnumDirection.EnumAxis.X;
|
||||||
Vec3D vec3d3 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
|
Vec3D vec3d3 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
|
||||||
|
|
||||||
- return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1);
|
- return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1);
|
||||||
+ return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1, worldserver); // CraftBukkit
|
+ return new ShapeDetectorShape(vec3d3, vec3d2, f + (float) i, f1, worldserver, portalEventInfo); // CraftBukkit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
--- a/net/minecraft/server/Entity.java
|
--- a/net/minecraft/server/Entity.java
|
||||||
+++ b/net/minecraft/server/Entity.java
|
+++ b/net/minecraft/server/Entity.java
|
||||||
@@ -21,8 +21,56 @@
|
@@ -21,8 +21,58 @@
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
+// CraftBukkit start
|
+// CraftBukkit start
|
||||||
+import org.bukkit.Bukkit;
|
+import org.bukkit.Bukkit;
|
||||||
|
+import org.bukkit.Location;
|
||||||
+import org.bukkit.Server;
|
+import org.bukkit.Server;
|
||||||
+import org.bukkit.block.BlockFace;
|
+import org.bukkit.block.BlockFace;
|
||||||
+import org.bukkit.command.CommandSender;
|
+import org.bukkit.command.CommandSender;
|
||||||
|
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||||
+import org.bukkit.entity.Hanging;
|
+import org.bukkit.entity.Hanging;
|
||||||
+import org.bukkit.entity.LivingEntity;
|
+import org.bukkit.entity.LivingEntity;
|
||||||
+import org.bukkit.entity.Vehicle;
|
+import org.bukkit.entity.Vehicle;
|
||||||
@ -57,7 +59,7 @@
|
|||||||
protected static final Logger LOGGER = LogManager.getLogger();
|
protected static final Logger LOGGER = LogManager.getLogger();
|
||||||
private static final AtomicInteger entityCount = new AtomicInteger();
|
private static final AtomicInteger entityCount = new AtomicInteger();
|
||||||
private static final List<ItemStack> c = Collections.emptyList();
|
private static final List<ItemStack> c = Collections.emptyList();
|
||||||
@@ -106,6 +154,20 @@
|
@@ -106,6 +156,20 @@
|
||||||
private long aB;
|
private long aB;
|
||||||
private EntitySize size;
|
private EntitySize size;
|
||||||
private float headHeight;
|
private float headHeight;
|
||||||
@ -78,7 +80,7 @@
|
|||||||
|
|
||||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||||
this.id = Entity.entityCount.incrementAndGet();
|
this.id = Entity.entityCount.incrementAndGet();
|
||||||
@@ -212,6 +274,12 @@
|
@@ -212,6 +276,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPose(EntityPose entitypose) {
|
public void setPose(EntityPose entitypose) {
|
||||||
@ -91,7 +93,7 @@
|
|||||||
this.datawatcher.set(Entity.POSE, entitypose);
|
this.datawatcher.set(Entity.POSE, entitypose);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,6 +296,33 @@
|
@@ -228,6 +298,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setYawPitch(float f, float f1) {
|
protected void setYawPitch(float f, float f1) {
|
||||||
@ -125,7 +127,7 @@
|
|||||||
this.yaw = f % 360.0F;
|
this.yaw = f % 360.0F;
|
||||||
this.pitch = f1 % 360.0F;
|
this.pitch = f1 % 360.0F;
|
||||||
}
|
}
|
||||||
@@ -235,6 +330,7 @@
|
@@ -235,6 +332,7 @@
|
||||||
public void setPosition(double d0, double d1, double d2) {
|
public void setPosition(double d0, double d1, double d2) {
|
||||||
this.setPositionRaw(d0, d1, d2);
|
this.setPositionRaw(d0, d1, d2);
|
||||||
this.a(this.size.a(d0, d1, d2));
|
this.a(this.size.a(d0, d1, d2));
|
||||||
@ -133,7 +135,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void ae() {
|
protected void ae() {
|
||||||
@@ -249,6 +345,15 @@
|
@@ -249,6 +347,15 @@
|
||||||
this.entityBaseTick();
|
this.entityBaseTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +151,7 @@
|
|||||||
public void entityBaseTick() {
|
public void entityBaseTick() {
|
||||||
this.world.getMethodProfiler().enter("entityBaseTick");
|
this.world.getMethodProfiler().enter("entityBaseTick");
|
||||||
if (this.isPassenger() && this.getVehicle().dead) {
|
if (this.isPassenger() && this.getVehicle().dead) {
|
||||||
@@ -262,7 +367,7 @@
|
@@ -262,7 +369,7 @@
|
||||||
this.z = this.A;
|
this.z = this.A;
|
||||||
this.lastPitch = this.pitch;
|
this.lastPitch = this.pitch;
|
||||||
this.lastYaw = this.yaw;
|
this.lastYaw = this.yaw;
|
||||||
@ -158,7 +160,7 @@
|
|||||||
if (this.aN()) {
|
if (this.aN()) {
|
||||||
this.aO();
|
this.aO();
|
||||||
}
|
}
|
||||||
@@ -325,12 +430,44 @@
|
@@ -325,12 +432,44 @@
|
||||||
|
|
||||||
protected void burnFromLava() {
|
protected void burnFromLava() {
|
||||||
if (!this.isFireProof()) {
|
if (!this.isFireProof()) {
|
||||||
@ -204,7 +206,7 @@
|
|||||||
int j = i * 20;
|
int j = i * 20;
|
||||||
|
|
||||||
if (this instanceof EntityLiving) {
|
if (this instanceof EntityLiving) {
|
||||||
@@ -427,6 +564,28 @@
|
@@ -427,6 +566,28 @@
|
||||||
block.a((IBlockAccess) this.world, this);
|
block.a((IBlockAccess) this.world, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +235,7 @@
|
|||||||
if (this.onGround && !this.bu()) {
|
if (this.onGround && !this.bu()) {
|
||||||
block.stepOn(this.world, blockposition, this);
|
block.stepOn(this.world, blockposition, this);
|
||||||
}
|
}
|
||||||
@@ -700,6 +859,7 @@
|
@@ -700,6 +861,7 @@
|
||||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||||
|
|
||||||
this.setPositionRaw((axisalignedbb.minX + axisalignedbb.maxX) / 2.0D, axisalignedbb.minY, (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D);
|
this.setPositionRaw((axisalignedbb.minX + axisalignedbb.maxX) / 2.0D, axisalignedbb.minY, (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D);
|
||||||
@ -241,7 +243,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected SoundEffect getSoundSwim() {
|
protected SoundEffect getSoundSwim() {
|
||||||
@@ -1025,6 +1185,13 @@
|
@@ -1025,6 +1187,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnIn(World world) {
|
public void spawnIn(World world) {
|
||||||
@ -255,7 +257,7 @@
|
|||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1044,6 +1211,7 @@
|
@@ -1044,6 +1213,7 @@
|
||||||
this.lastY = d1;
|
this.lastY = d1;
|
||||||
this.lastZ = d4;
|
this.lastZ = d4;
|
||||||
this.setPosition(d3, d1, d4);
|
this.setPosition(d3, d1, d4);
|
||||||
@ -263,7 +265,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void d(Vec3D vec3d) {
|
public void d(Vec3D vec3d) {
|
||||||
@@ -1218,6 +1386,12 @@
|
@@ -1218,6 +1388,12 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +278,7 @@
|
|||||||
public void a(Entity entity, int i, DamageSource damagesource) {
|
public void a(Entity entity, int i, DamageSource damagesource) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource);
|
CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource);
|
||||||
@@ -1228,7 +1402,7 @@
|
@@ -1228,7 +1404,7 @@
|
||||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||||
String s = this.getSaveID();
|
String s = this.getSaveID();
|
||||||
|
|
||||||
@ -285,7 +287,7 @@
|
|||||||
nbttagcompound.setString("id", s);
|
nbttagcompound.setString("id", s);
|
||||||
this.save(nbttagcompound);
|
this.save(nbttagcompound);
|
||||||
return true;
|
return true;
|
||||||
@@ -1252,6 +1426,18 @@
|
@@ -1252,6 +1428,18 @@
|
||||||
Vec3D vec3d = this.getMot();
|
Vec3D vec3d = this.getMot();
|
||||||
|
|
||||||
nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z));
|
nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z));
|
||||||
@ -304,7 +306,7 @@
|
|||||||
nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch));
|
nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch));
|
||||||
nbttagcompound.setFloat("FallDistance", this.fallDistance);
|
nbttagcompound.setFloat("FallDistance", this.fallDistance);
|
||||||
nbttagcompound.setShort("Fire", (short) this.fireTicks);
|
nbttagcompound.setShort("Fire", (short) this.fireTicks);
|
||||||
@@ -1260,6 +1446,12 @@
|
@@ -1260,6 +1448,12 @@
|
||||||
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
|
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
|
||||||
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
|
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
|
||||||
nbttagcompound.a("UUID", this.getUniqueID());
|
nbttagcompound.a("UUID", this.getUniqueID());
|
||||||
@ -317,7 +319,7 @@
|
|||||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||||
|
|
||||||
if (ichatbasecomponent != null) {
|
if (ichatbasecomponent != null) {
|
||||||
@@ -1317,6 +1509,11 @@
|
@@ -1317,6 +1511,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +331,7 @@
|
|||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
||||||
@@ -1394,6 +1591,43 @@
|
@@ -1394,6 +1593,43 @@
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Entity has invalid position");
|
throw new IllegalStateException("Entity has invalid position");
|
||||||
}
|
}
|
||||||
@ -373,7 +375,7 @@
|
|||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||||
@@ -1469,9 +1703,22 @@
|
@@ -1469,9 +1705,22 @@
|
||||||
} else if (this.world.isClientSide) {
|
} else if (this.world.isClientSide) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
@ -396,7 +398,7 @@
|
|||||||
this.world.addEntity(entityitem);
|
this.world.addEntity(entityitem);
|
||||||
return entityitem;
|
return entityitem;
|
||||||
}
|
}
|
||||||
@@ -1555,7 +1802,7 @@
|
@@ -1555,7 +1804,7 @@
|
||||||
|
|
||||||
this.setPose(EntityPose.STANDING);
|
this.setPose(EntityPose.STANDING);
|
||||||
this.vehicle = entity;
|
this.vehicle = entity;
|
||||||
@ -405,7 +407,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1580,7 +1827,7 @@
|
@@ -1580,7 +1829,7 @@
|
||||||
Entity entity = this.vehicle;
|
Entity entity = this.vehicle;
|
||||||
|
|
||||||
this.vehicle = null;
|
this.vehicle = null;
|
||||||
@ -414,7 +416,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1589,10 +1836,31 @@
|
@@ -1589,10 +1838,31 @@
|
||||||
this.be();
|
this.be();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,7 +449,7 @@
|
|||||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
||||||
this.passengers.add(0, entity);
|
this.passengers.add(0, entity);
|
||||||
} else {
|
} else {
|
||||||
@@ -1600,15 +1868,36 @@
|
@@ -1600,15 +1870,36 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -485,7 +487,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean q(Entity entity) {
|
protected boolean q(Entity entity) {
|
||||||
@@ -1649,11 +1938,17 @@
|
@@ -1649,11 +1940,17 @@
|
||||||
ResourceKey<World> resourcekey = this.world.getDimensionKey() == World.THE_NETHER ? World.OVERWORLD : World.THE_NETHER;
|
ResourceKey<World> resourcekey = this.world.getDimensionKey() == World.THE_NETHER ? World.OVERWORLD : World.THE_NETHER;
|
||||||
WorldServer worldserver1 = minecraftserver.getWorldServer(resourcekey);
|
WorldServer worldserver1 = minecraftserver.getWorldServer(resourcekey);
|
||||||
|
|
||||||
@ -505,7 +507,7 @@
|
|||||||
this.world.getMethodProfiler().exit();
|
this.world.getMethodProfiler().exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1753,6 +2048,13 @@
|
@@ -1753,6 +2050,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSwimming(boolean flag) {
|
public void setSwimming(boolean flag) {
|
||||||
@ -519,7 +521,7 @@
|
|||||||
this.setFlag(4, flag);
|
this.setFlag(4, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1813,16 +2115,56 @@
|
@@ -1813,16 +2117,56 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAirTicks(int i) {
|
public void setAirTicks(int i) {
|
||||||
@ -554,9 +556,8 @@
|
|||||||
+ this.setOnFire(entityCombustEvent.getDuration(), false);
|
+ this.setOnFire(entityCombustEvent.getDuration(), false);
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
- this.damageEntity(DamageSource.LIGHTNING, 5.0F);
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ if (thisBukkitEntity instanceof Hanging) {
|
+ if (thisBukkitEntity instanceof Hanging) {
|
||||||
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
|
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
|
||||||
@ -565,8 +566,9 @@
|
|||||||
+ if (hangingEvent.isCancelled()) {
|
+ if (hangingEvent.isCancelled()) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
|
- this.damageEntity(DamageSource.LIGHTNING, 5.0F);
|
||||||
+ if (this.isFireProof()) {
|
+ if (this.isFireProof()) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
@ -579,7 +581,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void k(boolean flag) {
|
public void k(boolean flag) {
|
||||||
@@ -1972,15 +2314,32 @@
|
@@ -1972,15 +2316,32 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Entity b(WorldServer worldserver) {
|
public Entity b(WorldServer worldserver) {
|
||||||
@ -601,7 +603,7 @@
|
|||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.world.getMethodProfiler().enter("reposition");
|
this.world.getMethodProfiler().enter("reposition");
|
||||||
- ShapeDetectorShape shapedetectorshape = this.a(worldserver);
|
- ShapeDetectorShape shapedetectorshape = this.a(worldserver);
|
||||||
+ ShapeDetectorShape shapedetectorshape = (location == null) ? this.a(worldserver) : new ShapeDetectorShape(new Vec3D(location.getX(), location.getY(), location.getZ()), Vec3D.a, this.yaw, this.pitch, worldserver); // CraftBukkit
|
+ ShapeDetectorShape shapedetectorshape = (location == null) ? this.a(worldserver) : new ShapeDetectorShape(new Vec3D(location.getX(), location.getY(), location.getZ()), Vec3D.a, this.yaw, this.pitch, worldserver, null); // CraftBukkit
|
||||||
|
|
||||||
if (shapedetectorshape == null) {
|
if (shapedetectorshape == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -614,7 +616,7 @@
|
|||||||
this.world.getMethodProfiler().exitEnter("reloading");
|
this.world.getMethodProfiler().exitEnter("reloading");
|
||||||
Entity entity = this.getEntityType().a((World) worldserver);
|
Entity entity = this.getEntityType().a((World) worldserver);
|
||||||
|
|
||||||
@@ -1989,9 +2348,17 @@
|
@@ -1989,9 +2350,17 @@
|
||||||
entity.setPositionRotation(shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, entity.pitch);
|
entity.setPositionRotation(shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, entity.pitch);
|
||||||
entity.setMot(shapedetectorshape.velocity);
|
entity.setMot(shapedetectorshape.velocity);
|
||||||
worldserver.addEntityTeleport(entity);
|
worldserver.addEntityTeleport(entity);
|
||||||
@ -622,19 +624,19 @@
|
|||||||
- WorldServer.a(worldserver);
|
- WorldServer.a(worldserver);
|
||||||
+ if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
|
+ if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
|
||||||
+ WorldServer.a(worldserver, this); // CraftBukkit
|
+ WorldServer.a(worldserver, this); // CraftBukkit
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||||
+ this.getBukkitEntity().setHandle(entity);
|
+ this.getBukkitEntity().setHandle(entity);
|
||||||
+ entity.bukkitEntity = this.getBukkitEntity();
|
+ entity.bukkitEntity = this.getBukkitEntity();
|
||||||
+
|
+
|
||||||
+ if (this instanceof EntityInsentient) {
|
+ if (this instanceof EntityInsentient) {
|
||||||
+ ((EntityInsentient) this).unleash(true, false); // Unleash to prevent duping of leads.
|
+ ((EntityInsentient) this).unleash(true, false); // Unleash to prevent duping of leads.
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bM();
|
this.bM();
|
||||||
@@ -2012,13 +2379,18 @@
|
@@ -2012,13 +2381,18 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
protected ShapeDetectorShape a(WorldServer worldserver) {
|
protected ShapeDetectorShape a(WorldServer worldserver) {
|
||||||
@ -644,8 +646,8 @@
|
|||||||
+ if (worldserver == null) {
|
+ if (worldserver == null) {
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+ boolean flag = this.world.getTypeKey() == DimensionManager.THE_END && worldserver.getTypeKey() == DimensionManager.OVERWORLD;
|
+ boolean flag = this.world.getTypeKey() == DimensionManager.THE_END && worldserver.getTypeKey() == DimensionManager.OVERWORLD; // fromEndToOverworld
|
||||||
+ boolean flag1 = worldserver.getTypeKey() == DimensionManager.THE_END;
|
+ boolean flag1 = worldserver.getTypeKey() == DimensionManager.THE_END; // targetIsEnd
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
|
||||||
if (!flag && !flag1) {
|
if (!flag && !flag1) {
|
||||||
@ -657,67 +659,79 @@
|
|||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||||
@@ -2028,8 +2400,17 @@
|
@@ -2028,8 +2402,16 @@
|
||||||
double d3 = Math.min(2.9999872E7D, worldborder.h() - 16.0D);
|
double d3 = Math.min(2.9999872E7D, worldborder.h() - 16.0D);
|
||||||
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
|
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
|
||||||
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
|
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, 128);
|
+ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
||||||
+ if (event == null) {
|
+ if (event == null) {
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+ final WorldServer worldserverFinal = worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
+ final WorldServer worldserverFinal = worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||||
+ blockposition = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
+ blockposition = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||||
+ int searchRadius = event.getSearchRadius();
|
|
||||||
+ // CraftBukkit end
|
|
||||||
|
|
||||||
- return (ShapeDetectorShape) this.a(worldserver, blockposition, flag2).map((blockutil_rectangle) -> {
|
- return (ShapeDetectorShape) this.a(worldserver, blockposition, flag2).map((blockutil_rectangle) -> {
|
||||||
+ return (ShapeDetectorShape) this.a(worldserver, blockposition, flag2, searchRadius).map((blockutil_rectangle) -> {
|
+ return (ShapeDetectorShape) this.a(worldserver, blockposition, flag2, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius()).map((blockutil_rectangle) -> {
|
||||||
|
+ // CraftBukkit end
|
||||||
IBlockData iblockdata = this.world.getType(this.ac);
|
IBlockData iblockdata = this.world.getType(this.ac);
|
||||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||||
Vec3D vec3d;
|
Vec3D vec3d;
|
||||||
@@ -2046,8 +2427,8 @@
|
@@ -2046,8 +2428,8 @@
|
||||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
- return BlockPortalShape.a(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.yaw, this.pitch);
|
- return BlockPortalShape.a(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.yaw, this.pitch);
|
||||||
- }).orElse((Object) null);
|
- }).orElse((Object) null);
|
||||||
+ return BlockPortalShape.a(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.yaw, this.pitch); // CraftBukkit
|
+ return BlockPortalShape.a(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.yaw, this.pitch, event); // CraftBukkit
|
||||||
+ }).orElse(null); // CraftBuukkit - decompile error
|
+ }).orElse(null); // CraftBuukkit - decompile error
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BlockPosition blockposition1;
|
BlockPosition blockposition1;
|
||||||
@@ -2057,8 +2438,15 @@
|
@@ -2057,8 +2439,15 @@
|
||||||
} else {
|
} else {
|
||||||
blockposition1 = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn());
|
blockposition1 = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn());
|
||||||
}
|
}
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition1, 0);
|
+ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition1, PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
|
||||||
+ if (event == null) {
|
+ if (event == null) {
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+ blockposition1 = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
+ blockposition1 = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||||
|
|
||||||
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.yaw, this.pitch);
|
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.yaw, this.pitch);
|
||||||
+ return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.yaw, this.pitch, ((CraftWorld) event.getTo().getWorld()).getHandle());
|
+ return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.yaw, this.pitch, ((CraftWorld) event.getTo().getWorld()).getHandle(), null);
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2066,8 +2454,10 @@
|
@@ -2066,8 +2455,23 @@
|
||||||
return BlockPortalShape.a(blockutil_rectangle, enumdirection_enumaxis, this.getPositionVector(), this.a(this.getPose()));
|
return BlockPortalShape.a(blockutil_rectangle, enumdirection_enumaxis, this.getPositionVector(), this.a(this.getPose()));
|
||||||
}
|
}
|
||||||
|
|
||||||
- protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag) {
|
- protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag) {
|
||||||
- return worldserver.getTravelAgent().findPortal(blockposition, flag);
|
- return worldserver.getTravelAgent().findPortal(blockposition, flag);
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag, int radius) {
|
+ protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, BlockPosition exitPosition, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
||||||
+ return worldserver.getTravelAgent().findPortal(blockposition, radius);
|
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||||
|
+ Location enter = bukkitEntity.getLocation();
|
||||||
|
+ Location exit = new Location(exitWorldServer.getWorld(), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ());
|
||||||
|
+
|
||||||
|
+ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius);
|
||||||
|
+ event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||||
|
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !entity.isAlive()) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ return new CraftPortalEvent(event);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag, int searchRadius, boolean canCreatePortal, int createRadius) { // PAIL rename findOrCreatePortal
|
||||||
|
+ return worldserver.getTravelAgent().findPortal(blockposition, searchRadius);
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPortal() {
|
public boolean canPortal() {
|
||||||
@@ -2253,7 +2643,26 @@
|
@@ -2253,7 +2657,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(AxisAlignedBB axisalignedbb) {
|
public void a(AxisAlignedBB axisalignedbb) {
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
+// CraftBukkit start
|
+// CraftBukkit start
|
||||||
+import com.google.common.base.Preconditions;
|
|
||||||
+import org.bukkit.Bukkit;
|
+import org.bukkit.Bukkit;
|
||||||
+import org.bukkit.GameMode;
|
+import org.bukkit.GameMode;
|
||||||
+import org.bukkit.Location;
|
+import org.bukkit.Location;
|
||||||
@ -13,6 +12,7 @@
|
|||||||
+import org.bukkit.craftbukkit.CraftWorld;
|
+import org.bukkit.craftbukkit.CraftWorld;
|
||||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
|
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
+import org.bukkit.event.inventory.InventoryType;
|
+import org.bukkit.event.inventory.InventoryType;
|
||||||
+import org.bukkit.event.player.PlayerChangedMainHandEvent;
|
+import org.bukkit.event.player.PlayerChangedMainHandEvent;
|
||||||
@ -58,8 +58,8 @@
|
|||||||
+ this.displayName = this.getName();
|
+ this.displayName = this.getName();
|
||||||
+ this.canPickUpLoot = true;
|
+ this.canPickUpLoot = true;
|
||||||
+ this.maxHealthCache = this.getMaxHealth();
|
+ this.maxHealthCache = this.getMaxHealth();
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now.
|
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now.
|
||||||
+ // If this is an issue, PRs are welcome
|
+ // If this is an issue, PRs are welcome
|
||||||
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) {
|
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) {
|
||||||
@ -96,9 +96,9 @@
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return blockposition;
|
+ return blockposition;
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
private void c(WorldServer worldserver) {
|
private void c(WorldServer worldserver) {
|
||||||
BlockPosition blockposition = worldserver.getSpawn();
|
BlockPosition blockposition = worldserver.getSpawn();
|
||||||
|
|
||||||
@ -370,7 +370,7 @@
|
|||||||
Vec3D vec3d = shapedetectorshape.position.add(0.0D, -1.0D, 0.0D);
|
Vec3D vec3d = shapedetectorshape.position.add(0.0D, -1.0D, 0.0D);
|
||||||
|
|
||||||
- return new ShapeDetectorShape(vec3d, Vec3D.a, 90.0F, 0.0F);
|
- return new ShapeDetectorShape(vec3d, Vec3D.a, 90.0F, 0.0F);
|
||||||
+ return new ShapeDetectorShape(vec3d, Vec3D.a, 90.0F, 0.0F, worldserver); // CraftBukkit
|
+ return new ShapeDetectorShape(vec3d, Vec3D.a, 90.0F, 0.0F, worldserver, shapedetectorshape.portalEventInfo); // CraftBukkit
|
||||||
} else {
|
} else {
|
||||||
return shapedetectorshape;
|
return shapedetectorshape;
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@
|
|||||||
WorldData worlddata = worldserver.getWorldData();
|
WorldData worlddata = worldserver.getWorldData();
|
||||||
|
|
||||||
this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
|
this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
|
||||||
@@ -575,22 +780,65 @@
|
@@ -575,22 +780,52 @@
|
||||||
playerlist.d(this);
|
playerlist.d(this);
|
||||||
worldserver1.removePlayer(this);
|
worldserver1.removePlayer(this);
|
||||||
this.dead = false;
|
this.dead = false;
|
||||||
@ -423,36 +423,21 @@
|
|||||||
+ if (resourcekey == DimensionManager.OVERWORLD && worldserver.getTypeKey() == DimensionManager.THE_NETHER) { // CraftBukkit
|
+ if (resourcekey == DimensionManager.OVERWORLD && worldserver.getTypeKey() == DimensionManager.THE_NETHER) { // CraftBukkit
|
||||||
this.ci = this.getPositionVector();
|
this.ci = this.getPositionVector();
|
||||||
- } else if (worldserver.getDimensionKey() == World.THE_END) {
|
- } else if (worldserver.getDimensionKey() == World.THE_END) {
|
||||||
+ } else if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
|
+ } else if (worldserver.getTypeKey() == DimensionManager.THE_END && shapedetectorshape.portalEventInfo != null && shapedetectorshape.portalEventInfo.getCanCreatePortal()) { // CraftBukkit
|
||||||
this.a(worldserver, new BlockPosition(shapedetectorshape.position));
|
this.a(worldserver, new BlockPosition(shapedetectorshape.position));
|
||||||
}
|
}
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
|
+ } else {
|
||||||
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+ Location enter = this.getBukkitEntity().getLocation();
|
+ Location enter = this.getBukkitEntity().getLocation();
|
||||||
+ Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, shapedetectorshape.pitch);
|
+ Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, shapedetectorshape.pitch);
|
||||||
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == DimensionManager.THE_END ? 0 : 16);
|
|
||||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
+ if (event.isCancelled() || event.getTo() == null) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- worldserver1.getMethodProfiler().exit();
|
|
||||||
- worldserver1.getMethodProfiler().enter("placing");
|
|
||||||
+ exit = event.getTo();
|
|
||||||
+ if (exit == null) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ PlayerTeleportEvent tpEvent = new PlayerTeleportEvent(this.getBukkitEntity(), enter, exit, cause);
|
+ PlayerTeleportEvent tpEvent = new PlayerTeleportEvent(this.getBukkitEntity(), enter, exit, cause);
|
||||||
+ Bukkit.getServer().getPluginManager().callEvent(tpEvent);
|
+ Bukkit.getServer().getPluginManager().callEvent(tpEvent);
|
||||||
+ if (tpEvent.isCancelled() || tpEvent.getTo() == null) {
|
+ if (tpEvent.isCancelled() || tpEvent.getTo() == null) {
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ exit = tpEvent.getTo();
|
+ exit = tpEvent.getTo();
|
||||||
+ if (exit == null) {
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+ worldserver = ((CraftWorld) exit.getWorld()).getHandle();
|
+ worldserver = ((CraftWorld) exit.getWorld()).getHandle();
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
+
|
||||||
@ -468,7 +453,9 @@
|
|||||||
+ playerlist.d(this);
|
+ playerlist.d(this);
|
||||||
+ worldserver1.removePlayer(this);
|
+ worldserver1.removePlayer(this);
|
||||||
+ this.dead = false;
|
+ this.dead = false;
|
||||||
+
|
|
||||||
|
- worldserver1.getMethodProfiler().exit();
|
||||||
|
- worldserver1.getMethodProfiler().enter("placing");
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.spawnIn(worldserver);
|
this.spawnIn(worldserver);
|
||||||
worldserver.addPlayerPortal(this);
|
worldserver.addPlayerPortal(this);
|
||||||
@ -479,7 +466,7 @@
|
|||||||
worldserver1.getMethodProfiler().exit();
|
worldserver1.getMethodProfiler().exit();
|
||||||
this.triggerDimensionAdvancements(worldserver1);
|
this.triggerDimensionAdvancements(worldserver1);
|
||||||
this.playerInteractManager.a(worldserver);
|
this.playerInteractManager.a(worldserver);
|
||||||
@@ -609,6 +857,11 @@
|
@@ -609,12 +844,31 @@
|
||||||
this.lastSentExp = -1;
|
this.lastSentExp = -1;
|
||||||
this.lastHealthSent = -1.0F;
|
this.lastHealthSent = -1.0F;
|
||||||
this.lastFoodSent = -1;
|
this.lastFoodSent = -1;
|
||||||
@ -491,18 +478,46 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@@ -631,8 +884,8 @@
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ @Override
|
||||||
|
+ protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, BlockPosition exitPosition, TeleportCause cause, int searchRadius, int creationRadius) {
|
||||||
|
+ Location enter = this.getBukkitEntity().getLocation();
|
||||||
|
+ Location exit = new Location(exitWorldServer.getWorld(), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ(), yaw, pitch);
|
||||||
|
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, creationRadius);
|
||||||
|
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ return new CraftPortalEvent(event);
|
||||||
|
+ }
|
||||||
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
|
private void a(WorldServer worldserver, BlockPosition blockposition) {
|
||||||
|
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
|
||||||
|
|
||||||
|
@@ -631,14 +885,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
- protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag) {
|
- protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag) {
|
||||||
- Optional<BlockUtil.Rectangle> optional = super.a(worldserver, blockposition, flag);
|
- Optional<BlockUtil.Rectangle> optional = super.a(worldserver, blockposition, flag);
|
||||||
+ protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag, int radius) { // CraftBukkit
|
+ protected Optional<BlockUtil.Rectangle> a(WorldServer worldserver, BlockPosition blockposition, boolean flag, int searchRadius, boolean canCreatePortal, int createRadius) { // CraftBukkit // PAIL rename findOrCreatePortal
|
||||||
+ Optional<BlockUtil.Rectangle> optional = super.a(worldserver, blockposition, flag, radius); // CraftBukkit
|
+ Optional<BlockUtil.Rectangle> optional = super.a(worldserver, blockposition, flag, searchRadius, canCreatePortal, createRadius); // CraftBukkit
|
||||||
|
|
||||||
if (optional.isPresent()) {
|
- if (optional.isPresent()) {
|
||||||
|
+ if (optional.isPresent() || !canCreatePortal) { // CraftBukkit
|
||||||
return optional;
|
return optional;
|
||||||
@@ -685,10 +938,8 @@
|
} else {
|
||||||
|
EnumDirection.EnumAxis enumdirection_enumaxis = (EnumDirection.EnumAxis) this.world.getType(this.ac).d(BlockPortal.AXIS).orElse(EnumDirection.EnumAxis.X);
|
||||||
|
- Optional<BlockUtil.Rectangle> optional1 = worldserver.getTravelAgent().createPortal(blockposition, enumdirection_enumaxis);
|
||||||
|
+ Optional<BlockUtil.Rectangle> optional1 = worldserver.getTravelAgent().createPortal(blockposition, enumdirection_enumaxis, this, createRadius); // CraftBukkit
|
||||||
|
|
||||||
|
if (!optional1.isPresent()) {
|
||||||
|
EntityPlayer.LOGGER.error("Unable to create a portal, likely target out of worldborder");
|
||||||
|
@@ -685,10 +939,8 @@
|
||||||
this.activeContainer.c();
|
this.activeContainer.c();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,7 +530,7 @@
|
|||||||
if (!this.isSleeping() && this.isAlive()) {
|
if (!this.isSleeping() && this.isAlive()) {
|
||||||
if (!this.world.getDimensionManager().isNatural()) {
|
if (!this.world.getDimensionManager().isNatural()) {
|
||||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
||||||
@@ -714,7 +965,36 @@
|
@@ -714,7 +966,36 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +568,7 @@
|
|||||||
this.a(StatisticList.SLEEP_IN_BED);
|
this.a(StatisticList.SLEEP_IN_BED);
|
||||||
CriterionTriggers.q.a(this);
|
CriterionTriggers.q.a(this);
|
||||||
});
|
});
|
||||||
@@ -723,9 +1003,8 @@
|
@@ -723,9 +1004,8 @@
|
||||||
return either;
|
return either;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -564,7 +579,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -752,6 +1031,7 @@
|
@@ -752,6 +1032,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void wakeup(boolean flag, boolean flag1) {
|
public void wakeup(boolean flag, boolean flag1) {
|
||||||
@ -572,7 +587,7 @@
|
|||||||
if (this.isSleeping()) {
|
if (this.isSleeping()) {
|
||||||
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
||||||
}
|
}
|
||||||
@@ -823,8 +1103,9 @@
|
@@ -823,8 +1104,9 @@
|
||||||
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,7 +598,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -839,6 +1120,24 @@
|
@@ -839,6 +1121,24 @@
|
||||||
this.nextContainerCounter();
|
this.nextContainerCounter();
|
||||||
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
|
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
|
||||||
|
|
||||||
@ -608,7 +623,7 @@
|
|||||||
if (container == null) {
|
if (container == null) {
|
||||||
if (this.isSpectator()) {
|
if (this.isSpectator()) {
|
||||||
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
|
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
|
||||||
@@ -846,9 +1145,11 @@
|
@@ -846,9 +1146,11 @@
|
||||||
|
|
||||||
return OptionalInt.empty();
|
return OptionalInt.empty();
|
||||||
} else {
|
} else {
|
||||||
@ -622,7 +637,7 @@
|
|||||||
return OptionalInt.of(this.containerCounter);
|
return OptionalInt.of(this.containerCounter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -861,13 +1162,24 @@
|
@@ -861,13 +1163,24 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||||
@ -649,7 +664,7 @@
|
|||||||
this.activeContainer.addSlotListener(this);
|
this.activeContainer.addSlotListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,6 +1224,11 @@
|
@@ -912,6 +1225,11 @@
|
||||||
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
|
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
|
||||||
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
|
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
|
||||||
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
|
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
|
||||||
@ -661,7 +676,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -921,6 +1238,7 @@
|
@@ -921,6 +1239,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeInventory() {
|
public void closeInventory() {
|
||||||
@ -669,7 +684,7 @@
|
|||||||
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
||||||
this.o();
|
this.o();
|
||||||
}
|
}
|
||||||
@@ -955,7 +1273,7 @@
|
@@ -955,7 +1274,7 @@
|
||||||
@Override
|
@Override
|
||||||
public void a(Statistic<?> statistic, int i) {
|
public void a(Statistic<?> statistic, int i) {
|
||||||
this.serverStatisticManager.b(this, statistic, i);
|
this.serverStatisticManager.b(this, statistic, i);
|
||||||
@ -678,7 +693,7 @@
|
|||||||
scoreboardscore.addScore(i);
|
scoreboardscore.addScore(i);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -963,7 +1281,7 @@
|
@@ -963,7 +1282,7 @@
|
||||||
@Override
|
@Override
|
||||||
public void a(Statistic<?> statistic) {
|
public void a(Statistic<?> statistic) {
|
||||||
this.serverStatisticManager.setStatistic(this, statistic, 0);
|
this.serverStatisticManager.setStatistic(this, statistic, 0);
|
||||||
@ -687,24 +702,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1012,7 +1330,16 @@
|
@@ -1012,8 +1331,17 @@
|
||||||
|
|
||||||
public void triggerHealthUpdate() {
|
public void triggerHealthUpdate() {
|
||||||
this.lastHealthSent = -1.0E8F;
|
this.lastHealthSent = -1.0E8F;
|
||||||
+ this.lastSentExp = -1; // CraftBukkit - Added to reset
|
+ this.lastSentExp = -1; // CraftBukkit - Added to reset
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ // CraftBukkit start - Support multi-line messages
|
+ // CraftBukkit start - Support multi-line messages
|
||||||
+ public void sendMessage(IChatBaseComponent[] ichatbasecomponent) {
|
+ public void sendMessage(IChatBaseComponent[] ichatbasecomponent) {
|
||||||
+ for (IChatBaseComponent component : ichatbasecomponent) {
|
+ for (IChatBaseComponent component : ichatbasecomponent) {
|
||||||
+ this.sendMessage(component, SystemUtils.b);
|
+ this.sendMessage(component, SystemUtils.b);
|
||||||
+ }
|
+ }
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
@Override
|
@Override
|
||||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||||
@@ -1065,12 +1392,13 @@
|
this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT, SystemUtils.b));
|
||||||
|
@@ -1065,12 +1393,13 @@
|
||||||
this.lastSentExp = -1;
|
this.lastSentExp = -1;
|
||||||
this.lastHealthSent = -1.0F;
|
this.lastHealthSent = -1.0F;
|
||||||
this.lastFoodSent = -1;
|
this.lastFoodSent = -1;
|
||||||
@ -719,7 +735,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1138,6 +1466,18 @@
|
@@ -1138,6 +1467,18 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void a(EnumGamemode enumgamemode) {
|
public void a(EnumGamemode enumgamemode) {
|
||||||
@ -738,7 +754,7 @@
|
|||||||
this.playerInteractManager.setGameMode(enumgamemode);
|
this.playerInteractManager.setGameMode(enumgamemode);
|
||||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId()));
|
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId()));
|
||||||
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
||||||
@@ -1187,7 +1527,20 @@
|
@@ -1187,7 +1528,20 @@
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -759,7 +775,7 @@
|
|||||||
this.bY = packetplayinsettings.d();
|
this.bY = packetplayinsettings.d();
|
||||||
this.bZ = packetplayinsettings.e();
|
this.bZ = packetplayinsettings.e();
|
||||||
this.getDataWatcher().set(EntityPlayer.bi, (byte) packetplayinsettings.f());
|
this.getDataWatcher().set(EntityPlayer.bi, (byte) packetplayinsettings.f());
|
||||||
@@ -1223,13 +1576,13 @@
|
@@ -1223,13 +1577,13 @@
|
||||||
if (entity instanceof EntityHuman) {
|
if (entity instanceof EntityHuman) {
|
||||||
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
|
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
|
||||||
} else {
|
} else {
|
||||||
@ -775,7 +791,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1253,7 +1606,7 @@
|
@@ -1253,7 +1607,7 @@
|
||||||
this.spectatedEntity = (Entity) (entity == null ? this : entity);
|
this.spectatedEntity = (Entity) (entity == null ? this : entity);
|
||||||
if (entity1 != this.spectatedEntity) {
|
if (entity1 != this.spectatedEntity) {
|
||||||
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
|
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
|
||||||
@ -784,7 +800,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1282,7 +1635,7 @@
|
@@ -1282,7 +1636,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public IChatBaseComponent getPlayerListName() {
|
public IChatBaseComponent getPlayerListName() {
|
||||||
@ -793,7 +809,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1303,9 +1656,16 @@
|
@@ -1303,9 +1657,16 @@
|
||||||
return this.advancementDataPlayer;
|
return this.advancementDataPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,7 +826,7 @@
|
|||||||
if (worldserver == this.world) {
|
if (worldserver == this.world) {
|
||||||
this.playerConnection.a(d0, d1, d2, f, f1);
|
this.playerConnection.a(d0, d1, d2, f, f1);
|
||||||
} else {
|
} else {
|
||||||
@@ -1326,6 +1686,9 @@
|
@@ -1326,6 +1687,9 @@
|
||||||
this.server.getPlayerList().a(this, worldserver);
|
this.server.getPlayerList().a(this, worldserver);
|
||||||
this.server.getPlayerList().updateClient(this);
|
this.server.getPlayerList().updateClient(this);
|
||||||
}
|
}
|
||||||
@ -820,7 +836,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1418,4 +1781,144 @@
|
@@ -1418,4 +1782,144 @@
|
||||||
return entityitem;
|
return entityitem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,24 @@
|
|||||||
--- a/net/minecraft/server/ShapeDetectorShape.java
|
--- a/net/minecraft/server/ShapeDetectorShape.java
|
||||||
+++ b/net/minecraft/server/ShapeDetectorShape.java
|
+++ b/net/minecraft/server/ShapeDetectorShape.java
|
||||||
@@ -6,8 +6,12 @@
|
@@ -1,13 +1,21 @@
|
||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
+import org.bukkit.craftbukkit.event.CraftPortalEvent; // CraftBukkit
|
||||||
|
+
|
||||||
|
public class ShapeDetectorShape {
|
||||||
|
|
||||||
|
public final Vec3D position;
|
||||||
public final Vec3D velocity;
|
public final Vec3D velocity;
|
||||||
public final float yaw;
|
public final float yaw;
|
||||||
public final float pitch;
|
public final float pitch;
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public final WorldServer world;
|
+ public final WorldServer world;
|
||||||
|
+ public final CraftPortalEvent portalEventInfo;
|
||||||
|
|
||||||
- public ShapeDetectorShape(Vec3D vec3d, Vec3D vec3d1, float f, float f1) {
|
- public ShapeDetectorShape(Vec3D vec3d, Vec3D vec3d1, float f, float f1) {
|
||||||
+ public ShapeDetectorShape(Vec3D vec3d, Vec3D vec3d1, float f, float f1, WorldServer world) {
|
+ public ShapeDetectorShape(Vec3D vec3d, Vec3D vec3d1, float f, float f1, WorldServer world, CraftPortalEvent portalEventInfo) {
|
||||||
+ this.world = world;
|
+ this.world = world;
|
||||||
|
+ this.portalEventInfo = portalEventInfo;
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
this.position = vec3d;
|
this.position = vec3d;
|
||||||
this.velocity = vec3d1;
|
this.velocity = vec3d1;
|
||||||
|
@ -1572,22 +1572,6 @@ public class CraftEventFactory {
|
|||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* EntityPortalEvent
|
|
||||||
*/
|
|
||||||
public static EntityPortalEvent callEntityPortalEvent(Entity entity, World exitWorld, BlockPosition exitPosition, int searchRadius) {
|
|
||||||
org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
|
||||||
Location enter = bukkitEntity.getLocation();
|
|
||||||
Location exit = new Location(exitWorld.getWorld(), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ());
|
|
||||||
|
|
||||||
EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius);
|
|
||||||
event.getEntity().getServer().getPluginManager().callEvent(event);
|
|
||||||
if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !entity.isAlive()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LootGenerateEvent callLootGenerateEvent(IInventory inventory, LootTable lootTable, LootTableInfo lootInfo, List<ItemStack> loot, boolean plugin) {
|
public static LootGenerateEvent callLootGenerateEvent(IInventory inventory, LootTable lootTable, LootTableInfo lootInfo, List<ItemStack> loot, boolean plugin) {
|
||||||
CraftWorld world = lootInfo.getWorld().getWorld();
|
CraftWorld world = lootInfo.getWorld().getWorld();
|
||||||
Entity entity = lootInfo.getContextParameter(LootContextParameters.THIS_ENTITY);
|
Entity entity = lootInfo.getContextParameter(LootContextParameters.THIS_ENTITY);
|
||||||
|
53
src/main/java/org/bukkit/craftbukkit/event/CraftPortalEvent.java
Normale Datei
53
src/main/java/org/bukkit/craftbukkit/event/CraftPortalEvent.java
Normale Datei
@ -0,0 +1,53 @@
|
|||||||
|
package org.bukkit.craftbukkit.event;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.event.entity.EntityPortalEvent;
|
||||||
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class to hold information from the {@link PlayerPortalEvent} and {@link EntityPortalEvent}
|
||||||
|
*/
|
||||||
|
public class CraftPortalEvent {
|
||||||
|
private final Location to;
|
||||||
|
private final int searchRadius;
|
||||||
|
private final int creationRadius;
|
||||||
|
|
||||||
|
private final boolean canCreatePortal;
|
||||||
|
private final boolean cancelled;
|
||||||
|
|
||||||
|
public CraftPortalEvent(EntityPortalEvent portalEvent) {
|
||||||
|
to = portalEvent.getTo();
|
||||||
|
searchRadius = portalEvent.getSearchRadius();
|
||||||
|
cancelled = portalEvent.isCancelled();
|
||||||
|
creationRadius = 0;
|
||||||
|
canCreatePortal = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CraftPortalEvent(PlayerPortalEvent portalEvent) {
|
||||||
|
to = portalEvent.getTo();
|
||||||
|
searchRadius = portalEvent.getSearchRadius();
|
||||||
|
creationRadius = portalEvent.getCreationRadius();
|
||||||
|
canCreatePortal = portalEvent.getCanCreatePortal();
|
||||||
|
cancelled = portalEvent.isCancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getTo() {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSearchRadius() {
|
||||||
|
return searchRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCreationRadius() {
|
||||||
|
return creationRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getCanCreatePortal() {
|
||||||
|
return canCreatePortal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren