mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
Updated ViaLoader usage
This commit is contained in:
parent
0d99386e46
commit
42a733db17
@ -26,7 +26,7 @@ vialegacy_version=2.2.18-SNAPSHOT
|
||||
viaaprilfools_version=2.0.8-SNAPSHOT
|
||||
viabedrock_version=0.0.2-SNAPSHOT
|
||||
minecraftauth_version=2.1.4-SNAPSHOT
|
||||
vialoader_version=2.2.7-SNAPSHOT
|
||||
vialoader_version=2.2.8-SNAPSHOT
|
||||
|
||||
# lenni0451 libs
|
||||
reflect_version=1.2.1
|
||||
|
@ -38,14 +38,14 @@ public class DebugSettings extends SettingGroup {
|
||||
|
||||
// 1.13 -> 1.12.2
|
||||
public final ProtocolSyncBooleanSetting executeInputsInSync = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.postfix"), VersionRange.andOlder(VersionEnum.r1_12_2));
|
||||
public final ProtocolSyncBooleanSetting sneakInstant = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.sneakinstant"), new VersionRange(VersionEnum.r1_12_2, VersionEnum.r1_8));
|
||||
public final ProtocolSyncBooleanSetting sneakInstant = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.sneakinstant"), VersionRange.of(VersionEnum.r1_8, VersionEnum.r1_12_2));
|
||||
|
||||
// 1.12 -> 1.11.1-1.11.2
|
||||
public final ProtocolSyncBooleanSetting sendOpenInventoryPacket = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.inventory"), VersionRange.andOlder(VersionEnum.r1_11_1to1_11_2));
|
||||
|
||||
// 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_4_2), VersionRange.andOlder(VersionEnum.r1_2_4tor1_2_5));
|
||||
public final ProtocolSyncBooleanSetting sendIdlePacket = new ProtocolSyncBooleanSetting(this, Text.translatable("debug.viafabricplus.idle"), VersionRange.of(VersionEnum.r1_4_2, VersionEnum.r1_8).add(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
|
||||
|
@ -36,7 +36,7 @@ public class VisualSettings extends SettingGroup {
|
||||
public final ProtocolSyncBooleanSetting removeNewerFeaturesFromJigsawScreen = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.jigsaw"), VersionRange.andOlder(VersionEnum.r1_15_2));
|
||||
|
||||
// 1.13 -> 1.12.2
|
||||
public final ProtocolSyncBooleanSetting replacePetrifiedOakSlab = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.stoneslab"), new VersionRange(VersionEnum.r1_12_2, VersionEnum.r1_3_1tor1_3_2));
|
||||
public final ProtocolSyncBooleanSetting replacePetrifiedOakSlab = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.stoneslab"), VersionRange.of(VersionEnum.r1_3_1tor1_3_2, VersionEnum.r1_12_2));
|
||||
public final ProtocolSyncBooleanSetting changeFontRendererBehaviour = new ProtocolSyncBooleanSetting(this, Text.translatable("visual.viafabricplus.fontrendererbehaviour"), VersionRange.andOlder(VersionEnum.r1_12_2));
|
||||
|
||||
// 1.9 -> 1.8.x
|
||||
|
@ -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;
|
||||
@ -66,19 +66,13 @@ public class ProtocolSyncBooleanSetting extends AbstractSetting<Integer> {
|
||||
|
||||
public boolean isEnabled() {
|
||||
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 protocolRange.contains(ProtocolHack.getTargetVersion());
|
||||
}
|
||||
|
||||
return getValue() == ENABLED;
|
||||
}
|
||||
|
||||
public VersionRange[] getProtocolRange() {
|
||||
public VersionRange getProtocolRange() {
|
||||
return protocolRange;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import net.raphimc.vialoader.util.VersionEnum;
|
||||
import net.raphimc.vialoader.util.VersionRange;
|
||||
|
||||
public class LegacyServerAddress {
|
||||
private final static VersionRange SRV_RANGE = new VersionRange(VersionEnum.r1_16_4tor1_16_5, VersionEnum.r1_3_1tor1_3_2);
|
||||
private final static VersionRange SRV_RANGE = VersionRange.of(VersionEnum.r1_3_1tor1_3_2, VersionEnum.r1_16_4tor1_16_5);
|
||||
|
||||
public static ServerAddress parse(VersionEnum version, String address) {
|
||||
if (version == null) version = ProtocolHack.getTargetVersion();
|
||||
|
@ -42,7 +42,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
public class BedrockInformation extends AbstractInformationGroup {
|
||||
|
||||
public BedrockInformation() {
|
||||
super(VersionRange.singleton(VersionEnum.bedrockLatest));
|
||||
super(VersionRange.single(VersionEnum.bedrockLatest));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@ import java.util.List;
|
||||
public class C0_30CPEInformation extends AbstractInformationGroup {
|
||||
|
||||
public C0_30CPEInformation() {
|
||||
super(VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
super(VersionRange.single(VersionEnum.c0_30cpe));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ public class ItemReleaseVersionMappings {
|
||||
ChangeProtocolVersionCallback.EVENT.register(protocolVersion -> INSTANCE.update(protocolVersion));
|
||||
}
|
||||
|
||||
private final Map<Item, VersionRange[]> itemMap = new HashMap<>();
|
||||
private final Map<Item, VersionRange> itemMap = new HashMap<>();
|
||||
private final List<Item> currentMap = new ArrayList<>();
|
||||
|
||||
public void update(final VersionEnum versionEnum) {
|
||||
@ -49,7 +49,7 @@ public class ItemReleaseVersionMappings {
|
||||
public boolean contains(final Item item, final VersionEnum versionEnum) {
|
||||
if (!itemMap.containsKey(item)) return true;
|
||||
|
||||
return Arrays.stream(itemMap.get(item)).anyMatch(versionRange -> versionRange.contains(versionEnum));
|
||||
return itemMap.get(item).contains(versionEnum);
|
||||
}
|
||||
|
||||
public void load() {
|
||||
@ -730,7 +730,7 @@ public class ItemReleaseVersionMappings {
|
||||
register(Items.ZOMBIE_VILLAGER_SPAWN_EGG, VersionRange.andNewer(VersionEnum.r1_11));
|
||||
|
||||
register(Items.BONE_BLOCK, VersionRange.andNewer(VersionEnum.r1_10));
|
||||
register(Items.MAGMA_BLOCK, VersionRange.andNewer(VersionEnum.r1_10), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.MAGMA_BLOCK, VersionRange.andNewer(VersionEnum.r1_10).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.NETHER_WART_BLOCK, VersionRange.andNewer(VersionEnum.r1_10));
|
||||
register(Items.POLAR_BEAR_SPAWN_EGG, VersionRange.andNewer(VersionEnum.r1_10));
|
||||
register(Items.RED_NETHER_BRICKS, VersionRange.andNewer(VersionEnum.r1_10));
|
||||
@ -970,7 +970,7 @@ public class ItemReleaseVersionMappings {
|
||||
register(Items.NETHER_QUARTZ_ORE, VersionRange.andNewer(VersionEnum.r1_5tor1_5_1));
|
||||
register(Items.QUARTZ, VersionRange.andNewer(VersionEnum.r1_5tor1_5_1));
|
||||
register(Items.QUARTZ_BLOCK, VersionRange.andNewer(VersionEnum.r1_5tor1_5_1));
|
||||
register(Items.QUARTZ_PILLAR, VersionRange.andNewer(VersionEnum.r1_5tor1_5_1), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.QUARTZ_PILLAR, VersionRange.andNewer(VersionEnum.r1_5tor1_5_1).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.QUARTZ_SLAB, VersionRange.andNewer(VersionEnum.r1_5tor1_5_1));
|
||||
register(Items.QUARTZ_STAIRS, VersionRange.andNewer(VersionEnum.r1_5tor1_5_1));
|
||||
register(Items.REDSTONE_BLOCK, VersionRange.andNewer(VersionEnum.r1_5tor1_5_1));
|
||||
@ -1015,7 +1015,7 @@ public class ItemReleaseVersionMappings {
|
||||
register(Items.JUNGLE_PLANKS, VersionRange.andNewer(VersionEnum.r1_3_1tor1_3_2));
|
||||
register(Items.JUNGLE_SLAB, VersionRange.andNewer(VersionEnum.r1_3_1tor1_3_2));
|
||||
register(Items.JUNGLE_STAIRS, VersionRange.andNewer(VersionEnum.r1_3_1tor1_3_2));
|
||||
register(Items.SANDSTONE_STAIRS, VersionRange.andNewer(VersionEnum.r1_3_1tor1_3_2), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.SANDSTONE_STAIRS, VersionRange.andNewer(VersionEnum.r1_3_1tor1_3_2).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.SPRUCE_PLANKS, VersionRange.andNewer(VersionEnum.r1_3_1tor1_3_2));
|
||||
register(Items.SPRUCE_SLAB, VersionRange.andNewer(VersionEnum.r1_3_1tor1_3_2));
|
||||
register(Items.SPRUCE_STAIRS, VersionRange.andNewer(VersionEnum.r1_3_1tor1_3_2));
|
||||
@ -1118,7 +1118,7 @@ public class ItemReleaseVersionMappings {
|
||||
register(Items.ROTTEN_FLESH, VersionRange.andNewer(VersionEnum.b1_8tob1_8_1));
|
||||
register(Items.STONE_BRICK_SLAB, VersionRange.andNewer(VersionEnum.b1_8tob1_8_1));
|
||||
register(Items.STONE_BRICK_STAIRS, VersionRange.andNewer(VersionEnum.b1_8tob1_8_1));
|
||||
register(Items.STONE_BRICKS, VersionRange.andNewer(VersionEnum.b1_8tob1_8_1), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.STONE_BRICKS, VersionRange.andNewer(VersionEnum.b1_8tob1_8_1).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.VINE, VersionRange.andNewer(VersionEnum.b1_8tob1_8_1));
|
||||
|
||||
register(Items.PISTON, VersionRange.andNewer(VersionEnum.b1_7tob1_7_3));
|
||||
@ -1140,7 +1140,7 @@ public class ItemReleaseVersionMappings {
|
||||
register(Items.COOKIE, VersionRange.andNewer(VersionEnum.b1_4tob1_4_1));
|
||||
register(Items.TRAPPED_CHEST, VersionRange.andNewer(VersionEnum.b1_4tob1_4_1));
|
||||
|
||||
register(Items.COBBLESTONE_SLAB, VersionRange.andNewer(VersionEnum.b1_3tob1_3_1), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.COBBLESTONE_SLAB, VersionRange.andNewer(VersionEnum.b1_3tob1_3_1).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.OAK_SLAB, VersionRange.andNewer(VersionEnum.b1_3tob1_3_1));
|
||||
register(Items.RED_BED, VersionRange.andNewer(VersionEnum.b1_3tob1_3_1));
|
||||
register(Items.REPEATER, VersionRange.andNewer(VersionEnum.b1_3tob1_3_1));
|
||||
@ -1229,8 +1229,8 @@ public class ItemReleaseVersionMappings {
|
||||
register(Items.SNOWBALL, VersionRange.andNewer(VersionEnum.a1_0_15));
|
||||
|
||||
// a1.0.4 (doesn't have multiplayer, so we assign it to the next multiplayer version)
|
||||
register(Items.ICE, VersionRange.andNewer(VersionEnum.a1_0_15), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.SNOW, VersionRange.andNewer(VersionEnum.a1_0_15), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.ICE, VersionRange.andNewer(VersionEnum.a1_0_15).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.SNOW, VersionRange.andNewer(VersionEnum.a1_0_15).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
|
||||
// a1.0.1 (doesn't have multiplayer, so we assign it to the next multiplayer version)
|
||||
register(Items.IRON_DOOR, VersionRange.andNewer(VersionEnum.a1_0_15));
|
||||
@ -1382,19 +1382,19 @@ public class ItemReleaseVersionMappings {
|
||||
register(Items.MOSSY_COBBLESTONE, VersionRange.andNewer(VersionEnum.c0_28toc0_30));
|
||||
|
||||
register(Items.BLACK_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.BLUE_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.BROWN_MUSHROOM, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.BROWN_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.CYAN_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.BLUE_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.BROWN_MUSHROOM, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.BROWN_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.CYAN_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.DANDELION, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.GRAY_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.GREEN_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.GREEN_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.LIGHT_BLUE_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.LIGHT_GRAY_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.LIME_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.MAGENTA_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.ORANGE_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.PINK_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27), VersionRange.singleton(VersionEnum.c0_30cpe));
|
||||
register(Items.PINK_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27).add(VersionRange.single(VersionEnum.c0_30cpe)));
|
||||
register(Items.POPPY, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.PURPLE_WOOL, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
register(Items.RED_MUSHROOM, VersionRange.andNewer(VersionEnum.c0_0_20ac0_27));
|
||||
@ -1406,15 +1406,11 @@ public class ItemReleaseVersionMappings {
|
||||
register(Items.SPONGE, VersionRange.andNewer(VersionEnum.c0_0_19a_06));
|
||||
}
|
||||
|
||||
private void register(final Item item, final VersionRange range) {
|
||||
itemMap.put(item, new VersionRange[]{range});
|
||||
private void register(final Item item, final VersionRange protocolRange) {
|
||||
itemMap.put(item, protocolRange);
|
||||
}
|
||||
|
||||
private void register(final Item item, final VersionRange... ranges) {
|
||||
itemMap.put(item, ranges);
|
||||
}
|
||||
|
||||
public Map<Item, VersionRange[]> getItemMap() {
|
||||
public Map<Item, VersionRange> getItemMap() {
|
||||
return itemMap;
|
||||
}
|
||||
|
||||
|
@ -55,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, Arrays.toString(this.value.getProtocolRange()).replace("[", "(").replace("]", ")"), length + 2, entryHeight / 2 - textRenderer.fontHeight / 2, -1);
|
||||
context.drawTextWithShadow(textRenderer, this.value.getProtocolRange().toString(), 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