3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00

Fix block placement in the invisible players patch

Thanks Mojang...
Dieser Commit ist enthalten in:
Zach Brown 2015-01-03 17:35:46 -06:00
Ursprung 9ba61a6dd0
Commit 8f0aaf3411
2 geänderte Dateien mit 113 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -130,6 +130,106 @@ index 0000000..063177d
+
+ public abstract IBlockState l();
+}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
new file mode 100644
index 0000000..a4b50fe
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -0,0 +1,94 @@
+package net.minecraft.server;
+
+public class ItemBlock extends Item {
+
+ protected final Block a;
+
+ public ItemBlock(Block block) {
+ this.a = block;
+ }
+
+ public ItemBlock b(String s) {
+ super.c(s);
+ return this;
+ }
+
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) {
+ IBlockData iblockdata = world.getType(blockposition);
+ Block block = iblockdata.getBlock();
+
+ if (block == Blocks.SNOW_LAYER && ((Integer) iblockdata.get(BlockSnow.LAYERS)).intValue() < 1) {
+ enumdirection = EnumDirection.UP;
+ } else if (!block.f(world, blockposition)) {
+ blockposition = blockposition.shift(enumdirection);
+ }
+
+ if (itemstack.count == 0) {
+ return false;
+ } else if (!entityhuman.a(blockposition, enumdirection, itemstack)) {
+ return false;
+ } else if (blockposition.getY() == 255 && this.a.getMaterial().isBuildable()) {
+ return false;
+ } else if (world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) {
+ int i = this.filterData(itemstack.getData());
+ IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman);
+
+ if (world.setTypeAndData(blockposition, iblockdata1, 3)) {
+ iblockdata1 = world.getType(blockposition);
+ if (iblockdata1.getBlock() == this.a) {
+ a(world, blockposition, itemstack);
+ this.a.postPlace(world, blockposition, iblockdata1, entityhuman, itemstack);
+ }
+
+ world.makeSound((double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), this.a.stepSound.getPlaceSound(), (this.a.stepSound.getVolume1() + 1.0F) / 2.0F, this.a.stepSound.getVolume2() * 0.8F);
+ --itemstack.count;
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static boolean a(World world, BlockPosition blockposition, ItemStack itemstack) {
+ if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("BlockEntityTag", 10)) {
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
+ if (tileentity != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.clone();
+
+ tileentity.b(nbttagcompound);
+ NBTTagCompound nbttagcompound2 = (NBTTagCompound) itemstack.getTag().get("BlockEntityTag");
+
+ nbttagcompound.a(nbttagcompound2);
+ nbttagcompound.setInt("x", blockposition.getX());
+ nbttagcompound.setInt("y", blockposition.getY());
+ nbttagcompound.setInt("z", blockposition.getZ());
+ if (!nbttagcompound.equals(nbttagcompound1)) {
+ tileentity.a(nbttagcompound);
+ tileentity.update();
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public String e_(ItemStack itemstack) {
+ return this.a.a();
+ }
+
+ public String getName() {
+ return this.a.a();
+ }
+
+ public Block d() {
+ return this.a;
+ }
+
+ public Item c(String s) {
+ return this.b(s);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
new file mode 100644
index 0000000..620685a

Datei anzeigen

@ -4,6 +4,19 @@ Date: Fri, 28 Nov 2014 00:35:56 -0600
Subject: [PATCH] Vanished players don't have rights
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index a4b50fe..14ea66d 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -29,7 +29,7 @@ public class ItemBlock extends Item {
return false;
} else if (blockposition.getY() == 255 && this.a.getMaterial().isBuildable()) {
return false;
- } else if (world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) {
+ } else if (world.a(this.a, blockposition, false, enumdirection, entityhuman, itemstack)) { // PaperSpigot - 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/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 7d1727d..1d8b138 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java