├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── dev ├── build.gradle └── src │ └── main │ ├── groovy │ └── com │ │ └── fox2code │ │ └── foxloader │ │ ├── decompiler │ │ ├── FoxJavadocProvider.java │ │ ├── FoxLoaderDecompiler.java │ │ ├── FoxLoaderDecompilerPlugin.java │ │ ├── FoxVariableNamingFactory.java │ │ └── watchdog │ │ │ ├── WatchdogThread.java │ │ │ └── WatchdogTimer.java │ │ └── dev │ │ ├── DevConstants.java │ │ ├── DevDependencyImpl.java │ │ ├── FoxJavaExec.java │ │ ├── FoxLoaderConfig.java │ │ ├── GradlePlugin.groovy │ │ ├── JitPackService.java │ │ ├── Main.java │ │ └── UserMessage.java │ └── resources │ ├── META-INF │ └── services │ │ └── org.jetbrains.java.decompiler.api.plugin.Plugin │ └── com │ └── fox2code │ └── foxloader │ └── decompiler │ └── javadocs.txt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── loader ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ └── fox2code │ │ └── foxloader │ │ ├── client │ │ ├── BlockRender.java │ │ ├── BlockRenderManager.java │ │ ├── CreativeTab.java │ │ ├── KeyBindingAPI.java │ │ └── gui │ │ │ ├── GuiButtonCallback.java │ │ │ ├── GuiButtonCallbackUpdate.java │ │ │ ├── GuiConfigProvider.java │ │ │ ├── GuiModConfig.java │ │ │ ├── GuiModMenu.java │ │ │ ├── GuiModMenuContainer.java │ │ │ └── GuiModMenuDescription.java │ │ ├── config │ │ ├── ConfigEntry.java │ │ ├── ConfigEntryType.java │ │ ├── ConfigIO.java │ │ ├── ConfigKey.java │ │ ├── ConfigMenu.java │ │ ├── ConfigStructure.java │ │ └── NoConfigObject.java │ │ ├── container │ │ ├── ContainerGuiAuto.java │ │ ├── ContainerGuiInvoker.java │ │ ├── ContainerGuiInvokerReflection.java │ │ └── ContainerManager.java │ │ ├── dependencies │ │ └── DependencyFileInfo.java │ │ ├── energy │ │ ├── FoxPowerBlock.java │ │ ├── FoxPowerCableBlock.java │ │ ├── FoxPowerCableTileEntity.java │ │ ├── FoxPowerInterface.java │ │ ├── FoxPowerInterfaceNone.java │ │ ├── FoxPowerInterfaceSimple.java │ │ ├── FoxPowerInterfaceWrapped.java │ │ ├── FoxPowerItem.java │ │ ├── FoxPowerType.java │ │ └── FoxPowerUtils.java │ │ ├── event │ │ ├── FoxLoaderEvents.java │ │ ├── GlobalTickEvent.java │ │ ├── client │ │ │ ├── CameraAndRenderUpdatedEvent.java │ │ │ ├── GuiItemInfoEvent.java │ │ │ ├── GuiScreenEvent.java │ │ │ ├── GuiScreenInitEvent.java │ │ │ ├── TexturesRefreshEvent.java │ │ │ └── TexturesRefreshedEvent.java │ │ ├── interaction │ │ │ ├── PlayerAttackEntityEvent.java │ │ │ ├── PlayerBreakBlockEvent.java │ │ │ ├── PlayerStartBreakBlockEvent.java │ │ │ ├── PlayerUseItem.java │ │ │ ├── PlayerUseItemOnAirEvent.java │ │ │ ├── PlayerUseItemOnBlockEvent.java │ │ │ └── PlayerUseItemOnEntityEvent.java │ │ ├── lifecycle │ │ │ ├── LifecycleEvent.java │ │ │ ├── LifecycleStartEvent.java │ │ │ └── LifecycleStopEvent.java │ │ ├── network │ │ │ └── PlayerConnectEvent.java │ │ ├── player │ │ │ ├── PlayerChatEvent.java │ │ │ ├── PlayerEvent.java │ │ │ ├── PlayerJoinEvent.java │ │ │ └── PlayerLeaveEvent.java │ │ ├── recipe │ │ │ └── PrepareRecipeEvent.java │ │ ├── text │ │ │ ├── PlayerEditCuneiformBlockEvent.java │ │ │ ├── PlayerEditSignEvent.java │ │ │ └── PlayerEditTextBlockEvent.java │ │ └── world │ │ │ ├── LiquidFlowIntoBlockEvent.java │ │ │ ├── WorldChangeEvent.java │ │ │ ├── WorldEvent.java │ │ │ ├── WorldExplosionEvent.java │ │ │ ├── WorldMultiBlockChange.java │ │ │ └── WorldTickEvent.java │ │ ├── installer │ │ ├── InstallerGUI.java │ │ ├── InstallerPlatform.java │ │ ├── Main.java │ │ ├── ProfileInstaller.java │ │ ├── SelectableTranslatableLabel.java │ │ ├── TranslateEngine.java │ │ └── VerticalGridBagLayout.java │ │ ├── internal │ │ ├── InternalEditTextHooks.java │ │ ├── InternalExplosionHooks.java │ │ ├── InternalFluidsHooks.java │ │ ├── InternalInteractionHooks.java │ │ ├── InternalLoggingHooks.java │ │ ├── InternalNetworkHooks.java │ │ ├── InternalPlayerHooks.java │ │ ├── InternalRecipeHooks.java │ │ ├── InternalRenderHooks.java │ │ ├── InternalScreenHooks.java │ │ └── InternalTranslateHooks.java │ │ ├── launcher │ │ ├── ClassLoaderMarker.java │ │ ├── ClientAndServerMain.java │ │ ├── ClientMain.java │ │ ├── EnvironmentType.java │ │ ├── FileInfo.java │ │ ├── FoxClassLoader.java │ │ ├── FoxLauncher.java │ │ ├── GameDependencyImpl.java │ │ ├── LauncherType.java │ │ ├── LoggerHelper.java │ │ ├── ServerMain.java │ │ └── protocols │ │ │ └── fl │ │ │ └── Handler.java │ │ ├── loader │ │ ├── LoadingPlugin.java │ │ ├── Mod.java │ │ ├── ModContainer.java │ │ ├── ModInfo.java │ │ ├── ModLoader.java │ │ ├── ModLoaderInit.java │ │ ├── ModLoaderOptions.java │ │ ├── contributors │ │ │ └── Contributors.java │ │ ├── early │ │ │ ├── EarlyLoader.java │ │ │ ├── Minecraft.java │ │ │ └── MinecraftServer.java │ │ ├── java │ │ │ ├── JavaLoadingPlugin.java │ │ │ └── JavaModInfo.java │ │ └── packet │ │ │ ├── ClientHello.java │ │ │ ├── FoxPacket.java │ │ │ ├── LoaderNetworkManager.java │ │ │ ├── ServerHello.java │ │ │ ├── ServerNoRegistry.java │ │ │ ├── ServerOpenContainer.java │ │ │ └── ServerRegistry.java │ │ ├── network │ │ ├── ConnectionType.java │ │ └── SidedMetadataAPI.java │ │ ├── patching │ │ ├── ClassTransformer.java │ │ ├── FoxClassDowngrader.java │ │ ├── LateOptimizationTransformer.java │ │ ├── PatchingLoaderExtensions.java │ │ ├── PreLoader.java │ │ └── mixin │ │ │ ├── MixinBootstrapService.java │ │ │ ├── MixinConstraintsExtension.java │ │ │ ├── MixinConstraintsImpl.java │ │ │ ├── MixinModLoader.java │ │ │ ├── MixinPropertyService.java │ │ │ └── MixinService.java │ │ ├── recipe │ │ ├── FoxTaggedIngredients.java │ │ └── ReshapeRecipe.java │ │ ├── registry │ │ ├── CommandRegistry.java │ │ ├── EntityRegistry.java │ │ ├── GameRegistry.java │ │ ├── RegistryEntry.java │ │ └── missing │ │ │ ├── MissingBlock.java │ │ │ ├── MissingItem.java │ │ │ ├── MissingItemBlock.java │ │ │ └── MissingItemDesc.java │ │ ├── selection │ │ ├── PlayerSelection.java │ │ ├── PlayerSelectionProvider.java │ │ └── PlayerSelectionProviderFallback.java │ │ ├── server │ │ └── NetworkBlockUpdateHelper.java │ │ ├── slf4j │ │ ├── FoxSLF4JLogger.java │ │ ├── FoxSLF4JLoggerFactory.java │ │ └── FoxSLF4JServiceProvider.java │ │ ├── spark │ │ ├── FoxLoaderSparkClassSourceLookup.java │ │ ├── FoxLoaderSparkCommand.java │ │ ├── FoxLoaderSparkCommandSender.java │ │ ├── FoxLoaderSparkJanksonConfigParser.java │ │ ├── FoxLoaderSparkPlatformInfo.java │ │ ├── FoxLoaderSparkPlayerPingProvider.java │ │ ├── FoxLoaderSparkPlugin.java │ │ ├── FoxLoaderSparkServerConfigProvider.java │ │ └── FoxLoaderSparkTickHook.java │ │ ├── updater │ │ ├── AbstractUpdater.java │ │ ├── FoxLoaderUpdater.java │ │ ├── MavenUpdater.java │ │ └── UpdateManager.java │ │ └── utils │ │ ├── CustomLogLevel.java │ │ ├── Enumerations.java │ │ ├── ReflectionUtils.java │ │ ├── StackTraceStringifier.java │ │ └── async │ │ ├── AsyncItrLinkedList.java │ │ └── FastThreadLocal.java │ └── resources │ ├── META-INF │ └── services │ │ ├── org.slf4j.spi.SLF4JServiceProvider │ │ ├── org.spongepowered.asm.service.IGlobalPropertyService │ │ ├── org.spongepowered.asm.service.IMixinService │ │ └── org.spongepowered.asm.service.IMixinServiceBootstrap │ ├── assets │ └── foxloader │ │ ├── icon.png │ │ ├── lang │ │ ├── en_US.lang │ │ └── ru_RU.lang │ │ └── textures │ │ ├── blocks │ │ └── block_missing.png │ │ ├── gui │ │ └── icons.png │ │ └── items │ │ └── item_missing.png │ ├── launcher-version.json │ └── mmc │ ├── instance.cfg │ ├── mmc-pack.json │ └── patches │ ├── com.fox2code.foxloader.json │ ├── net.minecraft.json │ ├── net.minecraftforge.json │ └── org.lwjgl.json ├── patching ├── build.gradle ├── generate.gradle └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── fox2code │ │ │ └── foxloader │ │ │ ├── dependencies │ │ │ └── DependencyHelper.java │ │ │ ├── patching │ │ │ ├── FoxLoaderPatches.java │ │ │ ├── OpcodesUtils.java │ │ │ ├── PatchBridge.java │ │ │ ├── PatchConstants.java │ │ │ ├── TransformerUtils.java │ │ │ ├── dev │ │ │ │ ├── DevelopmentSourceConstantData.java │ │ │ │ ├── DevelopmentSourcePatcher.java │ │ │ │ └── DevelopmentSourceTransformer.java │ │ │ └── game │ │ │ │ ├── CertificateHelperPatch.java │ │ │ │ ├── ChattingPatch.java │ │ │ │ ├── ClientCommandsPatch.java │ │ │ │ ├── ClientGameDirectoryPatch.java │ │ │ │ ├── CommandGamePatch.java │ │ │ │ ├── ContainerPatch.java │ │ │ │ ├── EditTextPatch.java │ │ │ │ ├── EntitiesPatch.java │ │ │ │ ├── ExplosionPatch.java │ │ │ │ ├── FluidsPatch.java │ │ │ │ ├── GamePatch.java │ │ │ │ ├── GamePatches.java │ │ │ │ ├── GuiElementsPatch.java │ │ │ │ ├── GuiScreenPatch.java │ │ │ │ ├── HotfixesPatch.java │ │ │ │ ├── KeyBindingPatch.java │ │ │ │ ├── LifecyclePatch.java │ │ │ │ ├── LogAgentPatch.java │ │ │ │ ├── NetworkConnectionPatch.java │ │ │ │ ├── PlayerInteractionsPatch.java │ │ │ │ ├── PlayerSelectionPatch.java │ │ │ │ ├── RecipesPatch.java │ │ │ │ ├── RegistryPatch.java │ │ │ │ ├── RenderPatch.java │ │ │ │ ├── TexturesPatch.java │ │ │ │ ├── TickEventPatch.java │ │ │ │ ├── TileEntityPatch.java │ │ │ │ ├── TranslationPatch.java │ │ │ │ └── VarNamePatch.java │ │ │ └── utils │ │ │ ├── EmptyArrays.java │ │ │ ├── Platform.java │ │ │ ├── SourceUtil.java │ │ │ └── io │ │ │ ├── CertificateHelper.java │ │ │ ├── IOUtils.java │ │ │ ├── JarUtils.java │ │ │ ├── NetUtils.java │ │ │ └── URLUtils.java │ └── resources │ │ └── assets │ │ └── foxloader │ │ └── certificates │ │ ├── DigiCert-Global-Root-CA.pem │ │ ├── DigiCert-Global-Root-G2.pem │ │ ├── DigiCert-Global-Root-G3.pem │ │ ├── GTS-Root-R1.pem │ │ ├── GTS-Root-R2.pem │ │ ├── GTS-Root-R3.pem │ │ ├── GTS-Root-R4.pem │ │ ├── ISRG-Root-X1.pem │ │ ├── ISRG-Root-X2.pem │ │ └── USERTrust-ECC-Certification-Authority.pem │ └── test │ └── java │ └── com │ └── fox2code │ └── foxloader │ └── patching │ └── test │ ├── OpcodesUtilsTest.java │ ├── TransformerUtilsTest.java │ └── URLUtilsTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | /.idea 3 | /build 4 | /lib/* 5 | .gradle/ 6 | /.settings/ 7 | /out/ 8 | /bin/ 9 | /*/build 10 | /*/out 11 | /run 12 | /run2 13 | /crash-reports 14 | /FoxLoader-*.zip 15 | hs_err_pid*.log 16 | *.jfr 17 | 18 | /.vscode 19 | /.project 20 | /.classpath 21 | /.profileconfig.json 22 | /local.properties 23 | 24 | /loader/libs/*.jar 25 | /loader/patched/*.jar 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023-2025 Fox2Code 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ReIndevFoxLoader 2 | 3 | ModLoader for Minecraft ReIndev 4 | 5 | [![](https://www.jitpack.io/v/com.fox2code/FoxLoader.svg)](https://www.jitpack.io/#com.fox2code/FoxLoader) 6 | 7 | ## Community 8 | 9 | You can [join the official ReIndev Discord here](https://discord.gg/38Vfes6NpR) 10 | 11 | A feature missing to make your mod? [Just open an issue!](https://github.com/Fox2Code/FoxLoader/issues) 12 | 13 | ## Installation 14 | 15 | For client side installation, just run the jar file. 16 | Either by double-clicking on it, or running `java -jar FoxLoader.jar` 17 | 18 | You can also install FoxLoader on PrismLauncher by drag and dropping the `FoxLoader-mmc.zip` into it. 19 | 20 | To run FoxLoader as a server just run `java -jar FoxLoader.jar --server` 21 | 22 | Note: For PojavLauncher, click on "Install .jar" and the rest should be automatic, 23 | only the Android version of PojavLauncher is supported. 24 | 25 | Note: Client is not supported on arm due to lack of it in LWJGL2, you can follow [this tutorial](https://shadowfacts.net/2022/lwjgl-arm64/) for help. 26 | 27 | ## Documentation 28 | 29 | For mixins usage check here: https://github.com/2xsaiko/mixin-cheatsheet 30 | 31 | For spark usage check here: https://spark.lucko.me/docs/Command-Usage 32 | 33 | For example mod check here: https://github.com/Fox2Code/FoxLoaderExampleMod 34 | -------------------------------------------------------------------------------- /dev/src/main/groovy/com/fox2code/foxloader/decompiler/FoxLoaderDecompilerPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.decompiler; 25 | 26 | import org.jetbrains.annotations.Nullable; 27 | import org.jetbrains.java.decompiler.api.java.JavaPassRegistrar; 28 | import org.jetbrains.java.decompiler.api.plugin.Plugin; 29 | import org.jetbrains.java.decompiler.main.extern.IVariableNamingFactory; 30 | import org.jetbrains.java.decompiler.main.plugins.PluginContext; 31 | 32 | public class FoxLoaderDecompilerPlugin implements Plugin { 33 | @Override 34 | public String id() { 35 | return "FoxLoader"; 36 | } 37 | 38 | @Override 39 | public String description() { 40 | return "FoxLoader Decompiler plugin"; 41 | } 42 | 43 | @Override 44 | public void registerJavaPasses(JavaPassRegistrar registrar) { 45 | if (PluginContext.getCurrentContext().getVariableRenamer() != FoxVariableNamingFactory.INSTANCE) { 46 | throw new RuntimeException("FoxLoader Variable renaming factory was not selected!"); 47 | } 48 | } 49 | 50 | @Override 51 | public @Nullable IVariableNamingFactory getRenamingFactory() { 52 | return FoxVariableNamingFactory.INSTANCE; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /dev/src/main/groovy/com/fox2code/foxloader/decompiler/watchdog/WatchdogTimer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.decompiler.watchdog; 25 | 26 | public final class WatchdogTimer { 27 | private final boolean essential; 28 | private volatile long lastCheck; 29 | private volatile long megaLastCheck; 30 | private boolean enabled; 31 | int lastTimeSkip; 32 | 33 | public WatchdogTimer(boolean essential) { 34 | WatchdogThread.registerTimer(this); 35 | this.essential = essential; 36 | this.lastCheck = 0; 37 | this.megaHeartbeat(); 38 | this.enabled = true; 39 | } 40 | 41 | public boolean isEssential() { 42 | return this.essential; 43 | } 44 | 45 | long getComputingFor() { 46 | return this.lastCheck == 0 ? 0 : System.currentTimeMillis() - 47 | Math.max(this.lastCheck, this.megaLastCheck); 48 | } 49 | 50 | public void heartbeat() { 51 | this.lastCheck = System.currentTimeMillis(); 52 | this.lastTimeSkip = WatchdogThread.lastTimeSkip; 53 | } 54 | 55 | public void megaHeartbeat() { 56 | this.megaLastCheck = System.currentTimeMillis() + 20000L; 57 | this.lastTimeSkip = WatchdogThread.lastTimeSkip; 58 | } 59 | 60 | public boolean isEnabled() { 61 | return this.enabled; 62 | } 63 | 64 | public void setEnabled(boolean enabled) { 65 | if (!this.enabled && enabled && 66 | (System.currentTimeMillis() - this.lastCheck) > 2L) { 67 | this.lastCheck = 0; 68 | } 69 | this.enabled = enabled; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /dev/src/main/groovy/com/fox2code/foxloader/dev/DevConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.dev; 25 | 26 | import com.fox2code.foxloader.launcher.BuildConfig; 27 | 28 | public class DevConstants { 29 | public static final int MIN_JAVA_VERSION = 8; 30 | public static final int MAX_JAVA_VERSION = BuildConfig.JVM_DOWNGRADER_JAVA_SUPPORT_MAX; 31 | } 32 | -------------------------------------------------------------------------------- /dev/src/main/groovy/com/fox2code/foxloader/dev/DevDependencyImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.dev; 25 | 26 | import com.fox2code.foxloader.dependencies.DependencyHelper; 27 | 28 | import java.net.URL; 29 | 30 | public final class DevDependencyImpl extends DependencyHelper.DependencyImpl { 31 | public static final DevDependencyImpl INSTANCE = new DevDependencyImpl(); 32 | 33 | private DevDependencyImpl() {} 34 | 35 | @Override 36 | public boolean hasClass(String cls) { 37 | // Very simple but should be good enough for our use case in dev plugin. 38 | return DevDependencyImpl.class.getClassLoader() 39 | .getResource(cls.replace('.', '/') + ".class") != null; 40 | } 41 | 42 | @Override 43 | public boolean isDev() { 44 | return true; 45 | } 46 | 47 | @Override 48 | public URL getClassResource(String className) { 49 | return DevDependencyImpl.class.getClassLoader() 50 | .getResource(className.replace('.', '/') + ".class"); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /dev/src/main/groovy/com/fox2code/foxloader/dev/JitPackService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.dev; 25 | 26 | public enum JitPackService { 27 | GITHUB("https://github.com/", "com.github."), 28 | GITLAB("https://gitlab.com/", "com.gitlab."); 29 | 30 | public final String websitePrefix; 31 | public final String jitpackPrefix; 32 | 33 | JitPackService(String websitePrefix, String jitpackPrefix) { 34 | this.websitePrefix = websitePrefix; 35 | this.jitpackPrefix = jitpackPrefix; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dev/src/main/resources/META-INF/services/org.jetbrains.java.decompiler.api.plugin.Plugin: -------------------------------------------------------------------------------- 1 | com.fox2code.foxloader.decompiler.FoxLoaderDecompilerPlugin -------------------------------------------------------------------------------- /dev/src/main/resources/com/fox2code/foxloader/decompiler/javadocs.txt: -------------------------------------------------------------------------------- 1 | # net/minecraft/common/item/Item.getRegisteringMod() 2 | @return the {@link ModContainer} that registered this item. 3 | # net/minecraft/common/block/Block.getRegisteringMod() 4 | @return the {@link ModContainer} that registered this block. 5 | # net/minecraft/common/item/ItemStack.getRemoteItemID() 6 | @return the server-side id of this ItemStack 7 | # net/minecraft/common/item/ItemStack.setRemoteItemID() 8 | Set the server-side id of this ItemStack, useful when parsing item IDs from the server. 9 | @param netItemID the server-side id of this ItemStack 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fox2Code/FoxLoader/96f6ef97d5194e203a686e7d273b7f40675f63f3/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon May 27 20:22:26 CEST 2024 2 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 3 | distributionBase=GRADLE_USER_HOME 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/client/BlockRender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.client; 25 | 26 | import net.minecraft.client.renderer.world.RenderBlocks; 27 | import net.minecraft.common.block.Block; 28 | import net.minecraft.common.world.BlockAccess; 29 | 30 | public abstract class BlockRender { 31 | public final boolean renderItemIn3D; 32 | int assignedID = -1; 33 | 34 | public BlockRender(boolean renderItemIn3D) { 35 | this.renderItemIn3D = renderItemIn3D; 36 | } 37 | 38 | public abstract boolean renderBlock(RenderBlocks renderBlocks, BlockAccess blockAccess, Block block, int x, int y, int z); 39 | 40 | public final int getAssignedID() { 41 | return this.assignedID; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/client/KeyBindingAPI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.client; 25 | 26 | import com.fox2code.foxloader.loader.ModLoader; 27 | import net.minecraft.client.util.KeyBinding; 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import java.util.ArrayList; 31 | import java.util.Arrays; 32 | 33 | public final class KeyBindingAPI { 34 | private static final ArrayList registeredKeyBindings = new ArrayList<>(); 35 | private static boolean loaded; 36 | 37 | private KeyBindingAPI() { throw new AssertionError(); } 38 | 39 | public static void registerKeyBinding(@NotNull KeyBinding keyBinding) { 40 | if (loaded) throw new IllegalStateException("Options are already loaded"); 41 | registeredKeyBindings.add(keyBinding); 42 | } 43 | 44 | public static class Internal { 45 | public static KeyBinding[] inject(KeyBinding[] keyBindings) { 46 | if (!ModLoader.areAllModsLoaded()) 47 | throw new IllegalStateException("Mods didn't finished to load!"); 48 | loaded = true; 49 | if (registeredKeyBindings.isEmpty()) 50 | return keyBindings; 51 | KeyBinding[] newKeyBindings = Arrays.copyOf(keyBindings, 52 | keyBindings.length + registeredKeyBindings.size()); 53 | System.arraycopy(registeredKeyBindings.toArray(new KeyBinding[0]), 0, 54 | newKeyBindings, keyBindings.length, registeredKeyBindings.size()); 55 | return newKeyBindings; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/client/gui/GuiButtonCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.client.gui; 25 | 26 | import net.minecraft.client.Minecraft; 27 | import net.minecraft.client.gui.GuiButton; 28 | 29 | public class GuiButtonCallback extends GuiButton { 30 | private final Runnable callback; 31 | 32 | public GuiButtonCallback(int id, int x, int y, String text, Runnable callback) { 33 | super(id, x, y, text); 34 | this.callback = callback; 35 | } 36 | 37 | public GuiButtonCallback(int id, int x, int y, String text, String extraText, Runnable callback) { 38 | super(id, x, y, text, extraText); 39 | this.callback = callback; 40 | } 41 | 42 | public GuiButtonCallback(int id, int x, int y, int w, int h, String text, Runnable callback) { 43 | super(id, x, y, w, h, text); 44 | this.callback = callback; 45 | } 46 | 47 | public GuiButtonCallback(int id, int x, int y, int w, int h, String text, String extraText, Runnable callback) { 48 | super(id, x, y, w, h, text, extraText); 49 | this.callback = callback; 50 | } 51 | 52 | @Override 53 | public boolean mousePressed(Minecraft minecraft, float x, float y) { 54 | boolean pressed = super.mousePressed(minecraft, x, y); 55 | if (pressed && this.callback != null) this.callback.run(); 56 | return pressed; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/client/gui/GuiConfigProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.client.gui; 25 | 26 | import com.fox2code.foxloader.config.NoConfigObject; 27 | import net.minecraft.client.gui.GuiScreen; 28 | 29 | @FunctionalInterface 30 | public interface GuiConfigProvider extends NoConfigObject { 31 | GuiScreen provideConfigScreen(GuiScreen parent); 32 | } 33 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/config/ConfigEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.config; 25 | 26 | import java.lang.annotation.ElementType; 27 | import java.lang.annotation.Retention; 28 | import java.lang.annotation.RetentionPolicy; 29 | import java.lang.annotation.Target; 30 | 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target(ElementType.FIELD) 33 | public @interface ConfigEntry { 34 | String configTranslation() default "config.${modId}.${configPath}.name"; 35 | 36 | String configName() default ""; 37 | 38 | String configComment() default ""; 39 | 40 | String configPath() default "${defaultConfigPath}"; 41 | 42 | ConfigEntryType type() default ConfigEntryType.AUTO; 43 | 44 | double lowerBounds() default 0; 45 | 46 | double upperBounds() default 1; 47 | 48 | /** 49 | * @return the name of the handler to use, for config it is called when the value is changed 50 | */ 51 | String handlerName() default ""; 52 | } 53 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/config/ConfigEntryType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.config; 25 | 26 | import java.io.File; 27 | import java.lang.reflect.Field; 28 | import java.net.URI; 29 | import java.net.URL; 30 | 31 | public enum ConfigEntryType { 32 | AUTO { 33 | @Override 34 | public boolean isValidField(Field field) { 35 | return false; 36 | } 37 | }, 38 | CONFIG { 39 | @Override 40 | public boolean isValidField(Field field) { 41 | Class cls = field.getType(); 42 | return cls.isEnum() || (cls.isPrimitive() && cls != char.class) || cls == String.class; 43 | } 44 | }, 45 | SUBMENU { 46 | @Override 47 | public boolean isValidField(Field field) { 48 | Class cls = field.getType(); 49 | return cls != field.getDeclaringClass() && 50 | !cls.getName().startsWith("java.lang."); 51 | } 52 | }, 53 | LINK { 54 | @Override 55 | public boolean isValidField(Field field) { 56 | Class cls = field.getType(); 57 | return cls == String.class || cls == File.class || 58 | cls == URL.class || cls == URI.class || 59 | cls == Void.class || cls == Runnable.class; 60 | } 61 | }; 62 | 63 | public abstract boolean isValidField(Field field); 64 | } -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/config/ConfigMenu.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.config; 25 | 26 | import java.util.List; 27 | 28 | public final class ConfigMenu { 29 | public final String menuName; 30 | public final String menuTranslation; 31 | public final List configKeys; 32 | 33 | public ConfigMenu(String menuName, String menuTranslation, List configKeys) { 34 | this.menuName = menuName; 35 | this.menuTranslation = menuTranslation; 36 | this.configKeys = configKeys; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/config/NoConfigObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.config; 25 | 26 | /** 27 | * Used to tell the config API to ignore this object 28 | */ 29 | public interface NoConfigObject {} 30 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/container/ContainerGuiAuto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.container; 25 | 26 | import net.minecraft.client.gui.GuiContainer; 27 | import net.minecraft.common.block.container.Container; 28 | import net.minecraft.common.block.tileentity.TileEntity; 29 | 30 | import java.lang.annotation.ElementType; 31 | import java.lang.annotation.Retention; 32 | import java.lang.annotation.RetentionPolicy; 33 | import java.lang.annotation.Target; 34 | 35 | /** 36 | * Can be used on {@link Container} to define a {@link GuiContainer} to use. 37 | */ 38 | @Target(ElementType.TYPE) 39 | @Retention(RetentionPolicy.RUNTIME) 40 | public @interface ContainerGuiAuto { 41 | Class value(); 42 | Class tileEntity() default TileEntity.class; 43 | } 44 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/container/ContainerGuiInvoker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.container; 25 | 26 | import net.minecraft.common.block.container.Container; 27 | import net.minecraft.common.world.World; 28 | 29 | public abstract class ContainerGuiInvoker { 30 | public abstract void openContainer(int windowID); 31 | 32 | public void openContainerBlock(int windowID, World world, int x, int y, int z) { 33 | this.openContainer(windowID); 34 | } 35 | 36 | public void openContainerDirect(Container container, World world, int x, int y, int z) { 37 | this.openContainerBlock(container.windowId, world, x, y, z); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/dependencies/DependencyFileInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.dependencies; 25 | 26 | import com.fox2code.foxloader.launcher.FileInfo; 27 | 28 | import java.io.DataInputStream; 29 | import java.io.File; 30 | import java.io.IOException; 31 | 32 | public final class DependencyFileInfo extends FileInfo { 33 | private final DependencyHelper.Dependency dependency; 34 | 35 | public DependencyFileInfo(File file, DependencyHelper.Dependency dependency) throws IOException { 36 | super(file); 37 | this.dependency = dependency; 38 | } 39 | 40 | public DependencyFileInfo(DataInputStream dataInputStream) throws IOException { 41 | super(dataInputStream); 42 | this.dependency = new DependencyHelper.Dependency( 43 | FileInfo.readStringSafest(dataInputStream, null), FileInfo.readStringSafest(dataInputStream, null), 44 | FileInfo.readStringSafest(dataInputStream, null), FileInfo.readStringSafest(dataInputStream, null), 45 | FileInfo.readStringSafest(dataInputStream, null), dataInputStream.readUnsignedShort()); 46 | } 47 | 48 | public DependencyHelper.Dependency getDependency() { 49 | return this.dependency; 50 | } 51 | 52 | @Override 53 | public boolean isJavaArchive() { 54 | return true; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/energy/FoxPowerInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.energy; 25 | 26 | import org.jetbrains.annotations.NotNull; 27 | 28 | public abstract class FoxPowerInterface { 29 | public abstract long getMaxFoxPowerStorage(); 30 | 31 | public abstract long getStoredFoxPower(); 32 | 33 | /** 34 | * @return minimum step of this energy source 35 | */ 36 | public abstract long getFoxPowerStorageStep(); 37 | 38 | /** 39 | * @return maximum energy per tick this interface can provide 40 | */ 41 | public abstract long getFoxPowerStorageMaxOutput(); 42 | 43 | /** 44 | * @return maximum energy per tick this interface can receive 45 | */ 46 | public abstract long getFoxPowerStorageMaxInput(); 47 | 48 | public abstract long drainFoxPower(long amount); 49 | 50 | public abstract long sendFoxPower(long amount); 51 | 52 | /** 53 | * @return sink priority, used by power cables to help with the cable power distribution algorithm, 54 | * should never be greater than {@link FoxPowerUtils#getMaxSinkPriorityValue()}. 55 | */ 56 | public abstract int getCableSinkPriority(); 57 | 58 | @NotNull public abstract FoxPowerType getFoxPowerType(); 59 | } 60 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/energy/FoxPowerInterfaceNone.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.energy; 25 | 26 | import org.jetbrains.annotations.NotNull; 27 | 28 | /** 29 | * Use this if you want to redirect cable to the faces of your blocks, but don't want it to store energy. 30 | *

31 | * Can also be used for optimization purposes. 32 | */ 33 | public final class FoxPowerInterfaceNone extends FoxPowerInterface { 34 | public static final FoxPowerInterfaceNone INSTANCE = new FoxPowerInterfaceNone(); 35 | 36 | private FoxPowerInterfaceNone() {} 37 | 38 | @Override 39 | public long getMaxFoxPowerStorage() { 40 | return 0; 41 | } 42 | 43 | @Override 44 | public long getStoredFoxPower() { 45 | return 0; 46 | } 47 | 48 | @Override 49 | public long getFoxPowerStorageMaxInput() { 50 | return 0; 51 | } 52 | 53 | @Override 54 | public long getFoxPowerStorageMaxOutput() { 55 | return 0; 56 | } 57 | 58 | @Override 59 | public long getFoxPowerStorageStep() { 60 | return 1; 61 | } 62 | 63 | @Override 64 | public long drainFoxPower(long amount) { 65 | return 0; 66 | } 67 | 68 | @Override 69 | public long sendFoxPower(long amount) { 70 | return 0; 71 | } 72 | 73 | @Override 74 | public int getCableSinkPriority() { 75 | return 0; 76 | } 77 | 78 | @Override 79 | public @NotNull FoxPowerType getFoxPowerType() { 80 | return FoxPowerType.NONE; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/energy/FoxPowerItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.energy; 25 | 26 | import net.minecraft.common.item.ItemStack; 27 | import org.jetbrains.annotations.NotNull; 28 | 29 | public interface FoxPowerItem { 30 | long getMaxFoxPowerStorage(ItemStack itemStack); 31 | 32 | long getStoredFoxPower(ItemStack itemStack); 33 | 34 | long getFoxPowerStorageStep(ItemStack itemStack); 35 | 36 | long getFoxPowerStorageMaxOutput(ItemStack itemStack); 37 | 38 | long getFoxPowerStorageMaxInput(ItemStack itemStack); 39 | 40 | long drainFoxPower(ItemStack itemStack, long amount); 41 | 42 | long sendFoxPower(ItemStack itemStack, long amount); 43 | 44 | @NotNull FoxPowerType getFoxPowerType(); 45 | } 46 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/energy/FoxPowerType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.energy; 25 | 26 | /** 27 | * May be used by energy transmitters like energy cables to choose which target to discharge energy first on. 28 | *

29 | * Recommended priority order for discharging into is [RECEIVER, STORAGE, OTHER, TRANSMITTER, PRODUCER, NONE] 30 | *

31 | * Recommended priority order for charging from is [PRODUCER, TRANSMITTER, STORAGE, OTHER, RECEIVER, NONE] 32 | */ 33 | public enum FoxPowerType { 34 | PRODUCER(1), // Generators 35 | RECEIVER(256), // Machinery 36 | STORAGE(128), // Batteries 37 | TRANSMITTER(1), // Energy cables 38 | OTHER(128), // Decorations 39 | NONE(1); // Blocks that redirect cables but don't have energy. 40 | 41 | public final int cableSinkPriorityDefault; 42 | 43 | FoxPowerType(int cableSinkPriorityDefault) { 44 | this.cableSinkPriorityDefault = cableSinkPriorityDefault; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/GlobalTickEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import com.fox2code.foxloader.event.world.WorldTickEvent; 28 | 29 | /** 30 | * Global tick event, only called once per tick and before any {@link WorldTickEvent} 31 | * 32 | * This event is called even if there is no world currently loaded 33 | */ 34 | public final class GlobalTickEvent extends Event { 35 | public static final GlobalTickEvent INSTANCE = new GlobalTickEvent(); 36 | 37 | private GlobalTickEvent() {} 38 | } 39 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/client/CameraAndRenderUpdatedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.client; 25 | 26 | import com.fox2code.foxevents.Event; 27 | 28 | public final class CameraAndRenderUpdatedEvent extends Event { 29 | public static final CameraAndRenderUpdatedEvent INSTANCE = new CameraAndRenderUpdatedEvent(); 30 | 31 | private float deltaTicks; 32 | 33 | private CameraAndRenderUpdatedEvent() {} 34 | 35 | public float getDeltaTicks() { 36 | return this.deltaTicks; 37 | } 38 | 39 | public void callEvent(float deltaTicks) { 40 | this.deltaTicks = deltaTicks; 41 | this.callEvent(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/client/GuiScreenEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.client; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.client.gui.GuiScreen; 28 | 29 | public abstract class GuiScreenEvent extends Event { 30 | private final GuiScreen guiScreen; 31 | 32 | public GuiScreenEvent(GuiScreen guiScreen) { 33 | this.guiScreen = guiScreen; 34 | } 35 | 36 | public GuiScreen getGuiScreen() { 37 | return this.guiScreen; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/client/GuiScreenInitEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.client; 25 | 26 | import net.minecraft.client.gui.GuiElement; 27 | import net.minecraft.client.gui.GuiScreen; 28 | 29 | import java.util.List; 30 | 31 | public final class GuiScreenInitEvent extends GuiScreenEvent { 32 | private final List controlList; 33 | 34 | public GuiScreenInitEvent(GuiScreen guiScreen, List controlList) { 35 | super(guiScreen); 36 | this.controlList = controlList; 37 | } 38 | 39 | public List getControlList() { 40 | return this.controlList; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/client/TexturesRefreshEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.client; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.client.Minecraft; 28 | import net.minecraft.client.renderer.block.ITexturePack; 29 | 30 | public final class TexturesRefreshEvent extends Event { 31 | public static final TexturesRefreshEvent INSTANCE = new TexturesRefreshEvent(); 32 | 33 | private TexturesRefreshEvent() {} 34 | 35 | public ITexturePack getActiveTexturePack() { 36 | return Minecraft.theMinecraft.texturePackList.getSelectedTexturePack(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/client/TexturesRefreshedEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.client; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.client.Minecraft; 28 | import net.minecraft.client.renderer.block.ITexturePack; 29 | 30 | public final class TexturesRefreshedEvent extends Event { 31 | public static final TexturesRefreshedEvent INSTANCE = new TexturesRefreshedEvent(); 32 | 33 | private TexturesRefreshedEvent() {} 34 | 35 | public ITexturePack getActiveTexturePack() { 36 | return Minecraft.theMinecraft.texturePackList.getSelectedTexturePack(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/interaction/PlayerAttackEntityEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.interaction; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import com.fox2code.foxloader.event.player.PlayerEvent; 28 | import net.minecraft.common.entity.Entity; 29 | import net.minecraft.common.entity.player.EntityPlayer; 30 | import net.minecraft.common.item.ItemStack; 31 | import org.jetbrains.annotations.NotNull; 32 | import org.jetbrains.annotations.Nullable; 33 | 34 | public final class PlayerAttackEntityEvent extends PlayerEvent implements Event.Cancellable { 35 | private final ItemStack heldItem; 36 | private final Entity target; 37 | 38 | public PlayerAttackEntityEvent(@NotNull EntityPlayer entityPlayer, @Nullable ItemStack heldItem, @NotNull Entity target) { 39 | super(entityPlayer); 40 | this.heldItem = heldItem; 41 | this.target = target; 42 | } 43 | 44 | @Nullable public ItemStack getHeldItem() { 45 | return this.heldItem; 46 | } 47 | 48 | @NotNull public Entity getTarget() { 49 | return this.target; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/interaction/PlayerBreakBlockEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.interaction; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import com.fox2code.foxloader.event.world.WorldChangeEvent; 28 | import net.minecraft.common.entity.player.EntityPlayer; 29 | import net.minecraft.common.item.ItemStack; 30 | import org.jetbrains.annotations.NotNull; 31 | 32 | @Event.DelegateEvent 33 | public final class PlayerBreakBlockEvent extends WorldChangeEvent.SingleBlockChange implements Event.Cancellable { 34 | private final EntityPlayer entityPlayer; 35 | private final ItemStack heldItem; 36 | 37 | public PlayerBreakBlockEvent(EntityPlayer entityPlayer, int x, int y, int z, ItemStack heldItem) { 38 | super(entityPlayer.worldObj, x, y, z); 39 | this.entityPlayer = entityPlayer; 40 | this.heldItem = heldItem; 41 | } 42 | 43 | @Override 44 | public @NotNull EntityPlayer getEntitySource() { 45 | return this.entityPlayer; 46 | } 47 | 48 | public ItemStack getHeldItem() { 49 | return this.heldItem; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/interaction/PlayerStartBreakBlockEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.interaction; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import com.fox2code.foxloader.event.player.PlayerEvent; 28 | import net.minecraft.common.entity.player.EntityPlayer; 29 | import net.minecraft.common.item.ItemStack; 30 | 31 | /** 32 | * This event is sent when the player start breaking a block, 33 | * the event doesn't edit the world directly, but might edit the world indirectly. 34 | */ 35 | public final class PlayerStartBreakBlockEvent extends PlayerEvent implements Event.Cancellable { 36 | private final int x, y, z, facing; 37 | private final ItemStack heldItem; 38 | 39 | public PlayerStartBreakBlockEvent(EntityPlayer entityPlayer, int x, int y, int z, int facing, ItemStack heldItem) { 40 | super(entityPlayer); 41 | this.x = x; 42 | this.y = y; 43 | this.z = z; 44 | this.facing = facing; 45 | this.heldItem = heldItem; 46 | } 47 | 48 | public int getX() { 49 | return this.x; 50 | } 51 | 52 | public int getY() { 53 | return this.y; 54 | } 55 | 56 | public int getZ() { 57 | return this.z; 58 | } 59 | 60 | public int getFacing() { 61 | return this.facing; 62 | } 63 | 64 | public ItemStack getHeldItem() { 65 | return heldItem; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/interaction/PlayerUseItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.interaction; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import com.fox2code.foxloader.event.player.PlayerEvent; 28 | import net.minecraft.common.entity.player.EntityPlayer; 29 | import net.minecraft.common.item.ItemStack; 30 | import org.jetbrains.annotations.NotNull; 31 | import org.jetbrains.annotations.Nullable; 32 | 33 | @Event.DelegateEvent 34 | public abstract class PlayerUseItem extends PlayerEvent implements Event.Cancellable { 35 | private final ItemStack heldItem; 36 | 37 | public PlayerUseItem(@NotNull EntityPlayer entityPlayer, @Nullable ItemStack heldItem) { 38 | super(entityPlayer); 39 | this.heldItem = heldItem; 40 | } 41 | 42 | @Nullable public final ItemStack getHeldItem() { 43 | return this.heldItem; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/interaction/PlayerUseItemOnAirEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.interaction; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.common.entity.player.EntityPlayer; 28 | import net.minecraft.common.item.ItemStack; 29 | import org.jetbrains.annotations.NotNull; 30 | import org.jetbrains.annotations.Nullable; 31 | 32 | @Event.DelegateEvent 33 | public final class PlayerUseItemOnAirEvent extends PlayerUseItem { 34 | public PlayerUseItemOnAirEvent(@NotNull EntityPlayer entityPlayer, @Nullable ItemStack heldItem) { 35 | super(entityPlayer, heldItem); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/interaction/PlayerUseItemOnEntityEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.interaction; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.common.entity.Entity; 28 | import net.minecraft.common.entity.player.EntityPlayer; 29 | import net.minecraft.common.item.ItemStack; 30 | import org.jetbrains.annotations.NotNull; 31 | import org.jetbrains.annotations.Nullable; 32 | 33 | @Event.DelegateEvent 34 | public final class PlayerUseItemOnEntityEvent extends PlayerUseItem { 35 | private final Entity target; 36 | 37 | public PlayerUseItemOnEntityEvent(@NotNull EntityPlayer entityPlayer, @Nullable ItemStack heldItem,@NotNull Entity target) { 38 | super(entityPlayer, heldItem); 39 | this.target = target; 40 | } 41 | 42 | @NotNull public Entity getTarget() { 43 | return this.target; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/lifecycle/LifecycleEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.lifecycle; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import com.fox2code.foxloader.network.ConnectionType; 28 | 29 | public abstract class LifecycleEvent extends Event { 30 | private final ConnectionType connectionType; 31 | 32 | protected LifecycleEvent(ConnectionType connectionType) { 33 | this.connectionType = connectionType; 34 | } 35 | 36 | public ConnectionType getConnectionType() { 37 | return this.connectionType; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/lifecycle/LifecycleStartEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.lifecycle; 25 | 26 | import com.fox2code.foxloader.network.ConnectionType; 27 | 28 | public final class LifecycleStartEvent extends LifecycleEvent { 29 | public static final LifecycleStartEvent SINGLE_PLAYER = new LifecycleStartEvent(ConnectionType.SINGLE_PLAYER); 30 | public static final LifecycleStartEvent CLIENT_ONLY = new LifecycleStartEvent(ConnectionType.CLIENT_ONLY); 31 | public static final LifecycleStartEvent SERVER_ONLY = new LifecycleStartEvent(ConnectionType.SERVER_ONLY); 32 | 33 | private LifecycleStartEvent(ConnectionType connectionType) { 34 | super(connectionType); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/lifecycle/LifecycleStopEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.lifecycle; 25 | 26 | import com.fox2code.foxloader.network.ConnectionType; 27 | 28 | public final class LifecycleStopEvent extends LifecycleEvent { 29 | public static final LifecycleStopEvent SINGLE_PLAYER = new LifecycleStopEvent(ConnectionType.SINGLE_PLAYER); 30 | public static final LifecycleStopEvent CLIENT_ONLY = new LifecycleStopEvent(ConnectionType.CLIENT_ONLY); 31 | public static final LifecycleStopEvent SERVER_ONLY = new LifecycleStopEvent(ConnectionType.SERVER_ONLY); 32 | 33 | private LifecycleStopEvent(ConnectionType connectionType) { 34 | super(connectionType); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/player/PlayerChatEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.player; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.common.entity.player.EntityPlayer; 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import java.util.Objects; 31 | 32 | public final class PlayerChatEvent extends PlayerEvent implements Event.Cancellable { 33 | private final String chatMessage; 34 | private String formattedMessage; 35 | 36 | public PlayerChatEvent(@NotNull EntityPlayer entityPlayer,@NotNull String chatMessage) { 37 | super(entityPlayer); 38 | this.chatMessage = Objects.requireNonNull(chatMessage, "chatMessage"); 39 | this.formattedMessage = "<" + entityPlayer.username + "> " + chatMessage; 40 | } 41 | 42 | @NotNull public String getChatMessage() { 43 | return this.chatMessage; 44 | } 45 | 46 | @NotNull public String getFormattedMessage() { 47 | return this.formattedMessage; 48 | } 49 | 50 | public void setFormattedMessage(@NotNull String formattedMessage) { 51 | this.formattedMessage = Objects.requireNonNull(formattedMessage, "formattedMessage"); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/player/PlayerEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.player; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.common.entity.player.EntityPlayer; 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import java.util.Objects; 31 | 32 | public abstract class PlayerEvent extends Event { 33 | private final EntityPlayer entityPlayer; 34 | 35 | protected PlayerEvent(@NotNull EntityPlayer entityPlayer) { 36 | this.entityPlayer = Objects.requireNonNull(entityPlayer, "entityPlayer"); 37 | } 38 | 39 | @NotNull public final EntityPlayer getEntityPlayer() { 40 | return this.entityPlayer; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/player/PlayerJoinEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.player; 25 | 26 | import net.minecraft.common.entity.player.EntityPlayer; 27 | import net.minecraft.common.util.ChatColors; 28 | import org.jetbrains.annotations.NotNull; 29 | import org.jetbrains.annotations.Nullable; 30 | 31 | /** 32 | * This event is called when a player join the world. 33 | *

34 | * This event is not cancellable, to kick player on join see {@link com.fox2code.foxloader.event.network.PlayerConnectEvent} 35 | */ 36 | public final class PlayerJoinEvent extends PlayerEvent { 37 | private String joinMessage; 38 | 39 | public PlayerJoinEvent(@NotNull EntityPlayer entityPlayer) { 40 | super(entityPlayer); 41 | this.joinMessage = ChatColors.YELLOW + entityPlayer.username + " joined the game."; 42 | } 43 | 44 | public void setJoinMessage(@Nullable String joinMessage) { 45 | this.joinMessage = joinMessage; 46 | } 47 | 48 | @Nullable public String getJoinMessage() { 49 | return this.joinMessage; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/player/PlayerLeaveEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.player; 25 | 26 | import net.minecraft.common.entity.player.EntityPlayer; 27 | import net.minecraft.common.util.ChatColors; 28 | import org.jetbrains.annotations.NotNull; 29 | import org.jetbrains.annotations.Nullable; 30 | 31 | /** 32 | * This event is called when a player leaves the world. 33 | *

34 | * You can modify the player data during this stage and the changes will be saved on disk 35 | */ 36 | public final class PlayerLeaveEvent extends PlayerEvent { 37 | private String leaveMessage; 38 | 39 | public PlayerLeaveEvent(@NotNull EntityPlayer entityPlayer) { 40 | super(entityPlayer); 41 | this.leaveMessage = ChatColors.YELLOW + entityPlayer.username + " left the game."; 42 | } 43 | 44 | public void setLeaveMessage(@Nullable String leaveMessage) { 45 | this.leaveMessage = leaveMessage; 46 | } 47 | 48 | @Nullable public String getLeaveMessage() { 49 | return this.leaveMessage; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/text/PlayerEditCuneiformBlockEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.text; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.common.entity.player.EntityPlayer; 28 | import net.minecraft.common.world.World; 29 | import org.jetbrains.annotations.NotNull; 30 | import org.jetbrains.annotations.Nullable; 31 | 32 | @Event.DelegateEvent 33 | public final class PlayerEditCuneiformBlockEvent extends PlayerEditTextBlockEvent { 34 | private final String oldBlockText; 35 | private String newBlockText; 36 | private final boolean finish; 37 | 38 | public PlayerEditCuneiformBlockEvent(World world, int x, int y, int z, EntityPlayer entityPlayer, 39 | String oldBlockText, String newBlockText, boolean finish) { 40 | super(world, x, y, z, entityPlayer); 41 | this.oldBlockText = oldBlockText == null ? "" : oldBlockText; 42 | this.newBlockText = newBlockText == null ? "" : newBlockText; 43 | this.finish = finish; 44 | } 45 | 46 | @Override 47 | public @NotNull String getOldBlockText() { 48 | return this.oldBlockText; 49 | } 50 | 51 | @Override 52 | public @NotNull String getNewBlockText() { 53 | return this.newBlockText; 54 | } 55 | 56 | public void setNewBlockText(@Nullable String newBlockText) { 57 | this.newBlockText = newBlockText == null ? 58 | this.oldBlockText : newBlockText; 59 | } 60 | 61 | public boolean isFinish() { 62 | return this.finish; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/world/LiquidFlowIntoBlockEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.world; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.common.block.children.BlockFluid; 28 | import net.minecraft.common.block.fluid.Fluid; 29 | import net.minecraft.common.entity.Entity; 30 | import net.minecraft.common.world.World; 31 | import org.jetbrains.annotations.Nullable; 32 | 33 | @Event.DelegateEvent 34 | public final class LiquidFlowIntoBlockEvent extends WorldChangeEvent.SingleBlockChange implements Event.Cancellable { 35 | private final BlockFluid blockFluid; 36 | private final int metadata; 37 | 38 | public LiquidFlowIntoBlockEvent(World world, int x, int y, int z, BlockFluid blockFluid, int metadata) { 39 | super(world, x, y, z); 40 | this.blockFluid = blockFluid; 41 | this.metadata = metadata; 42 | } 43 | 44 | @Override 45 | public @Nullable Entity getEntitySource() { 46 | return null; 47 | } 48 | 49 | public BlockFluid getBlockFluid() { 50 | return this.blockFluid; 51 | } 52 | 53 | public Fluid getFluid() { 54 | return this.blockFluid.getFluid(); 55 | } 56 | 57 | public int getMetadata() { 58 | return this.metadata; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/world/WorldEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.world; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.common.world.World; 28 | import org.jetbrains.annotations.NotNull; 29 | 30 | import java.util.Objects; 31 | 32 | public abstract class WorldEvent extends Event { 33 | private final World world; 34 | 35 | protected WorldEvent(World world) { 36 | this.world = Objects.requireNonNull(world, "world"); 37 | } 38 | 39 | @NotNull public World getWorld() { 40 | return this.world; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/world/WorldExplosionEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.world; 25 | 26 | import com.fox2code.foxevents.Event; 27 | import net.minecraft.common.entity.Entity; 28 | import net.minecraft.common.world.Explosion; 29 | import org.jetbrains.annotations.NotNull; 30 | import org.jetbrains.annotations.Nullable; 31 | 32 | import java.util.Collection; 33 | 34 | @Event.DelegateEvent 35 | public final class WorldExplosionEvent extends WorldMultiBlockChange { 36 | private final Explosion explosion; 37 | 38 | public WorldExplosionEvent(Explosion explosion, Collection blockChangeList) { 39 | super(explosion.worldObj, blockChangeList); 40 | this.explosion = explosion; 41 | } 42 | 43 | @Override 44 | public @Nullable Entity getEntitySource() { 45 | return this.explosion.exploder; 46 | } 47 | 48 | @NotNull public Explosion getExplosion() { 49 | return this.explosion; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/event/world/WorldTickEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.event.world; 25 | 26 | import net.minecraft.common.world.World; 27 | 28 | /** 29 | * Called when a world is ticking, can be called multiples 30 | * times per tick if multiple worlds are loaded. 31 | */ 32 | public final class WorldTickEvent extends WorldEvent { 33 | public WorldTickEvent(World world) { 34 | super(world); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/installer/InstallerPlatform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.installer; 25 | 26 | enum InstallerPlatform { 27 | DEFAULT(false, false, false), 28 | FULLSCREEN_TEST(true, true, false), 29 | POJAV_LAUNCHER(false, true, true, true, "Pojav"); 30 | 31 | public final boolean fullscreen; 32 | public final boolean fullscreenLayout; 33 | public final boolean specialLauncher; 34 | public final boolean doSilentInstall; 35 | public final String platformName; 36 | 37 | InstallerPlatform(boolean fullscreen, boolean fullscreenLayout, 38 | boolean specialLauncher) { 39 | this(fullscreen, fullscreenLayout, specialLauncher, false, "Minecraft"); 40 | } 41 | 42 | InstallerPlatform(boolean fullscreen, boolean fullscreenLayout, 43 | boolean specialLauncher, boolean doSilentInstall, 44 | String platformName) { 45 | if (fullscreen && !fullscreenLayout) { 46 | throw new IllegalArgumentException("Fullscreen layout required to allow fullscreen frame!"); 47 | } 48 | this.fullscreen = fullscreen; 49 | this.fullscreenLayout = fullscreenLayout; 50 | this.specialLauncher = specialLauncher; 51 | this.doSilentInstall = doSilentInstall; 52 | this.platformName = platformName; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/installer/SelectableTranslatableLabel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.installer; 25 | 26 | import javax.swing.*; 27 | 28 | final class SelectableTranslatableLabel extends JEditorPane { 29 | public SelectableTranslatableLabel(String translationKey) { 30 | this.setContentType("text/plain"); 31 | this.setEditable(false); 32 | this.setBackground(null); 33 | this.setText("Hello world"); 34 | TranslateEngine.installOn(this, translationKey); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/installer/VerticalGridBagLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.installer; 25 | 26 | import java.awt.*; 27 | 28 | final class VerticalGridBagLayout extends GridBagLayout { 29 | public VerticalGridBagLayout() { 30 | this.defaultConstraints.gridy = GridBagConstraints.RELATIVE; 31 | this.defaultConstraints.gridheight = GridBagConstraints.RELATIVE; 32 | this.defaultConstraints.gridwidth = 0; 33 | this.defaultConstraints.fill = GridBagConstraints.HORIZONTAL; 34 | this.defaultConstraints.anchor = GridBagConstraints.NORTH; 35 | this.defaultConstraints.weightx = 1; 36 | this.defaultConstraints.weighty = 1; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/internal/InternalExplosionHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.internal; 25 | 26 | import com.fox2code.foxevents.EventHolder; 27 | import com.fox2code.foxloader.event.world.WorldExplosionEvent; 28 | import com.fox2code.foxloader.event.world.WorldMultiBlockChange; 29 | import net.minecraft.common.world.Explosion; 30 | 31 | import java.util.Collection; 32 | 33 | public final class InternalExplosionHooks { 34 | private static final EventHolder WORLD_EXPLOSION_EVENT = 35 | EventHolder.getHolderFromEvent(WorldExplosionEvent.class); 36 | 37 | private InternalExplosionHooks() {} 38 | 39 | public static boolean onSendExplosionB( 40 | Explosion explosion, Collection changes) { 41 | if (WORLD_EXPLOSION_EVENT.isEmpty() || changes.isEmpty()) return false; 42 | WorldExplosionEvent worldExplosionEvent = new WorldExplosionEvent(explosion, changes); 43 | WORLD_EXPLOSION_EVENT.callEvent(worldExplosionEvent); 44 | changes.removeIf(blockChange -> blockChange.cancelled); 45 | return worldExplosionEvent.isCancelled(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/internal/InternalFluidsHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.internal; 25 | 26 | import com.fox2code.foxevents.EventHolder; 27 | import com.fox2code.foxloader.event.world.LiquidFlowIntoBlockEvent; 28 | import net.minecraft.common.block.children.BlockFluid; 29 | import net.minecraft.common.world.World; 30 | 31 | public final class InternalFluidsHooks { 32 | private static final EventHolder LIQUID_FLOW_INTO_BLOCK_EVENT_EVENT = 33 | EventHolder.getHolderFromEvent(LiquidFlowIntoBlockEvent.class); 34 | 35 | private InternalFluidsHooks() {} 36 | 37 | public static boolean onLiquidFlowIntoBlock( 38 | World world, int x, int y, int z, BlockFluid blockFluid, int metadata) { 39 | if (LIQUID_FLOW_INTO_BLOCK_EVENT_EVENT.isEmpty()) return false; 40 | LiquidFlowIntoBlockEvent liquidFlowIntoBlockEvent = 41 | new LiquidFlowIntoBlockEvent(world, x, y, z, blockFluid, metadata); 42 | LIQUID_FLOW_INTO_BLOCK_EVENT_EVENT.callEvent(liquidFlowIntoBlockEvent); 43 | return liquidFlowIntoBlockEvent.isCancelled(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/internal/InternalRenderHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.internal; 25 | 26 | public final class InternalRenderHooks { 27 | private InternalRenderHooks() {} 28 | } 29 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/internal/InternalScreenHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.internal; 25 | 26 | import com.fox2code.foxevents.EventHolder; 27 | import com.fox2code.foxloader.event.client.GuiItemInfoEvent; 28 | import com.fox2code.foxloader.event.client.GuiScreenInitEvent; 29 | import net.minecraft.client.gui.GuiElement; 30 | import net.minecraft.client.gui.GuiScreen; 31 | import net.minecraft.common.item.ItemStack; 32 | 33 | import java.util.List; 34 | 35 | public final class InternalScreenHooks { 36 | private static final EventHolder GUI_SCREEN_INIT_EVENT = 37 | EventHolder.getHolderFromEvent(GuiScreenInitEvent.class); 38 | private static final EventHolder GUI_ITEM_INFO_EVENT = 39 | EventHolder.getHolderFromEvent(GuiItemInfoEvent.class); 40 | 41 | private InternalScreenHooks() {} 42 | 43 | public static void onGuiScreenInitHook(GuiScreen guiScreen, List controlList) { 44 | if (GUI_SCREEN_INIT_EVENT.isEmpty()) return; 45 | GUI_SCREEN_INIT_EVENT.callEvent(new GuiScreenInitEvent(guiScreen, controlList)); 46 | } 47 | 48 | public static List onGuiGetItemInfoHook(List description, GuiScreen guiScreen, ItemStack itemStack) { 49 | if (GUI_ITEM_INFO_EVENT.isEmpty()) return description; 50 | GuiItemInfoEvent guiItemInfoEvent = new GuiItemInfoEvent(guiScreen, itemStack, description); 51 | GUI_ITEM_INFO_EVENT.callEvent(guiItemInfoEvent); 52 | return guiItemInfoEvent.getDescription(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/launcher/ClassLoaderMarker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.launcher; 25 | 26 | /** 27 | * FoxLoader class loader marker that can be used by compatibility mods 28 | */ 29 | public interface ClassLoaderMarker { 30 | ClassLoader getClassLoader(); 31 | } 32 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/launcher/ClientAndServerMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.launcher; 25 | 26 | import com.fox2code.foxloader.utils.Platform; 27 | 28 | import java.io.File; 29 | import java.lang.management.ManagementFactory; 30 | import java.util.ArrayList; 31 | 32 | public class ClientAndServerMain { 33 | static { 34 | System.setProperty("foxloader.logger-distinguish-side", "true"); 35 | } 36 | 37 | public static void main(String[] args) throws Throwable { 38 | ArrayList command = new ArrayList<>(); 39 | if (Platform.getPlatform() == Platform.WINDOWS) { 40 | command.add(new File(System.getProperty("java.home") + "\\bin\\javaw.exe").getAbsolutePath()); 41 | } else { 42 | command.add(new File(System.getProperty("java.home") + "/bin/java").getAbsolutePath()); 43 | } 44 | command.addAll(ManagementFactory.getRuntimeMXBean().getInputArguments()); 45 | command.add("-Dfoxloader.logger-distinguish-side=true"); 46 | command.add("-cp"); 47 | command.add(System.getProperty("java.class.path")); 48 | command.add("com.fox2code.foxloader.launcher.ServerMain"); 49 | Process serverProcess = new ProcessBuilder(command).inheritIO().start(); 50 | Runtime.getRuntime().addShutdownHook(new Thread(() -> { 51 | if (serverProcess.isAlive()) { 52 | serverProcess.destroy(); 53 | } 54 | }, "Server subprocess killer")); 55 | ClientMain.main(args); 56 | System.exit(serverProcess.waitFor()); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/launcher/ClientMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.launcher; 25 | 26 | public final class ClientMain { 27 | public static void main(String... args) throws Throwable { 28 | if (FoxLauncher.launcherType == LauncherType.UNKNOWN && 29 | FoxLauncher.foxLoaderFile.getParentFile().getName().equals("libraries")) { 30 | FoxLauncher.launcherType = LauncherType.MMC_LIKE; 31 | } 32 | FoxLauncher.initForClientFromArgs(args); 33 | FoxLauncher.runClientWithArgs(args); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/launcher/EnvironmentType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.launcher; 25 | 26 | public enum EnvironmentType { 27 | CLIENT, SERVER; 28 | } 29 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/launcher/LauncherType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.launcher; 25 | 26 | /** 27 | * If you want me to support your custom launcher, please open a new issue! 28 | */ 29 | public enum LauncherType { 30 | /** 31 | * Ex: Server ran via --server 32 | */ 33 | UNKNOWN(false), 34 | /** 35 | * BIN is a special broken case that can happen on MultiMC 36 | * when users lacks the mental capabilities to run a jar file 37 | */ 38 | BIN(false), 39 | /** 40 | * Ex: Dev environment. 41 | */ 42 | GRADLE(false), 43 | /** 44 | * Ex: Vanilla launcher & Pojav launcher 45 | */ 46 | VANILLA_LIKE(false), 47 | /** 48 | * Ex: MultiMC/PolyMC/PrismLauncher 49 | */ 50 | MMC_LIKE(false); 51 | 52 | public final boolean hasAutoFix; 53 | 54 | LauncherType(boolean hasAutoFix) { 55 | this.hasAutoFix = hasAutoFix; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/launcher/ServerMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.launcher; 25 | 26 | public final class ServerMain { 27 | public static void main(String[] args) throws Throwable { 28 | FoxLauncher.initForServer(); 29 | FoxLauncher.runServerWithArgs(args); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/launcher/protocols/fl/Handler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.launcher.protocols.fl; 25 | 26 | import com.fox2code.foxloader.launcher.FileInfo; 27 | import com.fox2code.foxloader.launcher.FoxClassLoader; 28 | 29 | import java.io.IOException; 30 | import java.net.URL; 31 | import java.net.URLConnection; 32 | import java.net.URLStreamHandler; 33 | 34 | public class Handler extends URLStreamHandler { 35 | @Override 36 | protected URLConnection openConnection(URL u) throws IOException { 37 | FileInfo fileInfo = FoxClassLoader.FoxLoaderURLStreamHandler.getFileInfoForJarInJarPath(u.getPath()); 38 | if (fileInfo == null) { 39 | throw new IOException(""); 40 | } 41 | assert fileInfo.source != null; 42 | return fileInfo.source.openConnection(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/loader/ModLoaderOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.loader; 25 | 26 | import com.fox2code.foxloader.config.ConfigEntry; 27 | 28 | public final class ModLoaderOptions { 29 | public static final ModLoaderOptions INSTANCE = new ModLoaderOptions(); 30 | 31 | private ModLoaderOptions() {} 32 | 33 | @ConfigEntry(configComment = "FoxLoader will check for updates when it boot-up") 34 | public boolean checkForUpdates = true; 35 | 36 | @ConfigEntry(configComment = 37 | "Max sink priority value allowed in cables\n" + 38 | "This is effectively the maximum update range for cables.", 39 | lowerBounds = 4, upperBounds = 512) 40 | public int maxSinkPriorityValue = 256; 41 | } 42 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/loader/early/EarlyLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.loader.early; 25 | 26 | import com.fox2code.foxloader.launcher.FoxLauncher; 27 | import net.minecraft.common.CoreConstants; 28 | import net.minecraft.common.util.logging.LogAgent; 29 | 30 | /** 31 | * Initialize a ICoreAccess early to allow game code to work properly during pre-initialization. 32 | */ 33 | public final class EarlyLoader { 34 | static final LogAgent EARLY_LOG_AGENT = new LogAgent("EARLY", null); 35 | private EarlyLoader() { throw new AssertionError(); } 36 | 37 | public static void earlyLoad() { 38 | if (CoreConstants.CORE != null) return; 39 | if (FoxLauncher.isClient()) { 40 | CoreConstants.CORE = new Minecraft(); 41 | } else { 42 | CoreConstants.CORE = new MinecraftServer(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/loader/early/Minecraft.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.loader.early; 25 | 26 | import com.fox2code.foxloader.launcher.FoxLauncher; 27 | import net.minecraft.common.CoreConstants; 28 | import net.minecraft.common.ICoreAccess; 29 | import net.minecraft.common.entity.player.PlayerInteractionHandler; 30 | import net.minecraft.common.util.logging.LogAgent; 31 | 32 | import java.io.File; 33 | 34 | final class Minecraft implements ICoreAccess { 35 | @Override 36 | public File getMinecraftDir() { 37 | return FoxLauncher.getGameDir(); 38 | } 39 | 40 | @Override 41 | public PlayerInteractionHandler getPlayerInteractionHandler() { 42 | throw new IllegalStateException("getPlayerInteractionHandler called too early"); 43 | } 44 | 45 | @Override 46 | public void tickSprint(int i) { 47 | throw new IllegalStateException("tickSprint called too early"); 48 | } 49 | 50 | @Override 51 | public LogAgent getLogger() { 52 | if (CoreConstants.CORE != this) { 53 | return CoreConstants.CORE.getLogger(); 54 | } else { 55 | return EarlyLoader.EARLY_LOG_AGENT; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/loader/early/MinecraftServer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.loader.early; 25 | 26 | import com.fox2code.foxloader.launcher.FoxLauncher; 27 | import net.minecraft.common.CoreConstants; 28 | import net.minecraft.common.ICoreAccess; 29 | import net.minecraft.common.entity.player.PlayerInteractionHandler; 30 | import net.minecraft.common.util.logging.LogAgent; 31 | 32 | import java.io.File; 33 | 34 | final class MinecraftServer implements ICoreAccess { 35 | @Override 36 | public File getMinecraftDir() { 37 | return FoxLauncher.getGameDir(); 38 | } 39 | 40 | @Override 41 | public PlayerInteractionHandler getPlayerInteractionHandler() { 42 | throw new IllegalStateException("getPlayerInteractionHandler called too early"); 43 | } 44 | 45 | @Override 46 | public void tickSprint(int i) { 47 | throw new IllegalStateException("tickSprint called too early"); 48 | } 49 | 50 | @Override 51 | public LogAgent getLogger() { 52 | if (CoreConstants.CORE != this) { 53 | return CoreConstants.CORE.getLogger(); 54 | } else { 55 | return EarlyLoader.EARLY_LOG_AGENT; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/loader/packet/FoxPacket.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.loader.packet; 25 | 26 | import java.io.DataInputStream; 27 | import java.io.DataOutputStream; 28 | import java.io.IOException; 29 | 30 | public abstract class FoxPacket { 31 | public final int id; 32 | // Is packet sent by client? 33 | public final boolean client; 34 | 35 | FoxPacket(int id, boolean client) { 36 | this.id = id; 37 | this.client = client; 38 | } 39 | 40 | public abstract void readData(DataInputStream dataInputStream) throws IOException; 41 | 42 | public abstract void writeData(DataOutputStream dataOutputStream) throws IOException; 43 | } 44 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/loader/packet/ServerHello.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.loader.packet; 25 | 26 | import java.io.DataInputStream; 27 | import java.io.DataOutputStream; 28 | import java.io.IOException; 29 | 30 | public final class ServerHello extends FoxPacket { 31 | private int clientHelloVersion; 32 | 33 | public ServerHello() { 34 | super(0, false); 35 | this.clientHelloVersion = ClientHello.CLIENT_HELLO_VERSION; 36 | } 37 | 38 | public int getClientHelloVersion() { 39 | return this.clientHelloVersion; 40 | } 41 | 42 | @Override 43 | public void readData(DataInputStream dataInputStream) throws IOException { 44 | this.clientHelloVersion = dataInputStream.readInt(); 45 | } 46 | 47 | @Override 48 | public void writeData(DataOutputStream dataOutputStream) throws IOException { 49 | dataOutputStream.writeInt(this.clientHelloVersion); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/network/ConnectionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.network; 25 | 26 | public enum ConnectionType { 27 | SINGLE_PLAYER(true, true), CLIENT_ONLY(true, false), SERVER_ONLY(false, true), NONE(false, false); 28 | 29 | public final boolean isClient, isServer; 30 | 31 | ConnectionType(boolean isClient, boolean isServer) { 32 | this.isClient = isClient; 33 | this.isServer = isServer; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/patching/ClassTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching; 25 | 26 | import com.fox2code.foxloader.launcher.FileInfo; 27 | import org.jetbrains.annotations.NotNull; 28 | import org.jetbrains.annotations.Nullable; 29 | import org.objectweb.asm.Opcodes; 30 | import org.objectweb.asm.tree.ClassNode; 31 | 32 | /** 33 | * Allow to transform the game via ASM as needed, higher priority transformers are run first. 34 | */ 35 | public abstract class ClassTransformer implements Opcodes, Comparable { 36 | public static final int ASM_BUILD = Opcodes.ASM9; 37 | public static final int ACC_COMPUTE_FRAMES = 0x80000; 38 | public final long priority; 39 | final boolean preMixinTransformer; 40 | 41 | public ClassTransformer() { 42 | this(0, false); 43 | } 44 | 45 | public ClassTransformer(long priority) { 46 | this(priority, false); 47 | } 48 | 49 | public ClassTransformer(long priority, boolean preMixinTransformer) { 50 | this.priority = priority; 51 | this.preMixinTransformer = preMixinTransformer; 52 | } 53 | 54 | @Override 55 | public int compareTo(@NotNull ClassTransformer o) { 56 | return Long.compare(o.priority, this.priority); 57 | } 58 | 59 | @Nullable public abstract ClassNode transform(@Nullable FileInfo container,@Nullable ClassNode classNode,@NotNull String className); 60 | } 61 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/patching/FoxClassDowngrader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching; 25 | 26 | import org.jetbrains.annotations.NotNull; 27 | import org.objectweb.asm.ClassWriter; 28 | import org.objectweb.asm.tree.ClassNode; 29 | import xyz.wagyourtail.jvmdg.ClassDowngrader; 30 | import xyz.wagyourtail.jvmdg.cli.Flags; 31 | import xyz.wagyourtail.jvmdg.util.Utils; 32 | 33 | final class FoxClassDowngrader extends ClassDowngrader { 34 | static final FoxClassDowngrader INSTANCE; 35 | 36 | private FoxClassDowngrader(@NotNull Flags flags) { 37 | super(flags); 38 | } 39 | 40 | @Override 41 | public byte[] classNodeToBytes(@NotNull ClassNode node) { 42 | ClassWriter cw = PreLoader.getClassDataProvider().newClassWriter(); 43 | node.accept(cw); 44 | return cw.toByteArray(); 45 | } 46 | 47 | static { 48 | Flags flags = new Flags(); 49 | flags.classVersion = Utils.getCurrentClassVersion(); 50 | INSTANCE = new FoxClassDowngrader(flags); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/patching/mixin/MixinBootstrapService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching.mixin; 25 | 26 | import com.fox2code.foxloader.launcher.FoxLauncher; 27 | import org.spongepowered.asm.service.IMixinServiceBootstrap; 28 | import org.spongepowered.asm.service.ServiceInitialisationException; 29 | 30 | public class MixinBootstrapService implements IMixinServiceBootstrap { 31 | @Override 32 | public String getName() { 33 | return "FoxMixinService"; 34 | } 35 | 36 | @Override 37 | public String getServiceClassName() { 38 | return "com.fox2code.foxloader.loader.mixin.MixinService"; 39 | } 40 | 41 | @Override 42 | public void bootstrap() { 43 | if (FoxLauncher.getFoxClassLoader() != this.getClass().getClassLoader()) { 44 | throw new ServiceInitialisationException(this.getName() + " is not available"); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/patching/mixin/MixinConstraintsExtension.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching.mixin; 25 | 26 | import com.moulberry.mixinconstraints.mixin.MixinTransformer; 27 | import com.moulberry.mixinconstraints.util.MixinHacks; 28 | import com.moulberry.mixinconstraints.util.Pair; 29 | import org.objectweb.asm.tree.ClassNode; 30 | import org.spongepowered.asm.mixin.MixinEnvironment; 31 | import org.spongepowered.asm.mixin.extensibility.IMixinInfo; 32 | import org.spongepowered.asm.mixin.transformer.ext.IExtension; 33 | import org.spongepowered.asm.mixin.transformer.ext.ITargetClassContext; 34 | 35 | class MixinConstraintsExtension implements IExtension { 36 | @Override 37 | public boolean checkActive(MixinEnvironment environment) { 38 | return true; 39 | } 40 | 41 | @Override 42 | @SuppressWarnings("UnstableApiUsage") 43 | public void preApply(ITargetClassContext context) { 44 | for (Pair pair : MixinHacks.getMixinsFor(context)) { 45 | MixinTransformer.transform(pair.first(), pair.second()); 46 | } 47 | } 48 | 49 | @Override 50 | public void postApply(ITargetClassContext context) { 51 | 52 | } 53 | 54 | @Override 55 | public void export(MixinEnvironment env, String name, boolean force, ClassNode classNode) { 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/patching/mixin/MixinConstraintsImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching.mixin; 25 | 26 | import com.fox2code.flexver.FlexVer; 27 | import com.fox2code.foxloader.launcher.FoxLauncher; 28 | import com.fox2code.foxloader.loader.ModContainer; 29 | import com.fox2code.foxloader.loader.ModLoaderInit; 30 | import com.moulberry.mixinconstraints.util.Abstractions; 31 | 32 | public class MixinConstraintsImpl extends Abstractions { 33 | public MixinConstraintsImpl() {} 34 | 35 | @Override 36 | protected boolean isDevEnvironment() { 37 | return FoxLauncher.DEV_MODE || FoxLauncher.DEVELOPING_FOXLOADER; 38 | } 39 | 40 | @Override 41 | protected String getModVersion(String modId) { 42 | ModContainer modContainer = ModLoaderInit.getModContainer(modId); 43 | return modContainer == null ? null : modContainer.getModInfo().version; 44 | } 45 | 46 | @Override 47 | protected boolean isVersionInRange(String version, String min, String max) { 48 | FlexVer versionFlex = FlexVer.parse(version); 49 | FlexVer minFlex = FlexVer.parse(version); 50 | FlexVer maxFlex = FlexVer.parse(version); 51 | return versionFlex.isGreaterOrEqual(minFlex) && 52 | maxFlex.isGreaterOrEqual(versionFlex); 53 | } 54 | 55 | @Override 56 | protected String getPlatformName() { 57 | return "FoxLoader"; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/registry/missing/MissingBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.registry.missing; 25 | 26 | import net.minecraft.common.block.Block; 27 | import net.minecraft.common.block.data.Materials; 28 | import net.minecraft.common.block.sound.StepSounds; 29 | import net.minecraft.common.item.block.ItemBlock; 30 | 31 | public class MissingBlock extends Block { 32 | public MissingBlock(String name) { 33 | super(name, Materials.ROCK); 34 | this.addDescription(new MissingItemDesc()); 35 | this.setBlockUnbreakable(); 36 | this.setResistance(6000000.0F); 37 | this.setSound(StepSounds.SOUND_STONE); 38 | this.disableStats(); 39 | this.hideFromCreativeMenu(); 40 | } 41 | 42 | @Override 43 | protected void allocateTextures() { 44 | super.allocateTextures(); 45 | } 46 | 47 | @Override 48 | protected ItemBlock initializeItemBlock() { 49 | return new MissingItemBlock(this); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/registry/missing/MissingItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.registry.missing; 25 | 26 | import net.minecraft.common.item.Item; 27 | 28 | public class MissingItem extends Item { 29 | public MissingItem(String name) { 30 | super(name); 31 | this.setMaxStackSize(1); 32 | this.addDescription(new MissingItemDesc()); 33 | this.hideFromCreativeMenu(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/registry/missing/MissingItemBlock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.registry.missing; 25 | 26 | import net.minecraft.common.entity.player.EntityPlayer; 27 | import net.minecraft.common.item.block.ItemBlock; 28 | import net.minecraft.common.item.ItemStack; 29 | import net.minecraft.common.world.World; 30 | 31 | public class MissingItemBlock extends ItemBlock { 32 | public MissingItemBlock(MissingBlock block) { 33 | super(block); 34 | this.setMaxStackSize(1); 35 | this.hideFromCreativeMenu(); 36 | } 37 | 38 | @Override 39 | public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, 40 | int x, int y, int z, int facing, float xVec, float yVec, float zVec) { 41 | if (world.isRemote || world.isServer || !player.capabilities.isCreativeMode) { 42 | return false; 43 | } 44 | return super.onItemUse(itemstack, player, world, x, y, z, facing, xVec, yVec, zVec); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/slf4j/FoxSLF4JLoggerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.slf4j; 25 | 26 | import org.slf4j.ILoggerFactory; 27 | import org.slf4j.Logger; 28 | 29 | import java.util.HashMap; 30 | 31 | final class FoxSLF4JLoggerFactory implements ILoggerFactory { 32 | private final HashMap loggers = new HashMap<>(); 33 | 34 | @Override 35 | public Logger getLogger(String name) { 36 | return this.loggers.computeIfAbsent(name, k -> 37 | new FoxSLF4JLogger(java.util.logging.Logger.getLogger(k))); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/slf4j/FoxSLF4JServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.slf4j; 25 | 26 | import org.slf4j.ILoggerFactory; 27 | import org.slf4j.IMarkerFactory; 28 | import org.slf4j.helpers.BasicMarkerFactory; 29 | import org.slf4j.helpers.NOPMDCAdapter; 30 | import org.slf4j.spi.MDCAdapter; 31 | import org.slf4j.spi.SLF4JServiceProvider; 32 | 33 | public final class FoxSLF4JServiceProvider implements SLF4JServiceProvider { 34 | private final ILoggerFactory loggerFactory; 35 | private final IMarkerFactory markerFactory; 36 | private final MDCAdapter mdcAdapter; 37 | 38 | public FoxSLF4JServiceProvider() { 39 | this.loggerFactory = new FoxSLF4JLoggerFactory(); 40 | this.markerFactory = new BasicMarkerFactory(); 41 | this.mdcAdapter = new NOPMDCAdapter(); 42 | } 43 | 44 | @Override 45 | public ILoggerFactory getLoggerFactory() { 46 | return this.loggerFactory; 47 | } 48 | 49 | @Override 50 | public IMarkerFactory getMarkerFactory() { 51 | return this.markerFactory; 52 | } 53 | 54 | @Override 55 | public MDCAdapter getMDCAdapter() { 56 | return this.mdcAdapter; 57 | } 58 | 59 | @Override 60 | public String getRequestedApiVersion() { 61 | return "2.0.99"; 62 | } 63 | 64 | @Override 65 | public void initialize() {} 66 | } 67 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/spark/FoxLoaderSparkCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.spark; 25 | 26 | import net.minecraft.common.command.Command; 27 | import net.minecraft.common.command.ICommandListener; 28 | import net.minecraft.common.command.IllegalCmdListenerOperation; 29 | 30 | abstract class FoxLoaderSparkCommand extends Command { 31 | public FoxLoaderSparkCommand(String name, boolean opOnly) { 32 | super(name, opOnly, false); 33 | } 34 | 35 | public FoxLoaderSparkCommand(String name, boolean opOnly, String... aliases) { 36 | super(name, opOnly, false, aliases); 37 | } 38 | 39 | 40 | @Override 41 | public abstract void onExecute(String[] args, ICommandListener commandExecutor) throws IllegalCmdListenerOperation; 42 | 43 | @Override 44 | public void printHelpInformation(ICommandListener iCommandListener) { 45 | 46 | } 47 | 48 | @Override 49 | public String commandSyntax() { 50 | return "§e" + this.getName(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/spark/FoxLoaderSparkPlatformInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.spark; 25 | 26 | import com.fox2code.foxloader.launcher.BuildConfig; 27 | import com.fox2code.foxloader.loader.ModLoaderInit; 28 | import me.lucko.spark.common.platform.PlatformInfo; 29 | 30 | final class FoxLoaderSparkPlatformInfo implements PlatformInfo { 31 | private final Type type; 32 | 33 | public FoxLoaderSparkPlatformInfo(Type type) { 34 | this.type = type; 35 | } 36 | 37 | @Override 38 | public Type getType() { 39 | return this.type; 40 | } 41 | 42 | @Override 43 | public String getName() { 44 | return "FoxLoader"; 45 | } 46 | 47 | @Override 48 | public String getBrand() { 49 | return ModLoaderInit.getModContainer("foxloader").getModName(); 50 | } 51 | 52 | @Override 53 | public String getVersion() { 54 | return BuildConfig.FOXLOADER_VERSION; 55 | } 56 | 57 | @Override 58 | public String getMinecraftVersion() { 59 | return "ReIndev " + BuildConfig.REINDEV_VERSION; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/spark/FoxLoaderSparkPlayerPingProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.spark; 25 | 26 | import me.lucko.spark.common.monitor.ping.PlayerPingProvider; 27 | import net.minecraft.server.MinecraftServer; 28 | import net.minecraft.server.entity.player.EntityPlayerMP; 29 | 30 | import java.util.Collections; 31 | import java.util.HashMap; 32 | import java.util.List; 33 | import java.util.Map; 34 | 35 | final class FoxLoaderSparkPlayerPingProvider implements PlayerPingProvider { 36 | @Override 37 | public Map poll() { 38 | List networkPlayers = 39 | MinecraftServer.getInstance().configManager.playerEntities; 40 | if (networkPlayers.isEmpty()) return Collections.emptyMap(); 41 | HashMap pings = new HashMap<>(networkPlayers.size()); 42 | for (EntityPlayerMP entityPlayerMP : networkPlayers) { 43 | pings.put(entityPlayerMP.username, entityPlayerMP.ping); 44 | } 45 | return pings; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/spark/FoxLoaderSparkTickHook.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.spark; 25 | 26 | import me.lucko.spark.common.tick.AbstractTickHook; 27 | 28 | final class FoxLoaderSparkTickHook extends AbstractTickHook { 29 | private final FoxLoaderSparkPlugin foxLoaderSparkPlugin; 30 | 31 | public FoxLoaderSparkTickHook(FoxLoaderSparkPlugin foxLoaderSparkPlugin) { 32 | this.foxLoaderSparkPlugin = foxLoaderSparkPlugin; 33 | } 34 | 35 | @Override 36 | public void start() { 37 | this.foxLoaderSparkPlugin.tickHook = this; 38 | } 39 | 40 | @Override 41 | public void close() { 42 | if (this.foxLoaderSparkPlugin.tickHook == this) { 43 | this.foxLoaderSparkPlugin.tickHook = null; 44 | } 45 | } 46 | 47 | void callOnTick() { 48 | super.onTick(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/updater/AbstractUpdater.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.updater; 25 | 26 | import com.fox2code.flexver.FlexVerPredicate; 27 | import com.fox2code.foxloader.launcher.BuildConfig; 28 | import com.fox2code.foxloader.loader.ModContainer; 29 | import org.jetbrains.annotations.Nullable; 30 | 31 | import java.io.IOException; 32 | 33 | public abstract class AbstractUpdater { 34 | public final ModContainer modContainer; 35 | String latestVersion; 36 | boolean updateConsumed; 37 | 38 | protected AbstractUpdater(ModContainer modContainer) { 39 | this.modContainer = modContainer; 40 | } 41 | 42 | @Nullable protected abstract String findLatestVersion() throws IOException; 43 | 44 | protected abstract void doUpdate() throws IOException; 45 | 46 | public final String getLatestVersion() { 47 | return this.latestVersion; 48 | } 49 | 50 | public boolean hasUpdate() { 51 | return this.latestVersion != null && 52 | !this.modContainer.getModInfo().flexver 53 | .isGreaterOrEqual(this.latestVersion); 54 | } 55 | 56 | public boolean canUpdate() { 57 | return this.hasUpdate(); 58 | } 59 | 60 | public static boolean reIndevVersionPatternMismatch(String accept) { 61 | return accept == null || !(accept.equals(BuildConfig.REINDEV_VERSION) || 62 | FlexVerPredicate.parse(accept).match(BuildConfig.REINDEV_VERSION)); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /loader/src/main/java/com/fox2code/foxloader/utils/CustomLogLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.utils; 25 | 26 | import java.util.logging.Level; 27 | 28 | public final class CustomLogLevel extends Level { 29 | public static final Level STDOUT = new CustomLogLevel("STDOUT", 800); 30 | public static final Level STDERR = new CustomLogLevel("STDERR", 1000); 31 | public static final Level TRACE = new CustomLogLevel("TRACE", 300); 32 | public static final Level DEBUG = new CustomLogLevel("DEBUG", 500); 33 | public static final Level ERROR = new CustomLogLevel("ERROR", 1000); 34 | 35 | public CustomLogLevel(String name, int value) { 36 | super(name, value, INFO.getResourceBundleName()); 37 | if (name.length() > 7) { 38 | throw new IllegalArgumentException("Maximum length of a custom log level is 7!"); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /loader/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider: -------------------------------------------------------------------------------- 1 | com.fox2code.foxloader.slf4j.FoxSLF4JServiceProvider -------------------------------------------------------------------------------- /loader/src/main/resources/META-INF/services/org.spongepowered.asm.service.IGlobalPropertyService: -------------------------------------------------------------------------------- 1 | com.fox2code.foxloader.patching.mixin.MixinPropertyService 2 | -------------------------------------------------------------------------------- /loader/src/main/resources/META-INF/services/org.spongepowered.asm.service.IMixinService: -------------------------------------------------------------------------------- 1 | com.fox2code.foxloader.patching.mixin.MixinService 2 | -------------------------------------------------------------------------------- /loader/src/main/resources/META-INF/services/org.spongepowered.asm.service.IMixinServiceBootstrap: -------------------------------------------------------------------------------- 1 | com.fox2code.foxloader.patching.mixin.MixinBootstrapService 2 | -------------------------------------------------------------------------------- /loader/src/main/resources/assets/foxloader/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fox2Code/FoxLoader/96f6ef97d5194e203a686e7d273b7f40675f63f3/loader/src/main/resources/assets/foxloader/icon.png -------------------------------------------------------------------------------- /loader/src/main/resources/assets/foxloader/textures/blocks/block_missing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fox2Code/FoxLoader/96f6ef97d5194e203a686e7d273b7f40675f63f3/loader/src/main/resources/assets/foxloader/textures/blocks/block_missing.png -------------------------------------------------------------------------------- /loader/src/main/resources/assets/foxloader/textures/gui/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fox2Code/FoxLoader/96f6ef97d5194e203a686e7d273b7f40675f63f3/loader/src/main/resources/assets/foxloader/textures/gui/icons.png -------------------------------------------------------------------------------- /loader/src/main/resources/assets/foxloader/textures/items/item_missing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fox2Code/FoxLoader/96f6ef97d5194e203a686e7d273b7f40675f63f3/loader/src/main/resources/assets/foxloader/textures/items/item_missing.png -------------------------------------------------------------------------------- /loader/src/main/resources/mmc/instance.cfg: -------------------------------------------------------------------------------- 1 | [General] 2 | InstanceType=OneSix 3 | LogPrePostOutput=true 4 | JoinServerOnLaunch=false 5 | IgnoreJavaCompatibility=true 6 | OverrideCommands=false 7 | OverrideConsole=false 8 | OverrideGameTime=false 9 | OverrideJavaArgs=true 10 | OverrideJavaLocation=false 11 | OverrideMemory=false 12 | OverrideMiscellaneous=false 13 | OverrideNativeWorkarounds=false 14 | OverridePerformance=false 15 | OverrideWindow=false 16 | ShowConsoleOnError=true 17 | iconKey=fox 18 | name=FoxLoader #foxloader_version# 19 | JvmArgs=#jvm_args# 20 | notes=#version# 21 | -------------------------------------------------------------------------------- /loader/src/main/resources/mmc/mmc-pack.json: -------------------------------------------------------------------------------- 1 | { 2 | "components": [ 3 | { 4 | "cachedName": "LWJGL 2", 5 | "cachedVersion": "2.9.4+legacyfabric.9", 6 | "cachedVolatile": true, 7 | "dependencyOnly": true, 8 | "uid": "org.lwjgl", 9 | "version": "2.9.4-nightly-20150209" 10 | }, 11 | { 12 | "cachedName": "FoxLoader", 13 | "cachedRequires": [ 14 | { 15 | "suggests": "2.9.4-nightly-20150209", 16 | "uid": "org.lwjgl" 17 | } 18 | ], 19 | "cachedVersion": "#version#", 20 | "important": true, 21 | "uid": "com.fox2code.foxloader", 22 | "version": "#version#" 23 | }, 24 | { 25 | "cachedName": "Workaround to prevent MultiMC Crash", 26 | "cachedRequires": [ 27 | { 28 | "uid": "com.fox2code.foxloader" 29 | } 30 | ], 31 | "cachedVersion": "no-op", 32 | "disabled": true, 33 | "uid": "net.minecraft", 34 | "version": "no-op" 35 | }, 36 | { 37 | "cachedName": "Workaround to display CoreMods tab", 38 | "cachedRequires": [ 39 | { 40 | "uid": "com.fox2code.foxloader" 41 | } 42 | ], 43 | "cachedVersion": "no-op", 44 | "disabled": true, 45 | "uid": "net.minecraftforge", 46 | "version": "no-op" 47 | } 48 | ], 49 | "formatVersion": 1 50 | } 51 | -------------------------------------------------------------------------------- /loader/src/main/resources/mmc/patches/com.fox2code.foxloader.json: -------------------------------------------------------------------------------- 1 | { 2 | "+traits": [ 3 | "texturepacks", 4 | "noapplet" 5 | ], 6 | "assetIndex": { 7 | "id": "pre-1.6", 8 | "sha1": "3d8e55480977e32acd9844e545177e69a52f594b", 9 | "size": 74091, 10 | "totalSize": 49505710, 11 | "url": "https://piston-meta.mojang.com/v1/packages/3d8e55480977e32acd9844e545177e69a52f594b/pre-1.6.json" 12 | }, 13 | "compatibleJavaMajors": [ 14 | 8, 15 | 11, 16 | 16, 17 | 17, 18 | 18, 19 | 19, 20 | 20, 21 | 21, 22 | 22, 23 | 23 24 | ], 25 | "formatVersion": 1, 26 | "mainJar": { 27 | "MMC-displayname": "foxloader-#foxloader_version#", 28 | "MMC-hint": "local", 29 | "name": "custom:foxloader:#foxloader_version#" 30 | }, 31 | "name": "FoxLoader", 32 | "requires": [ 33 | { 34 | "suggests": "2.9.4-nightly-20150209", 35 | "uid": "org.lwjgl" 36 | } 37 | ], 38 | "mainClass": "com.fox2code.foxloader.launcher.ClientMain", 39 | "minecraftArguments": "${auth_player_name} ${auth_access_token} --gameDir ${game_directory}", 40 | "type": "old_beta", 41 | "uid": "com.fox2code.foxloader", 42 | "version": "#version#" 43 | } 44 | -------------------------------------------------------------------------------- /loader/src/main/resources/mmc/patches/net.minecraft.json: -------------------------------------------------------------------------------- 1 | { 2 | "formatVersion": 1, 3 | "name": "Workaround to prevent MultiMC Crash", 4 | "releaseTime": "2011-07-08T00:00:00+02:00", 5 | "requires": [ 6 | { 7 | "uid": "com.fox2code.foxloader" 8 | } 9 | ], 10 | "type": "old_beta", 11 | "uid": "net.minecraft", 12 | "version": "no-op" 13 | } -------------------------------------------------------------------------------- /loader/src/main/resources/mmc/patches/net.minecraftforge.json: -------------------------------------------------------------------------------- 1 | { 2 | "formatVersion": 1, 3 | "name": "Workaround to display CoreMods tab", 4 | "releaseTime": "2011-07-08T00:00:00+02:00", 5 | "requires": [ 6 | { 7 | "uid": "com.fox2code.foxloader" 8 | } 9 | ], 10 | "type": "old_beta", 11 | "uid": "net.minecraftforge", 12 | "version": "no-op" 13 | } -------------------------------------------------------------------------------- /patching/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | final String ASM_VERSION = project['asm.version'] 3 | api "org.ow2.asm:asm-util:${ASM_VERSION}" 4 | api "org.ow2.asm:asm-commons:${ASM_VERSION}" 5 | api 'org.jetbrains:annotations:24.1.0' 6 | //noinspection GradlePackageUpdate 7 | compileOnly("org.lwjgl.lwjgl:lwjgl:2.9.3") 8 | } 9 | 10 | jar { 11 | from(project.rootProject.rootDir) { 12 | include("LICENSE") 13 | } 14 | } 15 | 16 | File slimFile = new File(project.rootProject.rootDir, "loader" + File.separator + 17 | "libs" + File.separator + project['reindev.slimJar']) 18 | File patchedFile = new File(project.rootProject.rootDir, "loader" + File.separator + 19 | "patched" + File.separator + (project['reindev.patchedJar'] as String)) 20 | File unpickedFile = new File(project.rootProject.rootDir, "loader" + File.separator + 21 | "patched" + File.separator + (project['reindev.patchedJar'] as String).replace(".jar", "-unpicked.jar")) 22 | 23 | tasks.register("patchGame", JavaExec) { 24 | classpath = sourceSets.main.runtimeClasspath 25 | mainClass = "com.fox2code.foxloader.patching.PatchBridge" 26 | args = [slimFile.getAbsolutePath(), patchedFile.getAbsolutePath(), "dev"] 27 | } 28 | 29 | tasks.register("unpickGame", JavaExec) { 30 | classpath = sourceSets.main.runtimeClasspath 31 | mainClass = "com.fox2code.foxloader.patching.PatchBridge" 32 | args = [patchedFile.getAbsolutePath(), unpickedFile.getAbsolutePath(), "true"] 33 | dependsOn(tasks.patchGame) 34 | } 35 | 36 | // Generated code is in another script to make code cleaner. 37 | apply from: "generate.gradle" -------------------------------------------------------------------------------- /patching/src/main/java/com/fox2code/foxloader/patching/PatchBridge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching; 25 | 26 | import com.fox2code.foxloader.patching.dev.DevelopmentSourcePatcher; 27 | import com.fox2code.foxloader.patching.game.GamePatches; 28 | 29 | import java.io.File; 30 | import java.io.IOException; 31 | 32 | // Implementation used by FoxLoaderInvoker 33 | public final class PatchBridge { 34 | public static void main(String[] args) throws IOException { 35 | if (args.length != 3) { 36 | System.out.println("Usage: "); 37 | System.exit(1); 38 | return; 39 | } 40 | File input = new File(args[0]).getAbsoluteFile(); 41 | File output = new File(args[1]).getAbsoluteFile(); 42 | if ("dev".equals(args[2])) { 43 | GamePatches.patchSlimJarDev(input, output); 44 | return; 45 | } 46 | boolean unpick = Boolean.parseBoolean(args[2]); 47 | PatchBridge.patch(input, output, unpick); 48 | } 49 | 50 | public static void patch(File input, File output, boolean unpick) throws IOException { 51 | if (unpick) { 52 | DevelopmentSourcePatcher.unpickPatchedJar(input, output); 53 | } else { 54 | GamePatches.patchSlimJar(input, output); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /patching/src/main/java/com/fox2code/foxloader/patching/PatchConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching; 25 | 26 | public final class PatchConstants { 27 | // Updated when a new game version is out 28 | public static final int ORIGINAL_BLOCK_LIMIT = 1050; 29 | public static final int MODIFIED_BLOCK_LIMIT = 6144; 30 | public static final int INITIAL_BLOCK_ID = 2048; 31 | public static final int BLOCK_ID_DIFF = 2048; 32 | public static final int MAXIMUM_ITEM_ID = 16384; // Hard max: 31999 33 | } 34 | -------------------------------------------------------------------------------- /patching/src/main/java/com/fox2code/foxloader/patching/game/GamePatch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching.game; 25 | 26 | import com.fox2code.foxloader.patching.TransformerUtils; 27 | import org.objectweb.asm.Opcodes; 28 | import org.objectweb.asm.tree.ClassNode; 29 | 30 | /** 31 | * GamePatch that are registered at {@link GamePatches} 32 | */ 33 | abstract class GamePatch implements Opcodes { 34 | static final Void ALL_CLASSES = null; 35 | public static final String LAMBDA_ARGS = "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"; 36 | public static final String String = "java/lang/String"; 37 | public static final String StringBuilder = "java/lang/StringBuilder"; 38 | public static final String Collection = "java/util/Collection"; 39 | public static final String Set = "java/util/Set"; 40 | public static final int ASM_API = TransformerUtils.ASM_BUILD; 41 | final String[] targets; 42 | 43 | protected GamePatch(Void ignored) { 44 | this.targets = null; 45 | } 46 | 47 | protected GamePatch(String target) { 48 | this.targets = target == null ? null : new String[]{target}; 49 | } 50 | 51 | protected GamePatch(String[] targets) { 52 | this.targets = targets == null || targets.length == 0 ? null : targets; 53 | } 54 | 55 | private void checkAccess() { 56 | 57 | } 58 | 59 | public abstract ClassNode transform(ClassNode classNode); 60 | } 61 | -------------------------------------------------------------------------------- /patching/src/main/java/com/fox2code/foxloader/patching/game/TileEntityPatch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching.game; 25 | 26 | import com.fox2code.foxloader.patching.TransformerUtils; 27 | import org.objectweb.asm.tree.ClassNode; 28 | import org.objectweb.asm.tree.MethodNode; 29 | 30 | final class TileEntityPatch extends GamePatch { 31 | private static final String TileEntity = "net/minecraft/common/block/tileentity/TileEntity"; 32 | 33 | TileEntityPatch() { 34 | super(new String[]{TileEntity}); 35 | } 36 | 37 | @Override 38 | public ClassNode transform(ClassNode classNode) { 39 | if (TileEntity.equals(classNode.name)) { 40 | patchTileEntity(classNode); 41 | } 42 | return classNode; 43 | } 44 | 45 | private static void patchTileEntity(ClassNode classNode) { 46 | MethodNode addMapping = TransformerUtils.getMethod(classNode, "addMapping"); 47 | addMapping.access &= ~(ACC_PRIVATE | ACC_PROTECTED); 48 | addMapping.access |= ACC_PUBLIC; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /patching/src/main/java/com/fox2code/foxloader/utils/EmptyArrays.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.utils; 25 | 26 | public final class EmptyArrays { 27 | private EmptyArrays() { throw new AssertionError(); } 28 | 29 | public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; 30 | public static final String[] EMPTY_STRING_ARRAY = new String[0]; 31 | public static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; 32 | } 33 | -------------------------------------------------------------------------------- /patching/src/main/java/com/fox2code/foxloader/utils/SourceUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.utils; 25 | 26 | import java.io.File; 27 | import java.net.URISyntaxException; 28 | import java.security.CodeSource; 29 | 30 | public class SourceUtil { 31 | private SourceUtil() {} 32 | public static File getSourceFile(Class cls) { 33 | CodeSource codeSource = cls.getProtectionDomain().getCodeSource(); 34 | if (codeSource instanceof CodeSourceFileProvider) { 35 | return ((CodeSourceFileProvider) codeSource).getFile(); 36 | } 37 | try { 38 | return new File(codeSource.getLocation().toURI().getPath()).getAbsoluteFile(); 39 | } catch (URISyntaxException e) { 40 | throw new RuntimeException(e); 41 | } 42 | } 43 | 44 | public static File getSourceFileOfClassName(String cls) { 45 | try { 46 | return getSourceFile(Class.forName(cls, false, Thread.currentThread().getContextClassLoader())); 47 | } catch (ClassNotFoundException e) { 48 | return null; 49 | } 50 | } 51 | 52 | public interface CodeSourceFileProvider { 53 | File getFile(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /patching/src/main/java/com/fox2code/foxloader/utils/io/JarUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.utils.io; 25 | 26 | import java.io.BufferedInputStream; 27 | import java.io.File; 28 | import java.io.IOException; 29 | import java.net.URL; 30 | import java.util.jar.JarFile; 31 | import java.util.jar.Manifest; 32 | import java.util.zip.ZipEntry; 33 | import java.util.zip.ZipInputStream; 34 | 35 | public class JarUtils { 36 | public static Manifest getManifest(File file, String jarPath) throws IOException { 37 | Manifest manifest; 38 | if (jarPath == null) { 39 | try (JarFile jarFile = new JarFile(file)) { 40 | manifest = jarFile.getManifest(); 41 | } 42 | } else { 43 | manifest = new Manifest(); 44 | try (ZipInputStream zipInputStream = new ZipInputStream(new BufferedInputStream( 45 | new URL("jar:" + file.toURI().toURL() +"!/" + jarPath).openStream()))) { 46 | ZipEntry zipEntry; 47 | while ((zipEntry = zipInputStream.getNextEntry()) != null) { 48 | if ("META-INF/MANIFEST.MF".equals(zipEntry.getName())) { 49 | manifest.read(zipInputStream); 50 | break; 51 | } 52 | } 53 | } 54 | } 55 | return manifest; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /patching/src/main/java/com/fox2code/foxloader/utils/io/URLUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.utils.io; 25 | 26 | import org.jetbrains.annotations.Nullable; 27 | 28 | import java.net.MalformedURLException; 29 | import java.net.URISyntaxException; 30 | import java.net.URL; 31 | 32 | public class URLUtils { 33 | public static boolean isValidURL(@Nullable String url) { 34 | if (url == null || url.isEmpty()) { 35 | return false; 36 | } 37 | try { 38 | new URL(url).toURI(); 39 | return true; 40 | } catch (MalformedURLException | URISyntaxException e) { 41 | return false; 42 | } 43 | } 44 | 45 | public static boolean isValidHttpURL(@Nullable String url) { 46 | if (url == null || url.isEmpty()) { 47 | return false; 48 | } 49 | try { 50 | String protocol = (new URL(url)).toURI().getScheme(); 51 | return "http".equals(protocol) || "https".equals(protocol); 52 | } catch (URISyntaxException | MalformedURLException var2) { 53 | return false; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/DigiCert-Global-Root-CA.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh 3 | MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 4 | d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD 5 | QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT 6 | MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j 7 | b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG 8 | 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB 9 | CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 10 | nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt 11 | 43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P 12 | T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 13 | gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO 14 | BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR 15 | TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw 16 | DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr 17 | hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg 18 | 06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF 19 | PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls 20 | YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk 21 | CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= 22 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/DigiCert-Global-Root-G2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh 3 | MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 4 | d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH 5 | MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT 6 | MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j 7 | b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG 8 | 9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI 9 | 2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx 10 | 1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ 11 | q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz 12 | tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ 13 | vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP 14 | BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV 15 | 5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY 16 | 1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 17 | NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG 18 | Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 19 | 8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe 20 | pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl 21 | MrY= 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/DigiCert-Global-Root-G3.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw 3 | CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu 4 | ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe 5 | Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw 6 | EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x 7 | IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF 8 | K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG 9 | fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO 10 | Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd 11 | BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx 12 | AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/ 13 | oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 14 | sycX 15 | -----END CERTIFICATE----- 16 | -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/GTS-Root-R1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFVzCCAz+gAwIBAgINAgPlk28xsBNJiGuiFzANBgkqhkiG9w0BAQwFADBHMQsw 3 | CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU 4 | MBIGA1UEAxMLR1RTIFJvb3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw 5 | MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp 6 | Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUA 7 | A4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx9vaMf/vo 8 | 27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7w 9 | Cl7raKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjw 10 | TcLCeoiKu7rPWRnWr4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0Pfybl 11 | qAj+lug8aJRT7oM6iCsVlgmy4HqMLnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaH 12 | szVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly4cpk9+aCEI3oncKKiPo4Zor8 13 | Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr06zqkUspzBmk 14 | MiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92 15 | wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70p 16 | aDPvOmbsB4om3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrN 17 | VjzRlwW5y0vtOUucxD/SVRNuJLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQID 18 | AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E 19 | FgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEMBQADggIBAJ+qQibb 20 | C5u+/x6Wki4+omVKapi6Ist9wTrYggoGxval3sBOh2Z5ofmmWJyq+bXmYOfg6LEe 21 | QkEzCzc9zolwFcq1JKjPa7XSQCGYzyI0zzvFIoTgxQ6KfF2I5DUkzps+GlQebtuy 22 | h6f88/qBVRRiClmpIgUxPoLW7ttXNLwzldMXG+gnoot7TiYaelpkttGsN/H9oPM4 23 | 7HLwEXWdyzRSjeZ2axfG34arJ45JK3VmgRAhpuo+9K4l/3wV3s6MJT/KYnAK9y8J 24 | ZgfIPxz88NtFMN9iiMG1D53Dn0reWVlHxYciNuaCp+0KueIHoI17eko8cdLiA6Ef 25 | MgfdG+RCzgwARWGAtQsgWSl4vflVy2PFPEz0tv/bal8xa5meLMFrUKTX5hgUvYU/ 26 | Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT 27 | 6u9AWpQKXCBfTkBdYiJ23//OYb2MI3jSNwLgjt7RETeJ9r/tSQdirpLsQBqvFAnZ 28 | 0E6yove+7u7Y/9waLd64NnHi/Hm3lCXRSHNboTXns5lndcEZOitHTtNCjv0xyBZm 29 | 2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb 30 | bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c 31 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/GTS-Root-R2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFVzCCAz+gAwIBAgINAgPlrsWNBCUaqxElqjANBgkqhkiG9w0BAQwFADBHMQsw 3 | CQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEU 4 | MBIGA1UEAxMLR1RTIFJvb3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAw 5 | MDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZp 6 | Y2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUA 7 | A4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTukk3LvCvpt 8 | nfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY 9 | 6Dlo7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAu 10 | MC6C/Pq8tBcKSOWIm8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7k 11 | RXuJVfeKH2JShBKzwkCX44ofR5GmdFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWg 12 | f9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbuak7MkogwTZq9TwtImoS1mKPV 13 | +3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscszcTJGr61K8Yzo 14 | dDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW 15 | Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKa 16 | G73VululycslaVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCq 17 | gc7dGtxRcw1PcOnlthYhGXmy5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwID 18 | AQABo0IwQDAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E 19 | FgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEMBQADggIBAB/Kzt3H 20 | vqGf2SdMC9wXmBFqiN495nFWcrKeGk6c1SuYJF2ba3uwM4IJvd8lRuqYnrYb/oM8 21 | 0mJhwQTtzuDFycgTE1XnqGOtjHsB/ncw4c5omwX4Eu55MaBBRTUoCnGkJE+M3DyC 22 | B19m3H0Q/gxhswWV7uGugQ+o+MePTagjAiZrHYNSVc61LwDKgEDg4XSsYPWHgJ2u 23 | NmSRXbBoGOqKYcl3qJfEycel/FVL8/B/uWU9J2jQzGv6U53hkRrJXRqWbTKH7QMg 24 | yALOWr7Z6v2yTcQvG99fevX4i8buMTolUVVnjWQye+mew4K6Ki3pHrTgSAai/Gev 25 | HyICc/sgCq+dVEuhzf9gR7A/Xe8bVr2XIZYtCtFenTgCR2y59PYjJbigapordwj6 26 | xLEokCZYCDzifqrXPW+6MYgKBesntaFJ7qBFVHvmJ2WZICGoo7z7GJa7Um8M7YNR 27 | TOlZ4iBgxcJlkoKM8xAfDoqXvneCbT+PHV28SSe9zE8P4c52hgQjxcCMElv924Sg 28 | JPFI/2R80L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV 29 | 7LXTWtiBmelDGDfrs7vRWGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl 30 | 6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjWHYbL 31 | -----END CERTIFICATE----- 32 | -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/GTS-Root-R3.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICCTCCAY6gAwIBAgINAgPluILrIPglJ209ZjAKBggqhkjOPQQDAzBHMQswCQYD 3 | VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG 4 | A1UEAxMLR1RTIFJvb3QgUjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw 5 | WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz 6 | IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNi 7 | AAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUURout736G 8 | jOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL2 9 | 4CejQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW 10 | BBTB8Sa6oC2uhYHP0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEA9uEglRR7 11 | VKOQFhG/hMjqb2sXnh5GmCCbn9MN2azTL818+FsuVbu/3ZL3pAzcMeGiAjEA/Jdm 12 | ZuVDFhOD3cffL74UOO0BzrEXGhF16b0DjyZ+hOXJYKaV11RZt+cRLInUue4X 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/GTS-Root-R4.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYD 3 | VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG 4 | A1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw 5 | WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz 6 | IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi 7 | AATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzuhXyi 8 | QHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvR 9 | HYqjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW 10 | BBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D 11 | 9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/Cr8deVl5c1RxYIigL9zC2L7F8AjEA8GE8 12 | p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD 13 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/ISRG-Root-X1.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw 3 | TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh 4 | cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 5 | WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu 6 | ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY 7 | MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc 8 | h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ 9 | 0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U 10 | A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW 11 | T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH 12 | B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC 13 | B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv 14 | KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn 15 | OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn 16 | jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw 17 | qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI 18 | rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV 19 | HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq 20 | hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL 21 | ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ 22 | 3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK 23 | NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 24 | ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur 25 | TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC 26 | jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc 27 | oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq 28 | 4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA 29 | mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d 30 | emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= 31 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/ISRG-Root-X2.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw 3 | CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg 4 | R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00 5 | MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT 6 | ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw 7 | EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW 8 | +1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9 9 | ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T 10 | AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI 11 | zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW 12 | tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1 13 | /q4AaOeMSQ+2b1tbFfLn 14 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /patching/src/main/resources/assets/foxloader/certificates/USERTrust-ECC-Certification-Authority.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDEL 3 | MAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl 4 | eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMT 5 | JVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTAwMjAx 6 | MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT 7 | Ck5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVUaGUg 8 | VVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlm 9 | aWNhdGlvbiBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqflo 10 | I+d61SRvU8Za2EurxtW20eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinng 11 | o4N+LZfQYcTxmdwlkWOrfzCjtHDix6EznPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0G 12 | A1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNVHQ8BAf8EBAMCAQYwDwYD 13 | VR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBBHU6+4WMB 14 | zzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbW 15 | RNZu9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg= 16 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /patching/src/test/java/com/fox2code/foxloader/patching/test/OpcodesUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching.test; 25 | 26 | import com.fox2code.foxloader.patching.OpcodesUtils; 27 | import org.junit.jupiter.api.Assertions; 28 | import org.junit.jupiter.api.Test; 29 | import org.objectweb.asm.Opcodes; 30 | import org.objectweb.asm.tree.MethodInsnNode; 31 | 32 | public class OpcodesUtilsTest { 33 | @Test 34 | public void testOpcodesUtilsOnInvokeVirtual() { 35 | MethodInsnNode methodInsnNode = new MethodInsnNode(Opcodes.INVOKEVIRTUAL, 36 | "MethodObject", "convertIntToByte", "(I)B", false); 37 | Assertions.assertEquals(2, OpcodesUtils.getStackConsume(methodInsnNode)); 38 | Assertions.assertEquals(1, OpcodesUtils.getStackProduce(methodInsnNode)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /patching/src/test/java/com/fox2code/foxloader/patching/test/URLUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023-2025 Fox2Code 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | package com.fox2code.foxloader.patching.test; 25 | 26 | import com.fox2code.foxloader.utils.io.URLUtils; 27 | import org.junit.jupiter.api.Assertions; 28 | import org.junit.jupiter.api.Test; 29 | 30 | public class URLUtilsTest { 31 | @Test 32 | public void testIsValidURL() { 33 | Assertions.assertTrue(URLUtils.isValidURL("https://github.com/Fox2Code/FoxLoader")); 34 | } 35 | 36 | @Test 37 | public void testIsValidHttpURL() { 38 | Assertions.assertTrue(URLUtils.isValidHttpURL("https://github.com/Fox2Code/FoxLoader")); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'FoxLoader' 2 | include 'patching' 3 | include 'loader' 4 | include 'dev' 5 | --------------------------------------------------------------------------------