3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Add option to fix delayed shield blocking (#2415)

Dieser Commit ist enthalten in:
R0bbyYT 2021-04-01 20:03:13 +02:00 committet von GitHub
Ursprung 1d311284fd
Commit 956492bca6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
4 geänderte Dateien mit 23 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -76,6 +76,13 @@ public interface ViaVersionConfig {
*/ */
boolean isShieldBlocking(); boolean isShieldBlocking();
/**
* Whether the player can block with the shield without a delay.
*
* @return {@code true} if non delayed shield blocking is enabled.
*/
boolean isNoDelayShieldBlocking();
/** /**
* Get if armor stand positions are fixed so holograms show up at the correct height in 1.9 & 1.10 * Get if armor stand positions are fixed so holograms show up at the correct height in 1.9 & 1.10
* *

Datei anzeigen

@ -32,6 +32,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
private boolean useNewDeathmessages; private boolean useNewDeathmessages;
private boolean suppressMetadataErrors; private boolean suppressMetadataErrors;
private boolean shieldBlocking; private boolean shieldBlocking;
private boolean noDelayShieldBlocking;
private boolean hologramPatch; private boolean hologramPatch;
private boolean pistonAnimationPatch; private boolean pistonAnimationPatch;
private boolean bossbarPatch; private boolean bossbarPatch;
@ -91,6 +92,7 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
useNewDeathmessages = getBoolean("use-new-deathmessages", true); useNewDeathmessages = getBoolean("use-new-deathmessages", true);
suppressMetadataErrors = getBoolean("suppress-metadata-errors", false); suppressMetadataErrors = getBoolean("suppress-metadata-errors", false);
shieldBlocking = getBoolean("shield-blocking", true); shieldBlocking = getBoolean("shield-blocking", true);
noDelayShieldBlocking = getBoolean("no-delay-shield-blocking", false);
hologramPatch = getBoolean("hologram-patch", false); hologramPatch = getBoolean("hologram-patch", false);
pistonAnimationPatch = getBoolean("piston-animation-patch", false); pistonAnimationPatch = getBoolean("piston-animation-patch", false);
bossbarPatch = getBoolean("bossbar-patch", true); bossbarPatch = getBoolean("bossbar-patch", true);
@ -170,6 +172,11 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf
return shieldBlocking; return shieldBlocking;
} }
@Override
public boolean isNoDelayShieldBlocking() {
return noDelayShieldBlocking;
}
@Override @Override
public boolean isHologramPatch() { public boolean isHologramPatch() {
return hologramPatch; return hologramPatch;

Datei anzeigen

@ -303,6 +303,12 @@ public class WorldPackets {
Item shield = new Item(442, (byte) 1, (short) 0, null); Item shield = new Item(442, (byte) 1, (short) 0, null);
tracker.setSecondHand(shield); tracker.setSecondHand(shield);
} }
}
// Uses left or right hand to start blocking depending on the no delay setting
boolean noDelayBlocking = Via.getConfig().isNoDelayShieldBlocking();
if (noDelayBlocking && hand == 1 || !noDelayBlocking && hand == 0) {
wrapper.cancel(); wrapper.cancel();
} }
} else { } else {

Datei anzeigen

@ -167,6 +167,9 @@ auto-team: true
suppress-metadata-errors: false suppress-metadata-errors: false
# When enabled 1.9+ will be able to block by using shields # When enabled 1.9+ will be able to block by using shields
shield-blocking: true shield-blocking: true
# If this setting is active, the main hand is used instead of the off hand to trigger the blocking of the player.
# With the main hand the blocking starts way faster.
no-delay-shield-blocking: false
# Enable player tick simulation, this fixes eating, drinking, nether portals. # Enable player tick simulation, this fixes eating, drinking, nether portals.
simulate-pt: true simulate-pt: true
# Should we use nms player to simulate packets, (may fix anti-cheat issues) # Should we use nms player to simulate packets, (may fix anti-cheat issues)