mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2025-01-06 19:18:25 +01:00
Don't expose some functions to the API
This commit is contained in:
parent
b34f7770fe
commit
075ea45cc3
@ -21,7 +21,9 @@
|
||||
|
||||
package de.florianmichael.viafabricplus;
|
||||
|
||||
import de.florianmichael.viafabricplus.save.SaveManager;
|
||||
import de.florianmichael.viafabricplus.settings.SettingsManager;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
@ -34,7 +36,10 @@ public class ViaFabricPlus {
|
||||
|
||||
private static final ViaFabricPlus INSTANCE = new ViaFabricPlus();
|
||||
|
||||
private final Logger logger = LogManager.getLogger("ViaFabricPlus-Legacy");
|
||||
|
||||
private final SettingsManager settingsManager = new SettingsManager();
|
||||
private final SaveManager saveManager = new SaveManager();
|
||||
|
||||
@Deprecated
|
||||
public static ViaFabricPlus global() {
|
||||
@ -43,7 +48,7 @@ public class ViaFabricPlus {
|
||||
|
||||
@Deprecated
|
||||
public Logger getLogger() {
|
||||
return com.viaversion.viafabricplus.ViaFabricPlus.getImpl().logger();
|
||||
return logger;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ -52,13 +57,13 @@ public class ViaFabricPlus {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Object getSettingsManager() {
|
||||
public SettingsManager getSettingsManager() {
|
||||
return settingsManager;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Object getSaveManager() {
|
||||
throw new IllegalArgumentException("ViaFabricPlus#getSaveManager is not supported anymore.");
|
||||
public SaveManager getSaveManager() {
|
||||
return saveManager;
|
||||
}
|
||||
|
||||
}
|
@ -54,7 +54,7 @@ public class ProtocolTranslator {
|
||||
|
||||
@Deprecated
|
||||
public static UserConnection createDummyUserConnection(final ProtocolVersion clientVersion, final ProtocolVersion serverVersion) {
|
||||
return ViaFabricPlus.getImpl().createDummyUserConnection(clientVersion, serverVersion);
|
||||
throw new UnsupportedOperationException("This method is not supported anymore");
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 the original authors
|
||||
* - FlorianMichael/EnZaXD <florian.michael07@gmail.com>
|
||||
* - RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 ViaVersion and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.save;
|
||||
|
||||
/**
|
||||
* Please migrate to the general {@link com.viaversion.viafabricplus.ViaFabricPlus} API point.
|
||||
*/
|
||||
@Deprecated
|
||||
public class SaveManager {
|
||||
|
||||
}
|
@ -51,13 +51,6 @@ public interface ViaFabricPlusBase {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the logger for this mod.
|
||||
*
|
||||
* @return The logger
|
||||
*/
|
||||
Logger logger();
|
||||
|
||||
/**
|
||||
* Get the root path of the mod.
|
||||
*
|
||||
@ -103,13 +96,6 @@ public interface ViaFabricPlusBase {
|
||||
*/
|
||||
void setTargetVersion(final ProtocolVersion newVersion, final boolean revertOnDisconnect);
|
||||
|
||||
/**
|
||||
* @param clientVersion The client version
|
||||
* @param serverVersion The server version
|
||||
* @return Creates a dummy UserConnection class with a valid protocol pipeline to emulate packets
|
||||
*/
|
||||
UserConnection createDummyUserConnection(final ProtocolVersion clientVersion, final ProtocolVersion serverVersion);
|
||||
|
||||
/**
|
||||
* @return the current UserConnection of the connection to the server, if the player isn't connected to a server it will return null
|
||||
*/
|
||||
|
@ -32,7 +32,7 @@ dependencies {
|
||||
modJij fabricApi.module("fabric-registry-sync-v0", project.fabric_api_version)
|
||||
|
||||
// Sub projects, since they are Fabric mods as well (mainly to access the game code) we have to first
|
||||
// implement the namedElements (raw output) to compile against, then include the mappedElements into the output jar1
|
||||
// implement the namedElements (raw output) to compile against, then include the mappedElements into the output jar
|
||||
implementation project(path: ":viafabricplus-api", configuration: "namedElements")
|
||||
implementation project(path: ":viafabricplus-api-legacy", configuration: "namedElements")
|
||||
implementation project(path: ":viafabricplus-visuals", configuration: "namedElements")
|
||||
|
@ -144,11 +144,6 @@ public final class ViaFabricPlusImpl implements ViaFabricPlusBase {
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Proxy the most important/used internals to a general API point for mods
|
||||
|
||||
@Override
|
||||
public Logger logger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path rootPath() {
|
||||
return path;
|
||||
@ -179,11 +174,6 @@ public final class ViaFabricPlusImpl implements ViaFabricPlusBase {
|
||||
ProtocolTranslator.setTargetVersion(newVersion, revertOnDisconnect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserConnection createDummyUserConnection(ProtocolVersion clientVersion, ProtocolVersion serverVersion) {
|
||||
return ProtocolTranslator.createDummyUserConnection(clientVersion, serverVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserConnection getPlayNetworkUserConnection() {
|
||||
return ProtocolTranslator.getPlayNetworkUserConnection();
|
||||
@ -269,4 +259,8 @@ public final class ViaFabricPlusImpl implements ViaFabricPlusBase {
|
||||
return NegativeItemUtil.getCount(stack);
|
||||
}
|
||||
|
||||
public Logger logger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
package com.viaversion.viafabricplus.screen;
|
||||
|
||||
import com.viaversion.viafabricplus.ViaFabricPlus;
|
||||
import com.viaversion.viafabricplus.ViaFabricPlusImpl;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConfirmLinkScreen;
|
||||
@ -233,7 +233,7 @@ public class VFPScreen extends Screen {
|
||||
* @param next The screen which should be opened after the error screen is closed
|
||||
*/
|
||||
public static void showErrorScreen(final Text title, final Throwable throwable, final Screen next) {
|
||||
ViaFabricPlus.getImpl().logger().error("Something went wrong!", throwable);
|
||||
ViaFabricPlusImpl.INSTANCE.logger().error("Something went wrong!", throwable);
|
||||
|
||||
final MinecraftClient client = MinecraftClient.getInstance();
|
||||
client.execute(() -> client.setScreen(new NoticeScreen(() -> client.setScreen(next), title, Text.translatable("base.viafabricplus.something_went_wrong").append("\n" + throwable.getMessage()), Text.translatable("base.viafabricplus.cancel"), false)));
|
@ -30,9 +30,15 @@ import com.viaversion.viafabricplus.visuals.features.classic_creative_menu.GridI
|
||||
import com.viaversion.viafabricplus.visuals.settings.VisualSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class ViaFabricPlusVisuals implements ViaFabricPlusLoadEntrypoint {
|
||||
|
||||
public static final ViaFabricPlusVisuals INSTANCE = new ViaFabricPlusVisuals();
|
||||
|
||||
private final Logger logger = LogManager.getLogger("ViaFabricPlus-Visuals");
|
||||
|
||||
@Override
|
||||
public void onPlatformLoad(ViaFabricPlusBase platform) {
|
||||
UnicodeFontFix1_12_2.init();
|
||||
@ -55,4 +61,8 @@ public class ViaFabricPlusVisuals implements ViaFabricPlusLoadEntrypoint {
|
||||
}));
|
||||
}
|
||||
|
||||
public Logger logger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
package com.viaversion.viafabricplus.visuals.features.armor_hud;
|
||||
|
||||
import com.viaversion.viafabricplus.ViaFabricPlus;
|
||||
import com.viaversion.viafabricplus.visuals.ViaFabricPlusVisuals;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
@ -54,7 +55,7 @@ public final class ArmorHudEmulation1_8 {
|
||||
try {
|
||||
sendArmorUpdate(userConnection);
|
||||
} catch (Throwable t) {
|
||||
ViaFabricPlus.getImpl().logger().error("Error sending armor update", t);
|
||||
ViaFabricPlusVisuals.INSTANCE.logger().error("Error sending armor update", t);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -22,20 +22,22 @@
|
||||
package com.viaversion.viafabricplus.visuals.features.classic_creative_menu;
|
||||
|
||||
import com.viaversion.viafabricplus.ViaFabricPlus;
|
||||
import com.viaversion.viafabricplus.screen.VFPScreen;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.resource.featuretoggle.FeatureFlags;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
public final class GridItemSelectionScreen extends VFPScreen {
|
||||
public final class GridItemSelectionScreen extends Screen {
|
||||
|
||||
public static final GridItemSelectionScreen INSTANCE = new GridItemSelectionScreen();
|
||||
|
||||
@ -48,7 +50,7 @@ public final class GridItemSelectionScreen extends VFPScreen {
|
||||
public ItemStack selectedItem = null;
|
||||
|
||||
public GridItemSelectionScreen() {
|
||||
super("Classic item selection", false);
|
||||
super(Text.of("Classic item selection"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,7 +90,7 @@ public final class GridItemSelectionScreen extends VFPScreen {
|
||||
this.client.player.getInventory().main.set(client.player.getInventory().selectedSlot, selectedItem);
|
||||
this.client.player.playerScreenHandler.sendContentUpdates();
|
||||
|
||||
playClickSound();
|
||||
ClickableWidget.playClickSound(this.client.getSoundManager());
|
||||
this.close();
|
||||
}
|
||||
return super.mouseClicked(mouseX, mouseY, button);
|
||||
|
Loading…
Reference in New Issue
Block a user