New config option for disabling piston animation for 1.11 clients #570

This commit is contained in:
Myles 2016-12-15 15:32:54 +00:00
parent 81d4deaea7
commit a35408d14f
6 changed files with 49 additions and 0 deletions

View File

@ -52,6 +52,11 @@ public class BukkitConfigAPI extends Config implements ViaVersionConfig {
return getBoolean("hologram-patch", false);
}
@Override
public boolean isPistonAnimationPatch() {
return getBoolean("piston-animation-patch", false);
}
@Override
public boolean isBossbarPatch() {
return getBoolean("bossbar-patch", true);

View File

@ -86,6 +86,11 @@ public class BungeeConfigAPI extends Config implements ViaVersionConfig {
return getBoolean("hologram-patch", false);
}
@Override
public boolean isPistonAnimationPatch() {
return getBoolean("piston-animation-patch", false);
}
@Override
public boolean isBossbarPatch() {
return getBoolean("bossbar-patch", true);

View File

@ -53,6 +53,13 @@ public interface ViaVersionConfig {
*/
boolean isHologramPatch();
/**
* Get if the 1.11 piston animation patch is enabled
*
* @return true if the piston patch is enabled.
*/
boolean isPistonAnimationPatch();
/**
* Get if boss bars are fixed for 1.9 & 1.10 clients
*

View File

@ -219,6 +219,30 @@ public class Protocol1_11To1_10 extends Protocol {
}
});
// Block action packet
registerOutgoing(State.PLAY, 0x0A, 0x0A, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION); // 0 - Position
map(Type.UNSIGNED_BYTE); // 1 - Action ID
map(Type.UNSIGNED_BYTE); // 2 - Action Param
map(Type.VAR_INT); // 3 - Block Type
// Cheap hack to ensure it's always right block
handler(new PacketHandler() {
@Override
public void handle(final PacketWrapper actionWrapper) throws Exception {
if (Via.getConfig().isPistonAnimationPatch()) {
int id = actionWrapper.get(Type.VAR_INT, 0);
if (id == 33 || id == 29) {
actionWrapper.cancel();
}
}
}
});
}
});
/*
INCOMING PACKETS
*/

View File

@ -79,6 +79,9 @@ tracking-max-kick-msg: "You are sending too many packets, :("
hologram-patch: false
# This is the offset, should work as default when enabled.
hologram-y: -0.96
# Should we disable piston animation for 1.11/1.11.1 clients?
# In some cases when firing lots of pistons it crashes them.
piston-animation-patch: false
#
#----------------------------------------------------------#
# 1.9 & 1.10 CLIENTS ON 1.8 SERVERS OPTIONS #

View File

@ -59,6 +59,11 @@ public class SpongeConfigAPI extends Config implements ViaVersionConfig {
return getBoolean("hologram-patch", false);
}
@Override
public boolean isPistonAnimationPatch() {
return getBoolean("piston-animation-patch", false);
}
@Override
public boolean isBossbarPatch() {
return getBoolean("bossbar-patch", true);