-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add visuals fabric mod, add loading cycle entrypoint for addons
- Loading branch information
1 parent
50a8c1e
commit 10bcd40
Showing
72 changed files
with
745 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
api-legacy/src/main/java/de/florianmichael/viafabricplus/fixes/data/ItemRegistryDiff.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus | ||
* Copyright (C) 2021-2024 the original authors | ||
* - FlorianMichael/EnZaXD <[email protected]> | ||
* - 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.fixes.data; | ||
|
||
import com.viaversion.viafabricplus.ViaFabricPlus; | ||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; | ||
import net.minecraft.item.Item; | ||
|
||
/** | ||
* Please migrate to the general {@link com.viaversion.viafabricplus.ViaFabricPlus} API point. | ||
*/ | ||
@Deprecated | ||
public class ItemRegistryDiff { | ||
|
||
@Deprecated | ||
public static boolean keepItem(final Item item) { | ||
return ViaFabricPlus.getImpl().itemExistsInConnection(item); | ||
} | ||
|
||
@Deprecated | ||
public static boolean contains(final Item item, final ProtocolVersion version) { | ||
return ViaFabricPlus.getImpl().itemExists(item, version); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...rc/main/java/com/viaversion/viafabricplus/api/entrypoint/ViaFabricPlusLoadEntrypoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus | ||
* Copyright (C) 2021-2024 the original authors | ||
* - FlorianMichael/EnZaXD <[email protected]> | ||
* - 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 com.viaversion.viafabricplus.api.entrypoint; | ||
|
||
import com.viaversion.viafabricplus.api.ViaFabricPlusBase; | ||
|
||
/** | ||
* Entrypoint called before the ViaFabricPlus loading cycle starts. To be used by addons to register their own callbacks. | ||
* <p> | ||
* See {@link com.viaversion.viafabricplus.api.events.LoadingCycleCallback} for more information. | ||
*/ | ||
@FunctionalInterface | ||
public interface ViaFabricPlusLoadEntrypoint { | ||
|
||
void onPlatformLoad(final ViaFabricPlusBase platform); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,4 @@ public final class Events { | |
} | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...n/viafabricplus/injection/mixin/base/ui/MixinMultiplayerServerListWidget_ServerEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* This file is part of ViaFabricPlus - https://github.com/ViaVersion/ViaFabricPlus | ||
* Copyright (C) 2021-2024 the original authors | ||
* - FlorianMichael/EnZaXD <[email protected]> | ||
* - 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 com.viaversion.viafabricplus.injection.mixin.base.ui; | ||
|
||
import com.google.common.collect.Lists; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import com.viaversion.viafabricplus.injection.access.base.IServerInfo; | ||
import com.viaversion.viafabricplus.settings.impl.GeneralSettings; | ||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; | ||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen; | ||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget; | ||
import net.minecraft.client.network.ServerInfo; | ||
import net.minecraft.text.Text; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Mixin(MultiplayerServerListWidget.ServerEntry.class) | ||
public abstract class MixinMultiplayerServerListWidget_ServerEntry { | ||
|
||
@Shadow @Final private ServerInfo server; | ||
|
||
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/multiplayer/MultiplayerScreen;setTooltip(Lnet/minecraft/text/Text;)V")) | ||
private void drawTranslatingState(MultiplayerScreen instance, Text text, Operation<Void> original) { | ||
final List<Text> tooltips = new ArrayList<>(); | ||
tooltips.add(text); | ||
if (GeneralSettings.INSTANCE.showAdvertisedServerVersion.getValue()) { | ||
final ProtocolVersion version = ((IServerInfo) server).viaFabricPlus$translatingVersion(); | ||
if (version != null) { | ||
tooltips.add(Text.translatable("base.viafabricplus.via_translates_to", version.getName() + " (" + version.getOriginalVersion() + ")")); | ||
tooltips.add(Text.translatable("base.viafabricplus.server_version", server.version.getString() + " (" + server.protocolVersion + ")")); | ||
} | ||
} | ||
instance.setTooltip(Lists.transform(tooltips, Text::asOrderedText)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.