diff --git a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/model/VirtualHologramEntity.java b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/model/VirtualHologramEntity.java index 36013bd6e..7e57f3a02 100644 --- a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/model/VirtualHologramEntity.java +++ b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/model/VirtualHologramEntity.java @@ -1,3 +1,21 @@ +/* + * This file is part of ViaRewind - https://github.com/ViaVersion/ViaRewind + * Copyright (C) 2016-2023 ViaVersion and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.model; import com.viaversion.viarewind.protocol.protocol1_7_2_5to1_7_6_10.ClientboundPackets1_7_2_5; @@ -6,8 +24,6 @@ import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.types.Types1_7_6_10; import com.viaversion.viarewind.protocol.protocol1_7_6_10to1_8.types.metadata.MetaType1_7_6_10; import com.viaversion.viarewind.utils.PacketUtil; -import com.viaversion.viarewind.utils.math.AABB; -import com.viaversion.viarewind.utils.math.Vector3d; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; @@ -42,47 +58,53 @@ public VirtualHologramEntity(final UserConnection user, final MetadataRewriter m } public void updateReplacementPosition(double x, double y, double z) { - if (x != this.locX || y != this.locY || z != this.locZ) { - this.locX = x; - this.locY = y; - this.locZ = z; - - updateLocation(false); + if (x == this.locX && y == this.locY && z == this.locZ) { + return; } + + this.locX = x; + this.locY = y; + this.locZ = z; + updateLocation(false); } public void handleOriginalMovementPacket(double x, double y, double z) { - if (x == 0.0 && y == 0.0 && z == 0.0) return; + if (x == 0.0 && y == 0.0 && z == 0.0) { + return; + } + this.locX += x; this.locY += y; this.locZ += z; - updateLocation(false); } public void setYawPitch(float yaw, float pitch) { - if (this.yaw != yaw && this.pitch != pitch || this.headYaw != yaw) { - this.yaw = yaw; - this.headYaw = yaw; - this.pitch = pitch; - - updateLocation(false); + if (this.yaw == yaw || this.headYaw == yaw || this.pitch == pitch) { + return; } + + this.yaw = yaw; + this.headYaw = yaw; + this.pitch = pitch; + updateLocation(false); } public void setHeadYaw(float yaw) { - if (this.headYaw != yaw) { - this.headYaw = yaw; - - updateLocation(false); + if (this.headYaw == yaw) { + return; } + + this.headYaw = yaw; + updateLocation(false); } - public void updateMetadata(List metadataList) { + public void updateMetadata(final List metadataList) { for (Metadata metadata : metadataList) { metadataTracker.removeIf(m -> m.id() == metadata.id()); metadataTracker.add(metadata); } + updateState(); } diff --git a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets/PlayerPackets.java b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets/PlayerPackets.java index f7e383bcf..aa5f5e6bc 100644 --- a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets/PlayerPackets.java +++ b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/packets/PlayerPackets.java @@ -168,7 +168,7 @@ public void register() { if ((flags & 0x02) == 0x02) y += playerSession.getPosY(); playerSession.receivedPosY = y; - wrapper.set(Type.DOUBLE, 1, y + 1.92F); + wrapper.set(Type.DOUBLE, 1, y + 1.62F); if ((flags & 0x04) == 0x04) wrapper.set(Type.DOUBLE, 2, z + playerSession.getPosZ()); diff --git a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/storage/EntityTracker1_7_6_10.java b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/storage/EntityTracker1_7_6_10.java index 41d9e14f6..d2bc20e22 100644 --- a/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/storage/EntityTracker1_7_6_10.java +++ b/common/src/main/java/com/viaversion/viarewind/protocol/protocol1_7_6_10to1_8/storage/EntityTracker1_7_6_10.java @@ -150,11 +150,11 @@ protected void attachEntity(final int target) { } } - public boolean setSpectating(int spectating) { + public void setSpectating(int spectating) { if (spectating != this.getPlayerId() && getPassenger(spectating) != -1) { startSneaking(); setSpectating(this.getPlayerId()); - return false; + return; } if (this.spectatingPlayerId != spectating && this.spectatingPlayerId != this.getPlayerId()) { attachEntity(-1); @@ -163,11 +163,6 @@ public boolean setSpectating(int spectating) { if (spectating != this.getPlayerId()) { attachEntity(this.spectatingPlayerId); } - return true; - } - - public Map getVehicleMap() { - return vehicleMap; } public Map getVirtualHologramMap() {