3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +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();
/**
* 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
*

Datei anzeigen

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

Datei anzeigen

@ -303,6 +303,12 @@ public class WorldPackets {
Item shield = new Item(442, (byte) 1, (short) 0, null);
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();
}
} else {

Datei anzeigen

@ -167,6 +167,9 @@ auto-team: true
suppress-metadata-errors: false
# When enabled 1.9+ will be able to block by using shields
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.
simulate-pt: true
# Should we use nms player to simulate packets, (may fix anti-cheat issues)