Skip to content

Commit 8787df9

Browse files
committed
Disable VV hitbox margin on <= 1.7 servers
1 parent 80ae165 commit 8787df9

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
3+
* Copyright (C) 2021-2025 RK_01/RaphiMC and contributors
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
package net.raphimc.viaproxy.injection.mixins;
19+
20+
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
21+
import com.viaversion.viaversion.protocols.v1_21_9to1_21_11.rewriter.BlockItemPacketRewriter1_21_11;
22+
import org.spongepowered.asm.mixin.Mixin;
23+
import org.spongepowered.asm.mixin.injection.At;
24+
import org.spongepowered.asm.mixin.injection.Redirect;
25+
26+
@Mixin(BlockItemPacketRewriter1_21_11.class)
27+
public abstract class MixinBlockItemPacketRewriter1_21_11 {
28+
29+
// The vanilla client uses the game mode from the player list entry to determine the game mode. ViaLegacy uses fake player list entries and thus the check won't work as intended.
30+
@Redirect(method = "appendItemDataFixComponents", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;olderThanOrEqualTo(Lcom/viaversion/viaversion/api/protocol/version/ProtocolVersion;)Z"))
31+
private boolean disableOnPre1_8Servers(ProtocolVersion instance, ProtocolVersion other) {
32+
return instance.equals(other);
33+
}
34+
35+
}

0 commit comments

Comments
 (0)