mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
SPIGOT-4396: Improve vehicle movement
This commit is contained in:
@@ -212,7 +212,17 @@
|
||||
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), Double.valueOf(d6), Double.valueOf(d7), Double.valueOf(d8));
|
||||
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
|
||||
return;
|
||||
@@ -230,6 +366,62 @@
|
||||
@@ -222,14 +358,72 @@
|
||||
}
|
||||
|
||||
entity.setLocation(d3, d4, d5, f, f1);
|
||||
+ player.setLocation(d3, d4, d5, f, f1); // CraftBukkit
|
||||
boolean flag2 = worldserver.getCubes(entity, entity.getBoundingBox().shrink(0.0625D));
|
||||
|
||||
if (flag && (flag1 || !flag2)) {
|
||||
entity.setLocation(d0, d1, d2, f, f1);
|
||||
+ player.setLocation(d0, d1, d2, f, f1); // CraftBukkit
|
||||
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,7 +285,7 @@
|
||||
this.minecraftServer.getPlayerList().d(this.player);
|
||||
this.player.checkMovement(this.player.locX - d0, this.player.locY - d1, this.player.locZ - d2);
|
||||
this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && !worldserver.a(entity.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D));
|
||||
@@ -243,7 +435,7 @@
|
||||
@@ -243,7 +437,7 @@
|
||||
|
||||
public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer());
|
||||
@@ -284,7 +294,7 @@
|
||||
this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
|
||||
this.o = this.teleportPos.x;
|
||||
this.p = this.teleportPos.y;
|
||||
@@ -253,6 +445,7 @@
|
||||
@@ -253,6 +447,7 @@
|
||||
}
|
||||
|
||||
this.teleportPos = null;
|
||||
@@ -292,7 +302,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -289,6 +482,12 @@
|
||||
@@ -289,6 +484,12 @@
|
||||
|
||||
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer());
|
||||
@@ -305,7 +315,7 @@
|
||||
StringReader stringreader = new StringReader(packetplayintabcomplete.c());
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == 47) {
|
||||
@@ -298,7 +497,8 @@
|
||||
@@ -298,7 +499,8 @@
|
||||
ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
|
||||
|
||||
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
@@ -315,7 +325,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -492,6 +692,15 @@
|
||||
@@ -492,6 +694,15 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInBEdit packetplayinbedit) {
|
||||
@@ -331,7 +341,7 @@
|
||||
ItemStack itemstack = packetplayinbedit.b();
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
@@ -516,11 +725,13 @@
|
||||
@@ -516,11 +727,13 @@
|
||||
}
|
||||
|
||||
itemstack2.a("pages", (NBTBase) nbttaglist);
|
||||
@@ -347,7 +357,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,7 +771,7 @@
|
||||
@@ -560,7 +773,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
|
||||
@@ -356,7 +366,7 @@
|
||||
if (this.e == 0) {
|
||||
this.syncPosition();
|
||||
}
|
||||
@@ -570,13 +781,21 @@
|
||||
@@ -570,13 +783,21 @@
|
||||
this.A = this.e;
|
||||
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
|
||||
}
|
||||
@@ -379,7 +389,7 @@
|
||||
double d0 = this.player.locX;
|
||||
double d1 = this.player.locY;
|
||||
double d2 = this.player.locZ;
|
||||
@@ -601,15 +820,33 @@
|
||||
@@ -601,15 +822,33 @@
|
||||
++this.receivedMovePackets;
|
||||
int i = this.receivedMovePackets - this.processedMovePackets;
|
||||
|
||||
@@ -415,7 +425,7 @@
|
||||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9));
|
||||
this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch);
|
||||
return;
|
||||
@@ -655,6 +892,69 @@
|
||||
@@ -655,6 +894,69 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +495,7 @@
|
||||
this.B = d12 >= -0.03125D;
|
||||
this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly;
|
||||
this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.dc() && !worldserver.a(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D));
|
||||
@@ -672,10 +972,76 @@
|
||||
@@ -672,10 +974,76 @@
|
||||
}
|
||||
|
||||
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||
@@ -563,7 +573,7 @@
|
||||
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX : 0.0D;
|
||||
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 0.0D;
|
||||
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ : 0.0D;
|
||||
@@ -687,6 +1053,14 @@
|
||||
@@ -687,6 +1055,14 @@
|
||||
this.teleportAwait = 0;
|
||||
}
|
||||
|
||||
@@ -578,7 +588,7 @@
|
||||
this.A = this.e;
|
||||
this.player.setLocation(d0, d1, d2, f, f1);
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait));
|
||||
@@ -694,6 +1068,7 @@
|
||||
@@ -694,6 +1070,7 @@
|
||||
|
||||
public void a(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());
|
||||
@@ -586,7 +596,7 @@
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
BlockPosition blockposition = packetplayinblockdig.b();
|
||||
|
||||
@@ -703,14 +1078,46 @@
|
||||
@@ -703,14 +1080,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.b(EnumHand.OFF_HAND);
|
||||
|
||||
@@ -635,7 +645,7 @@
|
||||
this.player.a(false);
|
||||
}
|
||||
|
||||
@@ -744,7 +1151,15 @@
|
||||
@@ -744,7 +1153,15 @@
|
||||
if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
|
||||
this.player.playerInteractManager.a(blockposition, packetplayinblockdig.c());
|
||||
} else {
|
||||
@@ -651,7 +661,7 @@
|
||||
}
|
||||
} else {
|
||||
if (packetplayinblockdig.d() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) {
|
||||
@@ -764,10 +1179,12 @@
|
||||
@@ -764,10 +1181,12 @@
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid player action");
|
||||
}
|
||||
@@ -664,7 +674,7 @@
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
EnumHand enumhand = packetplayinuseitem.d();
|
||||
ItemStack itemstack = this.player.b(enumhand);
|
||||
@@ -780,6 +1197,13 @@
|
||||
@@ -780,6 +1199,13 @@
|
||||
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, ChatMessageType.GAME_INFO));
|
||||
} else if (this.teleportPos == null && this.player.d((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) {
|
||||
@@ -678,7 +688,7 @@
|
||||
this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.e(), packetplayinuseitem.f(), packetplayinuseitem.g());
|
||||
}
|
||||
|
||||
@@ -789,13 +1213,52 @@
|
||||
@@ -789,13 +1215,52 @@
|
||||
|
||||
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
|
||||
@@ -732,7 +742,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,13 +1278,18 @@
|
||||
@@ -815,13 +1280,18 @@
|
||||
}
|
||||
|
||||
if (entity != null) {
|
||||
@@ -753,7 +763,7 @@
|
||||
|
||||
public void a(PacketPlayInBoatMove packetplayinboatmove) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.getWorldServer());
|
||||
@@ -834,11 +1302,26 @@
|
||||
@@ -834,11 +1304,26 @@
|
||||
}
|
||||
|
||||
public void a(IChatBaseComponent ichatbasecomponent) {
|
||||
@@ -781,7 +791,7 @@
|
||||
if (this.minecraftServer.H() && this.player.getDisplayName().getString().equals(this.minecraftServer.G())) {
|
||||
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
|
||||
this.minecraftServer.safeShutdown();
|
||||
@@ -864,6 +1347,15 @@
|
||||
@@ -864,6 +1349,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,7 +807,7 @@
|
||||
try {
|
||||
this.networkManager.sendPacket(packet, genericfuturelistener);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -879,17 +1371,37 @@
|
||||
@@ -879,17 +1373,37 @@
|
||||
|
||||
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
|
||||
@@ -837,7 +847,7 @@
|
||||
this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend", new Object[0])).a(EnumChatFormat.RED)));
|
||||
} else {
|
||||
this.player.resetIdleTimer();
|
||||
@@ -899,39 +1411,249 @@
|
||||
@@ -899,39 +1413,249 @@
|
||||
|
||||
for (int i = 0; i < s.length(); ++i) {
|
||||
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
|
||||
@@ -1094,7 +1104,7 @@
|
||||
this.player.resetIdleTimer();
|
||||
IJumpable ijumpable;
|
||||
|
||||
@@ -1003,6 +1725,7 @@
|
||||
@@ -1003,6 +1727,7 @@
|
||||
|
||||
public void a(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
|
||||
@@ -1102,7 +1112,7 @@
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
Entity entity = packetplayinuseentity.a((World) worldserver);
|
||||
|
||||
@@ -1018,20 +1741,73 @@
|
||||
@@ -1018,20 +1743,73 @@
|
||||
if (this.player.h(entity) < d0) {
|
||||
EnumHand enumhand;
|
||||
|
||||
@@ -1177,7 +1187,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1047,7 +1823,8 @@
|
||||
@@ -1047,7 +1825,8 @@
|
||||
case PERFORM_RESPAWN:
|
||||
if (this.player.viewingCredits) {
|
||||
this.player.viewingCredits = false;
|
||||
@@ -1187,7 +1197,7 @@
|
||||
CriterionTriggers.v.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD);
|
||||
} else {
|
||||
if (this.player.getHealth() > 0.0F) {
|
||||
@@ -1070,14 +1847,20 @@
|
||||
@@ -1070,14 +1849,20 @@
|
||||
|
||||
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
|
||||
@@ -1210,7 +1220,7 @@
|
||||
NonNullList nonnulllist = NonNullList.a();
|
||||
|
||||
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
|
||||
@@ -1086,8 +1869,274 @@
|
||||
@@ -1086,8 +1871,274 @@
|
||||
|
||||
this.player.a(this.player.activeContainer, nonnulllist);
|
||||
} else {
|
||||
@@ -1486,7 +1496,7 @@
|
||||
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
|
||||
this.player.f = true;
|
||||
@@ -1130,6 +2179,7 @@
|
||||
@@ -1130,6 +2181,7 @@
|
||||
|
||||
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
|
||||
@@ -1494,7 +1504,7 @@
|
||||
this.player.resetIdleTimer();
|
||||
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
||||
this.player.activeContainer.a(this.player, packetplayinenchantitem.c());
|
||||
@@ -1161,6 +2211,43 @@
|
||||
@@ -1161,6 +2213,43 @@
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||
@@ -1538,7 +1548,7 @@
|
||||
|
||||
if (flag1 && flag2) {
|
||||
if (itemstack.isEmpty()) {
|
||||
@@ -1184,6 +2271,7 @@
|
||||
@@ -1184,6 +2273,7 @@
|
||||
|
||||
public void a(PacketPlayInTransaction packetplayintransaction) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
|
||||
@@ -1546,7 +1556,7 @@
|
||||
Short oshort = (Short) this.k.get(this.player.activeContainer.windowId);
|
||||
|
||||
if (oshort != null && packetplayintransaction.c() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.b() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
|
||||
@@ -1194,6 +2282,7 @@
|
||||
@@ -1194,6 +2284,7 @@
|
||||
|
||||
public void a(PacketPlayInUpdateSign packetplayinupdatesign) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer());
|
||||
@@ -1554,7 +1564,7 @@
|
||||
this.player.resetIdleTimer();
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
BlockPosition blockposition = packetplayinupdatesign.b();
|
||||
@@ -1210,14 +2299,30 @@
|
||||
@@ -1210,14 +2301,30 @@
|
||||
|
||||
if (!tileentitysign.d() || tileentitysign.e() != this.player) {
|
||||
this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign");
|
||||
@@ -1586,7 +1596,7 @@
|
||||
|
||||
tileentitysign.update();
|
||||
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
|
||||
@@ -1226,6 +2331,7 @@
|
||||
@@ -1226,6 +2333,7 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
|
||||
@@ -1594,7 +1604,7 @@
|
||||
if (this.g && packetplayinkeepalive.b() == this.h) {
|
||||
int i = (int) (SystemUtils.b() - this.f);
|
||||
|
||||
@@ -1239,7 +2345,17 @@
|
||||
@@ -1239,7 +2347,17 @@
|
||||
|
||||
public void a(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
|
||||
@@ -1613,7 +1623,7 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInSettings packetplayinsettings) {
|
||||
@@ -1247,5 +2363,47 @@
|
||||
@@ -1247,5 +2365,47 @@
|
||||
this.player.a(packetplayinsettings);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user