diff --git a/ReadMe.md b/ReadMe.md index f5ec81f81..00c32ea19 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -38,14 +38,16 @@ Internally it is running minecraft 1.16.5 in the background. ## System requirements -- OS: Windows/Linux/macOS +- OS: Windows/Linux/macOS (FreeBSD, [Android](https://gitlab.bixilon.de/bixilon/minosoft/-/issues/71), Chrome OS, iOS are not supported) - CPU: x64/x86 processor (arm 64 is supported on macOS and linux) -- Memory: At least 150 MB free, 300 MB recommended +- Memory: At least 150 MB free, 300 MB+ recommended - GPU: Pretty much anything will work, it just needs to support OpenGL 3.3+ (gpus form 2010 up) - Disk space: The executable (60MB) + 3 MB for assets like textures - Java 11+ - No network is required (only for starting once, but it can also run completely offline, see #Offline) +Minosoft is really optimized and runs on really little hardware, ideal for schools/people with old computers. + Sadly due to not having opengl, the raspberry pi (or similar arm boards) are not supported, see [#77](https://gitlab.bixilon.de/bixilon/minosoft/-/issues/77) for more details. ## Offline diff --git a/build.gradle.kts b/build.gradle.kts index b57acab96..102fcb46b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -523,7 +523,7 @@ tasks.withType { } application { - mainClass.set("de.bixilon.minosoft.Minosoft") + mainClass.set("de.bixilon.minosoft.education.MinosoftEducation") } var destination: File? = null diff --git a/src/main/java/de/bixilon/minosoft/education/MinosoftEducation.kt b/src/main/java/de/bixilon/minosoft/education/MinosoftEducation.kt index de66755dc..2af7e3114 100644 --- a/src/main/java/de/bixilon/minosoft/education/MinosoftEducation.kt +++ b/src/main/java/de/bixilon/minosoft/education/MinosoftEducation.kt @@ -17,16 +17,20 @@ import de.bixilon.kutil.observer.DataObserver.Companion.observe import de.bixilon.kutil.shutdown.AbstractShutdownReason import de.bixilon.kutil.shutdown.ShutdownManager import de.bixilon.minosoft.Minosoft +import de.bixilon.minosoft.assets.IntegratedAssets import de.bixilon.minosoft.assets.minecraft.index.IndexAssetsType +import de.bixilon.minosoft.assets.util.InputStreamUtil.readJson import de.bixilon.minosoft.config.profile.profiles.account.AccountProfileManager import de.bixilon.minosoft.config.profile.profiles.audio.AudioProfileManager import de.bixilon.minosoft.config.profile.profiles.rendering.RenderingProfileManager import de.bixilon.minosoft.config.profile.profiles.resources.ResourcesProfileManager import de.bixilon.minosoft.data.accounts.Account import de.bixilon.minosoft.data.accounts.types.offline.OfflineAccount +import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft import de.bixilon.minosoft.education.config.EducationC import de.bixilon.minosoft.education.world.EducationGenerator import de.bixilon.minosoft.education.world.EducationStorage +import de.bixilon.minosoft.gui.eros.education.EducationUI import de.bixilon.minosoft.local.LocalConnection import de.bixilon.minosoft.protocol.network.session.play.PlaySession import de.bixilon.minosoft.protocol.network.session.play.PlaySessionStates.Companion.disconnected @@ -37,7 +41,7 @@ import de.bixilon.minosoft.util.logging.LogLevels import de.bixilon.minosoft.util.logging.LogMessageType object MinosoftEducation { - val config: EducationC = EducationC() + var config: EducationC = EducationC() private fun getAccount(): Account { val profile = AccountProfileManager.selected @@ -72,6 +76,9 @@ object MinosoftEducation { } session::error.observe(this) { ShutdownManager.shutdown(reason = AbstractShutdownReason.CRASH) } session.connect() + + val ui = EducationUI(session) + ui.show() } fun setup() { @@ -92,13 +99,18 @@ object MinosoftEducation { ResourcesProfileManager.selected.assets.indexAssetsTypes += IndexAssetsType.LANGUAGE } + fun loadSettings() { + Log.log(LogMessageType.LOADING, LogLevels.VERBOSE) { "Loading education.json" } + val stream = IntegratedAssets.DEFAULT.getOrNull(minosoft("education.json")) ?: return + this.config = stream.readJson() + } + @JvmStatic fun main(args: Array) { setup() - Minosoft.main(emptyArray()) + Minosoft.main(args) postSetup() - - // TODO: load education.json + loadSettings() start() } diff --git a/src/main/java/de/bixilon/minosoft/gui/eros/education/EducationUI.kt b/src/main/java/de/bixilon/minosoft/gui/eros/education/EducationUI.kt new file mode 100644 index 000000000..6ca6b07d1 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/gui/eros/education/EducationUI.kt @@ -0,0 +1,87 @@ +/* + * Minosoft + * Copyright (C) 2020-2024 Moritz Zwerger + * + * 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 . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.gui.eros.education + +import de.bixilon.kutil.shutdown.ShutdownManager +import de.bixilon.minosoft.data.entities.entities.Entity +import de.bixilon.minosoft.data.registries.blocks.types.Block +import de.bixilon.minosoft.data.registries.identified.Namespaces.minosoft +import de.bixilon.minosoft.gui.eros.controller.JavaFXWindowController +import de.bixilon.minosoft.gui.eros.util.JavaFXUtil +import de.bixilon.minosoft.protocol.network.session.play.PlaySession +import javafx.fxml.FXML +import javafx.scene.control.ComboBox +import javafx.scene.control.Slider +import javafx.scene.control.TextField +import javafx.scene.text.TextFlow +import java.lang.reflect.Method + +class EducationUI( + val session: PlaySession, +) : JavaFXWindowController() { + @FXML private lateinit var blockX: TextField + @FXML private lateinit var blockY: TextField + @FXML private lateinit var blockZ: TextField + @FXML private lateinit var blockFX: ComboBox + + @FXML private lateinit var entityFX: ComboBox + + @FXML private lateinit var timeStatus: TextFlow + @FXML private lateinit var timeSpeed: Slider + + @FXML private lateinit var codeStatus: TextFlow + + @FXML private lateinit var functionsFX: ComboBox + + public override fun show() { + JavaFXUtil.openModalAsync("Minosoft Education UI", LAYOUT, this) { super.show() } + } + + override fun postInit() { + stage.setOnCloseRequest { + if (closing) return@setOnCloseRequest + ShutdownManager.shutdown() + } + } + + override fun close() { + super.close() + ShutdownManager.shutdown() + } + + fun reset() = Unit + fun killAll() = Unit + fun freeze() = Unit + + fun getBlock() = Unit + fun setBlock() = Unit + + fun kill() = Unit + fun highlight() = Unit + fun teleport() = Unit + + fun pause() = Unit + fun step() = Unit + + + fun stop() = Unit + fun restart() = Unit + fun reload() = Unit + + fun invoke() = Unit + + companion object { + val LAYOUT = minosoft("eros/education/education.fxml") + } +} diff --git a/src/main/java/de/bixilon/minosoft/gui/eros/util/JavaFXUtil.kt b/src/main/java/de/bixilon/minosoft/gui/eros/util/JavaFXUtil.kt index 26df819d8..4ad8ab396 100644 --- a/src/main/java/de/bixilon/minosoft/gui/eros/util/JavaFXUtil.kt +++ b/src/main/java/de/bixilon/minosoft/gui/eros/util/JavaFXUtil.kt @@ -41,11 +41,7 @@ import javafx.beans.property.BooleanPropertyBase import javafx.css.StyleableProperty import javafx.fxml.FXMLLoader import javafx.scene.* -import javafx.scene.control.Alert -import javafx.scene.control.Labeled -import javafx.scene.control.TableColumnBase -import javafx.scene.control.TextField -import javafx.scene.control.Tooltip +import javafx.scene.control.* import javafx.scene.image.Image import javafx.scene.input.KeyCode import javafx.scene.input.KeyEvent @@ -59,6 +55,7 @@ import java.io.File object JavaFXUtil { private const val DEFAULT_STYLE = "resource:minosoft:eros/style.css" + private const val EDUCATION_STYLE = "resource:minosoft:eros/education/education.css" private val SHOWING_FIELD = Window::class.java.getFieldOrNull("showing")!! private val MARK_INVALID_METHOD = BooleanPropertyBase::class.java.getDeclaredMethod("markInvalid").apply { setUnsafeAccessible() } private val stages = StageList() @@ -81,6 +78,7 @@ object JavaFXUtil { stage ?: break stage.scene.stylesheets.clear() stage.scene.stylesheets.add(DEFAULT_STYLE) + stage.scene.stylesheets.add(EDUCATION_STYLE) stage.scene.stylesheets.add(getThemeURL(it)) } } @@ -95,6 +93,7 @@ object JavaFXUtil { stage.icons.setAll(MINOSOFT_LOGO) stage.scene.stylesheets.add(DEFAULT_STYLE) + stage.scene.stylesheets.add(EDUCATION_STYLE) val theme = ErosProfileManager.selected.theme.theme stage.scene.stylesheets.add(getThemeURL(theme)) diff --git a/src/main/resources/assets/minosoft/eros/education/education.css b/src/main/resources/assets/minosoft/eros/education/education.css new file mode 100644 index 000000000..c34b4d8ac --- /dev/null +++ b/src/main/resources/assets/minosoft/eros/education/education.css @@ -0,0 +1,35 @@ +/* + * Minosoft + * Copyright (C) 2020-2024 Moritz Zwerger + * + * 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 . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +.status { + -fx-border-width: 3px; + -fx-border-style: solid; +} + +.status-running { + -fx-border-color: green; + -fx-background-color: lightgreen; + -fx-text-fill: white; +} + +.status-paused { + -fx-border-color: orange; + -fx-background-color: yellow; + -fx-text-fill: black; +} + +.status-terminated { + -fx-border-color: red; + -fx-background-color: lightred; + -fx-text-fill: black; +} diff --git a/src/main/resources/assets/minosoft/eros/education/education.fxml b/src/main/resources/assets/minosoft/eros/education/education.fxml new file mode 100644 index 000000000..6272dce2e --- /dev/null +++ b/src/main/resources/assets/minosoft/eros/education/education.fxml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + +