3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-04 23:30:24 +01:00

fix metadata type mismatch & add anti-flicker

Dieser Commit ist enthalten in:
Lennart ten Wolde 2016-03-10 16:17:31 +01:00
Ursprung fd42c7eba6
Commit 4a804bae7c
3 geänderte Dateien mit 26 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -235,6 +235,10 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
return getConfig().getBoolean("bossbar-patch", true); return getConfig().getBoolean("bossbar-patch", true);
} }
public boolean isBossbarAntiflicker() {
return getConfig().getBoolean("bossbar-anti-flicker", false);
}
public double getHologramYOffset() { public double getHologramYOffset() {
return getConfig().getDouble("hologram-y", -1D); return getConfig().getDouble("hologram-y", -1D);
} }

Datei anzeigen

@ -846,10 +846,28 @@ public class OutgoingTransformer {
} }
// Fix: wither (crash fix) // Fix: wither (crash fix)
if(type == EntityType.WITHER) { if(type == EntityType.WITHER) {
// Remove custom value if already exist
Iterator<Entry> it = list.iterator();
while(it.hasNext()) {
Entry e = it.next();
if(e.getOldID() == 10) {
it.remove();
}
}
list.add(new Entry(MetaIndex.WITHER_PROPERTIES, (byte) 0, 10)); list.add(new Entry(MetaIndex.WITHER_PROPERTIES, (byte) 0, 10));
} }
// Fix: Dragon (crash fix) // Fix: Dragon (crash fix)
if(type == EntityType.ENDER_DRAGON) { if(type == EntityType.ENDER_DRAGON) {
// Remove custom value if already exist
Iterator<Entry> it = list.iterator();
while(it.hasNext()) {
Entry e = it.next();
if(e.getOldID() == 11) {
it.remove();
}
}
list.add(new Entry(MetaIndex.ENDERDRAGON_PHASE, (byte) 0, 11)); list.add(new Entry(MetaIndex.ENDERDRAGON_PHASE, (byte) 0, 11));
} }
MetadataRewriter.writeMetadata1_9(type, list, output); MetadataRewriter.writeMetadata1_9(type, list, output);
@ -911,7 +929,7 @@ public class OutgoingTransformer {
} else { } else {
bar.setTitle(title); bar.setTitle(title);
} }
} else if (entry.getOldID() == 6) { } else if (entry.getOldID() == 6 && !plugin.isBossbarAntiflicker()) { // If anti flicker is enabled, don't update health
BossBar bar = bossBarMap.get(entityID); BossBar bar = bossBarMap.get(entityID);
// Make health range between 0 and 1 // Make health range between 0 and 1
float maxHealth = type == EntityType.ENDER_DRAGON ? 200.0f : 300.0f; float maxHealth = type == EntityType.ENDER_DRAGON ? 200.0f : 300.0f;

Datei anzeigen

@ -18,3 +18,5 @@ hologram-y: -1
simulate-pt: true simulate-pt: true
# Should we patch boss bars so they work? (Default: true, disable if you're having issues) # Should we patch boss bars so they work? (Default: true, disable if you're having issues)
bossbar-patch: true bossbar-patch: true
# If your boss bar flickers on 1.9, set this to 'true'. It will keep all boss bars on 100% (not recommended)
bossbar-anti-flicker: false