mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Fix anvil collisions
This fixes the server incorrectly moving the player out of an anvil when touching it on the side. The server used the rotation of the last placed anvil instead the of the rotation of the anvil the player was touching.
This commit is contained in:
parent
4ed5d54dde
commit
afe4189e46
2 changed files with 115 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
From 023df056c334c6f5e41eea9b32c722dc85d7622c Mon Sep 17 00:00:00 2001
|
||||
From 728698cfb07683d5ce15c07ea8cf32591cc4c95c Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sun, 1 Dec 2013 15:10:48 +1100
|
||||
Subject: [PATCH] mc-dev imports
|
||||
|
@ -289,6 +289,91 @@ index 0000000..b048d6c
|
|||
+ this.b(1, this.o, 16, 16);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockAnvil.java b/src/main/java/net/minecraft/server/BlockAnvil.java
|
||||
new file mode 100644
|
||||
index 0000000..9e1ce2f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/BlockAnvil.java
|
||||
@@ -0,0 +1,79 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+public class BlockAnvil extends BlockFalling {
|
||||
+
|
||||
+ public static final String[] a = new String[] { "intact", "slightlyDamaged", "veryDamaged"};
|
||||
+ private static final String[] N = new String[] { "anvil_top_damaged_0", "anvil_top_damaged_1", "anvil_top_damaged_2"};
|
||||
+
|
||||
+ protected BlockAnvil() {
|
||||
+ super(Material.HEAVY);
|
||||
+ this.g(0);
|
||||
+ this.a(CreativeModeTab.c);
|
||||
+ }
|
||||
+
|
||||
+ public boolean d() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public boolean c() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
|
||||
+ int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
+ int i1 = world.getData(i, j, k) >> 2;
|
||||
+
|
||||
+ ++l;
|
||||
+ l %= 4;
|
||||
+ if (l == 0) {
|
||||
+ world.setData(i, j, k, 2 | i1 << 2, 2);
|
||||
+ }
|
||||
+
|
||||
+ if (l == 1) {
|
||||
+ world.setData(i, j, k, 3 | i1 << 2, 2);
|
||||
+ }
|
||||
+
|
||||
+ if (l == 2) {
|
||||
+ world.setData(i, j, k, 0 | i1 << 2, 2);
|
||||
+ }
|
||||
+
|
||||
+ if (l == 3) {
|
||||
+ world.setData(i, j, k, 1 | i1 << 2, 2);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
|
||||
+ if (world.isStatic) {
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ entityhuman.openAnvil(i, j, k);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public int b() {
|
||||
+ return 35;
|
||||
+ }
|
||||
+
|
||||
+ public int getDropData(int i) {
|
||||
+ return i >> 2;
|
||||
+ }
|
||||
+
|
||||
+ public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
+ int l = iblockaccess.getData(i, j, k) & 3;
|
||||
+
|
||||
+ if (l != 3 && l != 1) {
|
||||
+ this.a(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F);
|
||||
+ } else {
|
||||
+ this.a(0.0F, 0.0F, 0.125F, 1.0F, 1.0F, 0.875F);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected void a(EntityFallingBlock entityfallingblock) {
|
||||
+ entityfallingblock.a(true);
|
||||
+ }
|
||||
+
|
||||
+ public void a(World world, int i, int j, int k, int l) {
|
||||
+ world.triggerEffect(1022, i, j, k, 0);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockBrewingStand.java b/src/main/java/net/minecraft/server/BlockBrewingStand.java
|
||||
new file mode 100644
|
||||
index 0000000..3287d77
|
||||
|
|
29
CraftBukkit-Patches/0091-Fix-anvil-collisions.patch
Normal file
29
CraftBukkit-Patches/0091-Fix-anvil-collisions.patch
Normal file
|
@ -0,0 +1,29 @@
|
|||
From 817267c19278a9c34c33b852009eb1d70058bb5c Mon Sep 17 00:00:00 2001
|
||||
From: Thinkofdeath <thethinkofdeath@gmail.com>
|
||||
Date: Thu, 9 Jan 2014 14:19:12 +0000
|
||||
Subject: [PATCH] Fix anvil collisions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockAnvil.java b/src/main/java/net/minecraft/server/BlockAnvil.java
|
||||
index 9e1ce2f..1fa14c5 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockAnvil.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockAnvil.java
|
||||
@@ -11,6 +11,15 @@ public class BlockAnvil extends BlockFalling {
|
||||
this.a(CreativeModeTab.c);
|
||||
}
|
||||
|
||||
+ // Spigot start
|
||||
+ @Override
|
||||
+ public AxisAlignedBB a( World world, int i, int j, int k )
|
||||
+ {
|
||||
+ updateShape( world, i, j, k );
|
||||
+ return super.a( world, i, j, k );
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
public boolean d() {
|
||||
return false;
|
||||
}
|
||||
--
|
||||
1.8.4.msysgit.0
|
||||
|
Loading…
Reference in a new issue