mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-21 11:46:49 +01:00
Code cleanup
This commit is contained in:
parent
8400106095
commit
94471bf961
@ -93,4 +93,5 @@ public class ViaFabricPlus {
|
|||||||
public SaveManager getSaveManager() {
|
public SaveManager getSaveManager() {
|
||||||
return saveManager;
|
return saveManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
|||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
import net.minecraft.network.ClientConnection;
|
import net.minecraft.network.ClientConnection;
|
||||||
|
import net.raphimc.viabedrock.protocol.data.ProtocolConstants;
|
||||||
import net.raphimc.vialoader.ViaLoader;
|
import net.raphimc.vialoader.ViaLoader;
|
||||||
import net.raphimc.vialoader.impl.platform.ViaAprilFoolsPlatformImpl;
|
import net.raphimc.vialoader.impl.platform.ViaAprilFoolsPlatformImpl;
|
||||||
import net.raphimc.vialoader.impl.platform.ViaBackwardsPlatformImpl;
|
import net.raphimc.vialoader.impl.platform.ViaBackwardsPlatformImpl;
|
||||||
@ -101,7 +102,7 @@ public class ProtocolHack {
|
|||||||
channel.attr(ProtocolHack.TARGET_VERSION_ATTRIBUTE_KEY).set(serverVersion);
|
channel.attr(ProtocolHack.TARGET_VERSION_ATTRIBUTE_KEY).set(serverVersion);
|
||||||
|
|
||||||
if (VersionEnum.bedrockLatest.equals(serverVersion)) {
|
if (VersionEnum.bedrockLatest.equals(serverVersion)) {
|
||||||
channel.config().setOption(RakChannelOption.RAK_PROTOCOL_VERSION, 11);
|
channel.config().setOption(RakChannelOption.RAK_PROTOCOL_VERSION, ProtocolConstants.BEDROCK_RAKNET_PROTOCOL_VERSION);
|
||||||
channel.config().setOption(RakChannelOption.RAK_CONNECT_TIMEOUT, 4_000L);
|
channel.config().setOption(RakChannelOption.RAK_CONNECT_TIMEOUT, 4_000L);
|
||||||
channel.config().setOption(RakChannelOption.RAK_SESSION_TIMEOUT, 30_000L);
|
channel.config().setOption(RakChannelOption.RAK_SESSION_TIMEOUT, 30_000L);
|
||||||
channel.config().setOption(RakChannelOption.RAK_GUID, ThreadLocalRandom.current().nextLong());
|
channel.config().setOption(RakChannelOption.RAK_GUID, ThreadLocalRandom.current().nextLong());
|
||||||
|
@ -66,7 +66,7 @@ public class ViaFabricPlusVLLoader extends VLLoader {
|
|||||||
providers.use(GameProfileFetcher.class, new ViaFabricPlusGameProfileFetcher());
|
providers.use(GameProfileFetcher.class, new ViaFabricPlusGameProfileFetcher());
|
||||||
providers.use(ClassicMPPassProvider.class, new ViaFabricPlusClassicMPPassProvider());
|
providers.use(ClassicMPPassProvider.class, new ViaFabricPlusClassicMPPassProvider());
|
||||||
|
|
||||||
providers.use(AlphaInventoryProvider.class, new ViaFabricPlusAlphaInventoryProvider(providers.get(TrackingAlphaInventoryProvider.class)));
|
providers.use(AlphaInventoryProvider.class, new ViaFabricPlusAlphaInventoryProvider(providers.get(AlphaInventoryProvider.class)));
|
||||||
|
|
||||||
providers.use(NettyPipelineProvider.class, new ViaFabricPlusNettyPipelineProvider());
|
providers.use(NettyPipelineProvider.class, new ViaFabricPlusNettyPipelineProvider());
|
||||||
providers.use(BlobCacheProvider.class, new ViaFabricPlusBlobCacheProvider());
|
providers.use(BlobCacheProvider.class, new ViaFabricPlusBlobCacheProvider());
|
||||||
|
@ -27,8 +27,6 @@ import net.minecraft.client.MinecraftClient;
|
|||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.AlphaInventoryProvider;
|
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.AlphaInventoryProvider;
|
||||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.providers.TrackingAlphaInventoryProvider;
|
|
||||||
import net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.storage.AlphaInventoryTracker;
|
|
||||||
import net.raphimc.vialoader.util.VersionEnum;
|
import net.raphimc.vialoader.util.VersionEnum;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -36,15 +34,15 @@ import java.util.List;
|
|||||||
import static net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.copyItems;
|
import static net.raphimc.vialegacy.protocols.alpha.protocolb1_0_1_1_1toa1_2_3_5_1_2_6.Protocolb1_0_1_1_1toa1_2_3_5_1_2_6.copyItems;
|
||||||
|
|
||||||
public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider {
|
public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider {
|
||||||
private final TrackingAlphaInventoryProvider trackingAlphaInventoryProvider;
|
private final AlphaInventoryProvider alphaInventoryProvider;
|
||||||
|
|
||||||
public ViaFabricPlusAlphaInventoryProvider(final TrackingAlphaInventoryProvider trackingAlphaInventoryProvider) {
|
public ViaFabricPlusAlphaInventoryProvider(final AlphaInventoryProvider alphaInventoryProvider) {
|
||||||
this.trackingAlphaInventoryProvider = trackingAlphaInventoryProvider;
|
this.alphaInventoryProvider = alphaInventoryProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean usesInventoryTracker() {
|
public boolean usesInventoryTracker() {
|
||||||
return !GeneralSettings.global().emulateInventoryActionsInLegacyVersions.getValue();
|
return !GeneralSettings.global().emulateInventoryActionsInAlphaVersions.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Item[] getMinecraftContainerItems(final List<ItemStack> trackingItems) {
|
protected Item[] getMinecraftContainerItems(final List<ItemStack> trackingItems) {
|
||||||
@ -62,7 +60,7 @@ public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider
|
|||||||
@Override
|
@Override
|
||||||
public Item[] getMainInventoryItems(UserConnection user) {
|
public Item[] getMainInventoryItems(UserConnection user) {
|
||||||
if (usesInventoryTracker()) {
|
if (usesInventoryTracker()) {
|
||||||
return trackingAlphaInventoryProvider.getMainInventoryItems(user);
|
return alphaInventoryProvider.getMainInventoryItems(user);
|
||||||
} else if (getPlayer() == null) {
|
} else if (getPlayer() == null) {
|
||||||
return new Item[37];
|
return new Item[37];
|
||||||
}
|
}
|
||||||
@ -73,7 +71,7 @@ public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider
|
|||||||
@Override
|
@Override
|
||||||
public Item[] getCraftingInventoryItems(UserConnection user) {
|
public Item[] getCraftingInventoryItems(UserConnection user) {
|
||||||
if (usesInventoryTracker()) {
|
if (usesInventoryTracker()) {
|
||||||
return trackingAlphaInventoryProvider.getCraftingInventoryItems(user);
|
return alphaInventoryProvider.getCraftingInventoryItems(user);
|
||||||
} else if (getPlayer() == null) {
|
} else if (getPlayer() == null) {
|
||||||
return new Item[4];
|
return new Item[4];
|
||||||
}
|
}
|
||||||
@ -84,7 +82,7 @@ public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider
|
|||||||
@Override
|
@Override
|
||||||
public Item[] getArmorInventoryItems(UserConnection user) {
|
public Item[] getArmorInventoryItems(UserConnection user) {
|
||||||
if (usesInventoryTracker()) {
|
if (usesInventoryTracker()) {
|
||||||
return trackingAlphaInventoryProvider.getArmorInventoryItems(user);
|
return alphaInventoryProvider.getArmorInventoryItems(user);
|
||||||
} else if (getPlayer() == null) {
|
} else if (getPlayer() == null) {
|
||||||
return new Item[4];
|
return new Item[4];
|
||||||
}
|
}
|
||||||
@ -95,7 +93,7 @@ public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider
|
|||||||
@Override
|
@Override
|
||||||
public Item[] getContainerItems(UserConnection user) {
|
public Item[] getContainerItems(UserConnection user) {
|
||||||
if (usesInventoryTracker()) {
|
if (usesInventoryTracker()) {
|
||||||
return trackingAlphaInventoryProvider.getContainerItems(user);
|
return alphaInventoryProvider.getContainerItems(user);
|
||||||
} else if (getPlayer() == null) {
|
} else if (getPlayer() == null) {
|
||||||
return new Item[37];
|
return new Item[37];
|
||||||
}
|
}
|
||||||
@ -106,7 +104,7 @@ public class ViaFabricPlusAlphaInventoryProvider extends AlphaInventoryProvider
|
|||||||
@Override
|
@Override
|
||||||
public void addToInventory(UserConnection user, Item item) {
|
public void addToInventory(UserConnection user, Item item) {
|
||||||
if (usesInventoryTracker()) {
|
if (usesInventoryTracker()) {
|
||||||
trackingAlphaInventoryProvider.addToInventory(user, item);
|
alphaInventoryProvider.addToInventory(user, item);
|
||||||
} else {
|
} else {
|
||||||
getPlayer().getInventory().insertStack(ItemTranslator.viaB1_8toMc(item));
|
getPlayer().getInventory().insertStack(ItemTranslator.viaB1_8toMc(item));
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class ConfigPatcher extends Config {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getDefaultConfigURL() {
|
public URL getDefaultConfigURL() {
|
||||||
return ConfigPatcher.class.getClassLoader().getResource("assets/viafabricplus/viaversion-config.yml");
|
return ConfigPatcher.class.getClassLoader().getResource("assets/viafabricplus/dummy-config.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,7 +49,7 @@ public class DebugSettings extends SettingGroup {
|
|||||||
public final VersionedBooleanSetting preventEntityCramming = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.prevent_entity_cramming"), VersionRange.andOlder(VersionEnum.r1_8));
|
public final VersionedBooleanSetting preventEntityCramming = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.prevent_entity_cramming"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||||
|
|
||||||
// 1.8.x -> 1.7.6
|
// 1.8.x -> 1.7.6
|
||||||
public final VersionedBooleanSetting replaceSneaking = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.replace_sneaking"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
public final VersionedBooleanSetting replaceSneaking = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.replace_sneaking"), VersionRange.andOlder(VersionEnum.r1_8));
|
||||||
public final VersionedBooleanSetting longSneaking = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.long_sneaking"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
public final VersionedBooleanSetting longSneaking = new VersionedBooleanSetting(this, Text.translatable("debug_settings.viafabricplus.long_sneaking"), VersionRange.andOlder(VersionEnum.r1_7_6tor1_7_10));
|
||||||
|
|
||||||
// 1.5/1.5.1 -> 1.4.6/1.4.7
|
// 1.5/1.5.1 -> 1.4.6/1.4.7
|
||||||
|
@ -56,7 +56,7 @@ public class GeneralSettings extends SettingGroup {
|
|||||||
Text.translatable("base.viafabricplus.cancel")
|
Text.translatable("base.viafabricplus.cancel")
|
||||||
);
|
);
|
||||||
public final BooleanSetting loadSkinsAndSkullsInLegacyVersions = new BooleanSetting(this, Text.translatable("general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions"), true);
|
public final BooleanSetting loadSkinsAndSkullsInLegacyVersions = new BooleanSetting(this, Text.translatable("general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions"), true);
|
||||||
public final BooleanSetting emulateInventoryActionsInLegacyVersions = new BooleanSetting(this, Text.translatable("general_settings.viafabricplus.emulate_inventory_actions_in_legacy_versions"), true);
|
public final BooleanSetting emulateInventoryActionsInAlphaVersions = new BooleanSetting(this, Text.translatable("general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions"), true);
|
||||||
|
|
||||||
public GeneralSettings() {
|
public GeneralSettings() {
|
||||||
super(Text.translatable("setting_group_name.viafabricplus.general"));
|
super(Text.translatable("setting_group_name.viafabricplus.general"));
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
"general_settings.viafabricplus.show_advertised_server_version": "Show advertised/server version in Multiplayer",
|
"general_settings.viafabricplus.show_advertised_server_version": "Show advertised/server version in Multiplayer",
|
||||||
"general_settings.viafabricplus.ignore_packet_translation_errors": "Ignore packet translation errors",
|
"general_settings.viafabricplus.ignore_packet_translation_errors": "Ignore packet translation errors",
|
||||||
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "Load skins and skulls in legacy versions",
|
"general_settings.viafabricplus.load_skins_and_skulls_in_legacy_versions": "Load skins and skulls in legacy versions",
|
||||||
"general_settings.viafabricplus.emulate_inventory_actions_in_legacy_versions": "Emulate inventory actions in legacy versions",
|
"general_settings.viafabricplus.emulate_inventory_actions_in_alpha_versions": "Emulate inventory actions in alpha versions",
|
||||||
|
|
||||||
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Open prompt GUI to confirm transferring to other servers",
|
"bedrock_settings.viafabricplus.confirm_transfer_server_prompt": "Open prompt GUI to confirm transferring to other servers",
|
||||||
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click to set account for Bedrock edition",
|
"bedrock_settings.viafabricplus.click_to_set_bedrock_account": "Click to set account for Bedrock edition",
|
||||||
|
Loading…
Reference in New Issue
Block a user