feat: add amythest and remove lceonline

This commit is contained in:
neoapps-dev 2026-08-15 22:57:18 +03:00
parent 167e1b8066
commit c3e2eb3efb
5 changed files with 45 additions and 25 deletions

BIN
public/images/amythest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -18,6 +18,7 @@ import {
import { ScreenshotImage } from "../common/ScreenshotImage";
import { usePlatform } from "../../hooks/usePlatform";
import type { Edition } from "../../types/edition";
import { HIDDEN_INSTANCE_URL } from "../../types/edition";
interface DeleteConfirmButtonProps {
label: string;
onClick: () => void;
@ -90,6 +91,11 @@ const VersionsView = memo(function VersionsView() {
} = useGame();
const { isDayTime } = useConfig();
const { isAndroid } = usePlatform();
const visibleEditions = editions.filter(
(e) =>
e.url !== HIDDEN_INSTANCE_URL ||
installedVersions.includes(e.instanceId),
);
const [focusIndex, setFocusIndex] = useState<number>(0);
const [focusBtn, setFocusBtn] = useState<number>(0);
const [isImportModalOpen, setIsImportModalOpen] = useState(false);
@ -131,7 +137,7 @@ const VersionsView = memo(function VersionsView() {
const [argsSchemas, setArgsSchemas] = useState<Record<string, boolean>>({});
const containerRef = useRef<HTMLDivElement>(null);
const listRef = useRef<HTMLDivElement>(null);
const ITEM_COUNT = editions.length + 3;
const ITEM_COUNT = visibleEditions.length + 3;
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if (document.activeElement?.tagName === "INPUT") return;
@ -164,8 +170,8 @@ const VersionsView = memo(function VersionsView() {
setFocusBtn(0);
} else if (e.key === "ArrowLeft") {
e.preventDefault();
if (focusIndex < editions.length) {
const edition = editions[focusIndex];
if (focusIndex < visibleEditions.length) {
const edition = visibleEditions[focusIndex];
const isInstalled = installedVersions.includes(edition.id);
const isCustom = edition.id.startsWith("custom_");
const maxBtn = isInstalled ? (isCustom ? 6 : 4) : 1;
@ -173,8 +179,8 @@ const VersionsView = memo(function VersionsView() {
}
} else if (e.key === "ArrowRight") {
e.preventDefault();
if (focusIndex < editions.length) {
const edition = editions[focusIndex];
if (focusIndex < visibleEditions.length) {
const edition = visibleEditions[focusIndex];
const isInstalled = installedVersions.includes(edition.id);
const isCustom = edition.id.startsWith("custom_");
const maxBtn = isInstalled ? (isCustom ? 6 : 4) : 1;
@ -182,8 +188,8 @@ const VersionsView = memo(function VersionsView() {
}
} else if (e.key === "Enter") {
e.preventDefault();
if (focusIndex < editions.length) {
const edition = editions[focusIndex];
if (focusIndex < visibleEditions.length) {
const edition = visibleEditions[focusIndex];
const isInstalled = installedVersions.includes(edition.instanceId);
const isDownloading = downloadingIds.includes(edition.instanceId);
if (focusBtn === 0) {
@ -205,10 +211,10 @@ const VersionsView = memo(function VersionsView() {
playPressSound();
cycleBranch(edition.id);
}
} else if (focusIndex === editions.length) {
} else if (focusIndex === visibleEditions.length) {
playPressSound();
setIsImportModalOpen(true);
} else if (focusIndex === editions.length + 1) {
} else if (focusIndex === visibleEditions.length + 1) {
playPressSound();
handleImportFolder();
} else {
@ -246,7 +252,7 @@ const VersionsView = memo(function VersionsView() {
]);
useEffect(() => {
if (focusIndex < editions.length && listRef.current) {
if (focusIndex < visibleEditions.length && listRef.current) {
const el = listRef.current.querySelector(
`[data-index="${focusIndex}"]`,
) as HTMLElement;
@ -318,7 +324,7 @@ const VersionsView = memo(function VersionsView() {
};
const handleImportWorld = (instanceId: string) => {
const edition = editions.find((e: Edition) => e.instanceId === instanceId);
const edition = visibleEditions.find((e: Edition) => e.instanceId === instanceId);
setImportWorldTarget({ id: instanceId, name: edition?.name ?? instanceId });
setIsImportWorldModalOpen(true);
};
@ -342,7 +348,7 @@ const VersionsView = memo(function VersionsView() {
className="w-full max-h-[45vh] overflow-y-auto py-2 custom-scrollbar"
>
<div className="flex flex-col gap-1">
{editions.map((edition: Edition, i: number) => {
{visibleEditions.map((edition: Edition, i: number) => {
const isInstalled = installedVersions.includes(
edition.instanceId,
);
@ -974,14 +980,14 @@ const VersionsView = memo(function VersionsView() {
setInitialPath("");
setIsImportModalOpen(true);
}}
onMouseEnter={() => setFocusIndex(editions.length)}
onMouseEnter={() => setFocusIndex(visibleEditions.length)}
onMouseLeave={() => setHoveredBtn(null)}
className="w-8 h-8 flex items-center justify-center text-[#3a3a3a]"
style={{
backgroundImage:
(hoveredBtn?.row === editions.length &&
(hoveredBtn?.row === visibleEditions.length &&
hoveredBtn?.btn === "add") ||
focusIndex === editions.length
focusIndex === visibleEditions.length
? "url('/images/Button_Square_Highlighted.png')"
: "url('/images/Button_Square.png')",
backgroundSize: "100% 100%",
@ -1007,15 +1013,15 @@ const VersionsView = memo(function VersionsView() {
playPressSound();
handleImportFolder();
}}
onMouseEnter={() => setFocusIndex(editions.length + 1)}
onMouseEnter={() => setFocusIndex(visibleEditions.length + 1)}
onMouseLeave={() => setHoveredBtn(null)}
title="Import Custom TU"
className="w-8 h-8 flex items-center justify-center text-[#3a3a3a]"
style={{
backgroundImage:
(hoveredBtn?.row === editions.length &&
(hoveredBtn?.row === visibleEditions.length &&
hoveredBtn?.btn === "folder_import") ||
focusIndex === editions.length + 1
focusIndex === visibleEditions.length + 1
? "url('/images/Button_Square_Highlighted.png')"
: "url('/images/Button_Square.png')",
backgroundSize: "100% 100%",
@ -1038,8 +1044,8 @@ const VersionsView = memo(function VersionsView() {
{!isAndroid && (
<div className="flex justify-center">
<button
data-index={editions.length + 2}
onMouseEnter={() => setFocusIndex(editions.length + 2)}
data-index={visibleEditions.length + 2}
onMouseEnter={() => setFocusIndex(visibleEditions.length + 2)}
onClick={() => {
playBackSound();
setActiveView("main");
@ -1047,7 +1053,7 @@ const VersionsView = memo(function VersionsView() {
className="w-48 h-10 flex items-center justify-center text-xl mc-text-shadow outline-none border-none text-white"
style={{
backgroundImage:
focusIndex === editions.length + 2
focusIndex === visibleEditions.length + 2
? "url('/images/button_highlighted.png')"
: "url('/images/Button_Background.png')",
backgroundSize: "100% 100%",
@ -1090,7 +1096,7 @@ const VersionsView = memo(function VersionsView() {
onClose={() => setIsSetUidModalOpen(false)}
playPressSound={playPressSound}
playBackSound={playBackSound}
instances={editions}
instances={visibleEditions}
installedVersions={installedVersions}
targetInstanceId={setUidTargetId}
/>

View file

@ -10,8 +10,8 @@ import {
import { TauriService, type CustomEdition } from "../services/TauriService";
import { getCurrentWindow } from "@tauri-apps/api/window";
import { usePlatform } from "./usePlatform";
import { HIDDEN_INSTANCE_URL } from "../types/edition";
import type { Edition } from "../types/edition";
async function imageUrlToBase64(url: string): Promise<string> {
const response = await fetch(url);
const blob = await response.blob();
@ -79,16 +79,27 @@ export const BASE_EDITIONS = [
panorama: "moonedition",
},
{
//neo: disabled.
id: "lceonline",
name: "LCE Online Client",
desc: "Restoring the classic LCE online experience with friends, world hosting, leaderboards & more.",
url: "https://github.com/lceonline/MCLEClient/releases/latest/download/LCENWindows64.zip",
desc: "[DISCONTINUED!] Restoring the classic LCE online experience with friends, world hosting, leaderboards & more.",
url: HIDDEN_INSTANCE_URL, //neo: was "https://github.com/lceonline/MCLEClient/releases/latest/download/LCENWindows64.zip"
titleImage: "/images/lceonline.png",
supportsSlimSkins: false,
logo: "/images/lce_online.png",
panorama: "vanilla_tu19",
lceOnline: true,
},
{
id: "amythest",
name: "Amethyst LCE",
desc: "A project aimed towards backporting modern Java edition features and their feel into LCE! ",
logo: "/images/amythest.png",
panorama: "vanilla_tu24", //neo: TODO: use the Amythest's panorama
supportsSlimSkins: false, //neo: TODO: check properly lol
titleImage: "/images/amythest_title.png",
url: "https://github.com/ducttapesucker9000-svg/Amethyst_Source/releases/download/latest/Amethyst-Windows-Release.zip",
},
];
const PARTNERSHIP_SERVERS = [
@ -343,6 +354,8 @@ export function useGameManager({
editions.map(async (edition) => {
if (!installs.includes(edition.instanceId))
return [edition.instanceId, false] as const;
if (edition.url === HIDDEN_INSTANCE_URL)
return [edition.instanceId, false] as const;
try {
const isUpdate = await TauriService.checkGameUpdate(
edition.instanceId,

View file

@ -1,3 +1,4 @@
export const HIDDEN_INSTANCE_URL = "emerald://PLEASE_IM_TIRED_OF_ALL_THIS";
export interface Edition {
id: string;
name: string;