mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-12-27 10:57:44 +01:00
Add option to fix delayed shield blocking (#2415)
This commit is contained in:
parent
1d311284fd
commit
956492bca6
@ -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
|
||||
*
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user