mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-22 11:56:21 +01:00
This commit is contained in:
parent
72204af164
commit
989c876920
@ -45,7 +45,7 @@ public class DebugSettings extends SettingGroup {
|
||||
|
||||
// 1.9 -> 1.8.x
|
||||
public final ProtocolSyncBooleanSetting removeCooldowns = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.cooldown"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
public final ProtocolSyncBooleanSetting sendIdlePacket = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.idle"), new VersionRange(VersionEnum.r1_8, VersionEnum.r1_3_1tor1_3_2));
|
||||
public final ProtocolSyncBooleanSetting sendIdlePacket = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.idle"), new VersionRange(VersionEnum.r1_8, VersionEnum.r1_4_2), VersionRange.andOlder(VersionEnum.r1_2_4tor1_2_5));
|
||||
public final ProtocolSyncBooleanSetting replaceAttributeModifiers = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.attribute"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||
|
||||
// 1.8.x -> 1.7.6
|
||||
|
@ -30,9 +30,9 @@ public class ProtocolSyncBooleanSetting extends AbstractSetting<Integer> {
|
||||
public final static int AUTO = 2;
|
||||
public final static int ENABLED = 0;
|
||||
|
||||
private final VersionRange protocolRange;
|
||||
private final VersionRange[] protocolRange;
|
||||
|
||||
public ProtocolSyncBooleanSetting(SettingGroup parent, MutableText name, VersionRange protocolRange) {
|
||||
public ProtocolSyncBooleanSetting(SettingGroup parent, MutableText name, VersionRange... protocolRange) {
|
||||
super(parent, name, 2);
|
||||
|
||||
this.protocolRange = protocolRange;
|
||||
@ -65,12 +65,20 @@ public class ProtocolSyncBooleanSetting extends AbstractSetting<Integer> {
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
if (isAuto()) return this.getProtocolRange().contains(ProtocolHack.getTargetVersion());
|
||||
if (isAuto()) {
|
||||
if (getProtocolRange().length == 1) {
|
||||
return getProtocolRange()[0].contains(ProtocolHack.getTargetVersion());
|
||||
} else {
|
||||
for (VersionRange versionRange : getProtocolRange()) {
|
||||
if (versionRange.contains(ProtocolHack.getTargetVersion())) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getValue() == ENABLED;
|
||||
}
|
||||
|
||||
public VersionRange getProtocolRange() {
|
||||
public VersionRange[] getProtocolRange() {
|
||||
return protocolRange;
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ProtocolSyncBooleanSettingRenderer extends MappedSlotEntry {
|
||||
private final ProtocolSyncBooleanSetting value;
|
||||
@ -54,7 +55,7 @@ public class ProtocolSyncBooleanSettingRenderer extends MappedSlotEntry {
|
||||
|
||||
final int length = context.drawTextWithShadow(textRenderer, this.value.getName().formatted(Formatting.GRAY), 3, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
|
||||
context.drawTextWithShadow(textRenderer, "(" + this.value.getProtocolRange().toString() + ")", length + 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawTextWithShadow(textRenderer, Arrays.toString(this.value.getProtocolRange()).replace("[", "(").replace("]", ")"), length + 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawTextWithShadow(textRenderer, text, entryWidth - textRenderer.getWidth(text) - 3 - 3, entryHeight / 2 - textRenderer.fontHeight / 2, color.getRGB());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user