mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
100 lines
5.4 KiB
Diff
100 lines
5.4 KiB
Diff
From c41f57a6a44ef40c5010c2fadaa6e583183c7995 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
Date: Mon, 29 Feb 2016 21:20:21 -0600
|
|
Subject: [PATCH] Vanished players don't have rights
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
|
index ca84d92..287566c 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
|
@@ -190,6 +190,14 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
|
}
|
|
}
|
|
|
|
+ // Paper start - Allow arrows to fly through vanished players the shooter can't see
|
|
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) {
|
|
+ if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
|
|
+ movingobjectposition = null;
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
if (movingobjectposition != null) {
|
|
this.a(movingobjectposition);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
|
index bfbae25..c8837be 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
|
@@ -224,6 +224,15 @@ public class EntityFishingHook extends Entity {
|
|
|
|
vec3d = new Vec3D(this.locX, this.locY, this.locZ);
|
|
vec3d1 = new Vec3D(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
|
+
|
|
+ // Paper start - Allow fishing hooks to fly through vanished players the shooter can't see
|
|
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && owner != null && owner instanceof EntityPlayer) {
|
|
+ if (!((EntityPlayer) owner).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
|
|
+ movingobjectposition = null;
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
if (movingobjectposition != null) {
|
|
vec3d1 = new Vec3D(movingobjectposition.pos.x, movingobjectposition.pos.y, movingobjectposition.pos.z);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
index 40ac335..3d5548f 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
|
|
@@ -160,6 +160,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
|
movingobjectposition = new MovingObjectPosition(entity);
|
|
}
|
|
|
|
+ // Paper start - Allow projectiles to fly through vanished players the shooter can't see
|
|
+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) {
|
|
+ if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) {
|
|
+ movingobjectposition = null;
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
if (movingobjectposition != null) {
|
|
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) {
|
|
this.e(movingobjectposition.a());
|
|
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
|
|
index eb32871..58ec8b5 100644
|
|
--- a/src/main/java/net/minecraft/server/ItemBlock.java
|
|
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
|
|
@@ -20,7 +20,7 @@ public class ItemBlock extends Item {
|
|
|
|
ItemStack itemstack = entityhuman.b(enumhand);
|
|
|
|
- if (!itemstack.isEmpty() && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, (Entity) null)) {
|
|
+ if (!itemstack.isEmpty() && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, entityhuman)) { // Paper - Pass entityhuman instead of null
|
|
int i = this.filterData(itemstack.getData());
|
|
IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index 78b5a3c..2a38b1c 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -1725,6 +1725,14 @@ public abstract class World implements IBlockAccess {
|
|
for (int i = 0; i < list.size(); ++i) {
|
|
Entity entity1 = (Entity) list.get(i);
|
|
|
|
+ // Paper start - Allow block placement if the placer cannot see the vanished blocker
|
|
+ if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) {
|
|
+ if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) {
|
|
+ continue;
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
if (!entity1.dead && entity1.i && entity1 != entity && (entity == null || entity1.x(entity))) {
|
|
return false;
|
|
}
|
|
--
|
|
2.10.2.windows.1
|
|
|