mirror of
https://github.com/ViaVersion/ViaRewind-Legacy-Support.git
synced 2025-01-24 21:21:50 +01:00
Fix carpets on 1.14+ servers (#47)
This commit is contained in:
parent
61d07dec61
commit
3f4830d7e3
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
*.iml
|
||||
.idea/
|
||||
build/
|
||||
target/
|
@ -36,6 +36,8 @@ public class BukkitPlugin extends JavaPlugin {
|
||||
Bukkit.getPluginManager().registerEvents(new BrewingListener(), BukkitPlugin.this);
|
||||
if (serverProtocol > 84 && config.getBoolean("lily-pad-fix"))
|
||||
BoundingBoxFixer.fixLilyPad();
|
||||
if (serverProtocol > 404 && config.getBoolean("carpet-fix")) // 1.14+ only
|
||||
BoundingBoxFixer.fixCarpet();
|
||||
if (serverProtocol > 48 && config.getBoolean("ladder-fix"))
|
||||
BoundingBoxFixer.fixLadder();
|
||||
if (serverProtocol > 47 && config.getBoolean("sound-fix"))
|
||||
|
@ -26,6 +26,22 @@ public class BoundingBoxFixer {
|
||||
}
|
||||
}
|
||||
|
||||
public static void fixCarpet() {
|
||||
try {
|
||||
int serverProtocol = Via.getAPI().getServerVersion().lowestSupportedVersion();
|
||||
Class<?> blockCarpetClass;
|
||||
if (serverProtocol <= 754) { // 1.16.5
|
||||
blockCarpetClass = NMSReflection.getNMSBlock("BlockCarpet");
|
||||
} else {
|
||||
blockCarpetClass = NMSReflection.getNMSBlock("CarpetBlock");
|
||||
}
|
||||
Field boundingBoxField = ReflectionAPI.getFieldAccessible(blockCarpetClass, "a");
|
||||
setBoundingBox(boundingBoxField.get(0), 0.0D, -0.0000001D, 0.0D, 1.0D, 0.0000001D, 1.0D);
|
||||
} catch (Exception ex) {
|
||||
BukkitPlugin.getInstance().getLogger().log(Level.SEVERE, "Could not fix carpet bounding box.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void fixLadder() {
|
||||
try {
|
||||
Class<?> blockLadderClass = NMSReflection.getNMSBlock("BlockLadder");
|
||||
|
@ -4,6 +4,8 @@ brewing-stand-gui-fix: true
|
||||
enchanting-gui-fix: true
|
||||
#Fix the lily pad bounding box to prevent clients lower than 1.9 from glitching
|
||||
lily-pad-fix: true
|
||||
#Fix the carpet bounding box to prevent 1.7 clients from glitching on 1.14+ servers
|
||||
carpet-fix: true
|
||||
#Fix the ladder bounding box to prevent clients lower than 1.9 from glitching
|
||||
ladder-fix: true
|
||||
#If set to true, this plugin will play sounds for 1.8 and lower that got clientside on 1.9 and higher
|
||||
|
Loading…
Reference in New Issue
Block a user