Fix LEFT_CLICK_AIR

By: Thinkofdeath <thinkofdeath@spigotmc.org>
This commit is contained in:
CraftBukkit/Spigot 2014-11-30 12:10:30 +00:00
parent 15cc288f9a
commit 9e7e5be4de

View file

@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde//net/minecraft/server/PlayerConnection.java 2014-11-28 23:05:41.713278672 +0000 --- ../work/decompile-8eb82bde//net/minecraft/server/PlayerConnection.java 2014-11-30 12:10:17.417157726 +0000
+++ src/main/java/net/minecraft/server/PlayerConnection.java 2014-11-28 22:57:27.221289000 +0000 +++ src/main/java/net/minecraft/server/PlayerConnection.java 2014-11-30 12:10:10.193157886 +0000
@@ -16,6 +16,48 @@ @@ -16,6 +16,48 @@
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -556,7 +556,7 @@
ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]);
chatmessage.getChatModifier().setColor(EnumChatFormat.RED); chatmessage.getChatModifier().setColor(EnumChatFormat.RED);
@@ -548,39 +852,248 @@ @@ -548,39 +852,247 @@
for (int i = 0; i < s.length(); ++i) { for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@ -755,12 +755,11 @@
PlayerConnectionUtils.ensureMainThread(packetplayinarmanimation, this, this.player.u()); PlayerConnectionUtils.ensureMainThread(packetplayinarmanimation, this, this.player.u());
this.player.z(); this.player.z();
+ // CraftBukkit start - Raytrace to look for 'rogue armswings' + // CraftBukkit start - Raytrace to look for 'rogue armswings'
+ float f = 1.0F; + float f1 = this.player.pitch;
+ float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f; + float f2 = this.player.yaw;
+ float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f; + double d0 = this.player.locX;
+ double d0 = this.player.lastX + (this.player.locX - this.player.lastX) * (double) f; + double d1 = this.player.locY + (double) this.player.getHeadHeight();
+ double d1 = this.player.lastY + (this.player.locY - this.player.lastY) * (double) f + 1.62D - (double) this.player.getHeadHeight(); + double d2 = this.player.locZ;
+ double d2 = this.player.lastZ + (this.player.locZ - this.player.lastZ) * (double) f;
+ Vec3D vec3d = new Vec3D(d0, d1, d2); + Vec3D vec3d = new Vec3D(d0, d1, d2);
+ +
+ float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F); + float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
@ -813,7 +812,7 @@
this.player.z(); this.player.z();
switch (SwitchHelperCommandActionType.b[packetplayinentityaction.b().ordinal()]) { switch (SwitchHelperCommandActionType.b[packetplayinentityaction.b().ordinal()]) {
case 1: case 1:
@@ -601,7 +1114,7 @@ @@ -601,7 +1113,7 @@
case 5: case 5:
this.player.a(false, true, true); this.player.a(false, true, true);
@ -822,7 +821,7 @@
break; break;
case 6: case 6:
@@ -623,6 +1136,7 @@ @@ -623,6 +1135,7 @@
} }
public void a(PacketPlayInUseEntity packetplayinuseentity) { public void a(PacketPlayInUseEntity packetplayinuseentity) {
@ -830,7 +829,7 @@
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u()); PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u());
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
Entity entity = packetplayinuseentity.a((World) worldserver); Entity entity = packetplayinuseentity.a((World) worldserver);
@@ -637,18 +1151,72 @@ @@ -637,18 +1150,72 @@
} }
if (this.player.h(entity) < d0) { if (this.player.h(entity) < d0) {
@ -904,7 +903,7 @@
} }
} }
} }
@@ -663,7 +1231,8 @@ @@ -663,7 +1230,8 @@
switch (SwitchHelperCommandActionType.c[enumclientcommand.ordinal()]) { switch (SwitchHelperCommandActionType.c[enumclientcommand.ordinal()]) {
case 1: case 1:
if (this.player.viewingCredits) { if (this.player.viewingCredits) {
@ -914,7 +913,7 @@
} else if (this.player.u().getWorldData().isHardcore()) { } else if (this.player.u().getWorldData().isHardcore()) {
if (this.minecraftServer.S() && this.player.getName().equals(this.minecraftServer.R())) { if (this.minecraftServer.S() && this.player.getName().equals(this.minecraftServer.R())) {
this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!");
@@ -694,11 +1263,17 @@ @@ -694,11 +1262,17 @@
} }
public void a(PacketPlayInCloseWindow packetplayinclosewindow) { public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
@ -932,7 +931,7 @@
PlayerConnectionUtils.ensureMainThread(packetplayinwindowclick, this, this.player.u()); PlayerConnectionUtils.ensureMainThread(packetplayinwindowclick, this, this.player.u());
this.player.z(); this.player.z();
if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player)) { if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player)) {
@@ -711,7 +1286,263 @@ @@ -711,7 +1285,263 @@
this.player.a(this.player.activeContainer, (List) arraylist); this.player.a(this.player.activeContainer, (List) arraylist);
} else { } else {
@ -1197,7 +1196,7 @@
if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) {
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true));
@@ -772,8 +1603,50 @@ @@ -772,8 +1602,50 @@
} }
boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize(); boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize();
@ -1249,7 +1248,7 @@
if (flag1 && flag2 && flag3) { if (flag1 && flag2 && flag3) {
if (itemstack == null) { if (itemstack == null) {
@@ -796,6 +1669,7 @@ @@ -796,6 +1668,7 @@
} }
public void a(PacketPlayInTransaction packetplayintransaction) { public void a(PacketPlayInTransaction packetplayintransaction) {
@ -1257,7 +1256,7 @@
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.u()); PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.u());
Short oshort = (Short) this.n.get(this.player.activeContainer.windowId); Short oshort = (Short) this.n.get(this.player.activeContainer.windowId);
@@ -806,6 +1680,7 @@ @@ -806,6 +1679,7 @@
} }
public void a(PacketPlayInUpdateSign packetplayinupdatesign) { public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
@ -1265,7 +1264,7 @@
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u()); PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u());
this.player.z(); this.player.z();
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
@@ -822,10 +1697,24 @@ @@ -822,10 +1696,24 @@
if (!tileentitysign.b() || tileentitysign.c() != this.player) { if (!tileentitysign.b() || tileentitysign.c() != this.player) {
this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
@ -1291,7 +1290,7 @@
tileentitysign.update(); tileentitysign.update();
worldserver.notify(blockposition); worldserver.notify(blockposition);
} }
@@ -847,11 +1736,28 @@ @@ -847,11 +1735,28 @@
public void a(PacketPlayInAbilities packetplayinabilities) { public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.u()); PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.u());
@ -1321,7 +1320,7 @@
ArrayList arraylist = Lists.newArrayList(); ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator();
@@ -891,13 +1797,15 @@ @@ -891,13 +1796,15 @@
itemstack1 = this.player.inventory.getItemInHand(); itemstack1 = this.player.inventory.getItemInHand();
if (itemstack1 != null) { if (itemstack1 != null) {
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
@ -1338,7 +1337,7 @@
return; return;
} finally { } finally {
packetdataserializer.release(); packetdataserializer.release();
@@ -909,27 +1817,31 @@ @@ -909,27 +1816,31 @@
try { try {
itemstack = packetdataserializer.i(); itemstack = packetdataserializer.i();
@ -1382,7 +1381,7 @@
return; return;
} finally { } finally {
packetdataserializer.release(); packetdataserializer.release();
@@ -946,6 +1858,7 @@ @@ -946,6 +1857,7 @@
} }
} catch (Exception exception2) { } catch (Exception exception2) {
PlayerConnection.c.error("Couldn\'t select trade", exception2); PlayerConnection.c.error("Couldn\'t select trade", exception2);
@ -1390,7 +1389,7 @@
} }
} else if ("MC|AdvCdm".equals(packetplayincustompayload.a())) { } else if ("MC|AdvCdm".equals(packetplayincustompayload.a())) {
if (!this.minecraftServer.getEnableCommandBlock()) { if (!this.minecraftServer.getEnableCommandBlock()) {
@@ -986,6 +1899,7 @@ @@ -986,6 +1898,7 @@
} }
} catch (Exception exception3) { } catch (Exception exception3) {
PlayerConnection.c.error("Couldn\'t set command block", exception3); PlayerConnection.c.error("Couldn\'t set command block", exception3);
@ -1398,7 +1397,7 @@
} finally { } finally {
packetdataserializer.release(); packetdataserializer.release();
} }
@@ -1011,6 +1925,7 @@ @@ -1011,6 +1924,7 @@
} }
} catch (Exception exception4) { } catch (Exception exception4) {
PlayerConnection.c.error("Couldn\'t set beacon", exception4); PlayerConnection.c.error("Couldn\'t set beacon", exception4);
@ -1406,7 +1405,7 @@
} }
} }
} else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) { } else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) {
@@ -1026,6 +1941,27 @@ @@ -1026,6 +1940,27 @@
containeranvil.a(""); containeranvil.a("");
} }
} }