-
-
Notifications
You must be signed in to change notification settings - Fork 713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NeoForge Platform Support #3781
Merged
Merged
Changes from 47 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
7d8b623
Initial work on Forge platform
Redned235 6f20d72
Rework modded platforms to use a common module
Redned235 3c7730e
Merge branch 'master' into feature/forge-platform
Redned235 e2e9c92
Add support for integrated worlds on modded platforms
Redned235 c94df50
Merge branch 'master' into feature/forge-platform
Redned235 4f1ca3d
Fix classload errors and move mixins to shared module
Redned235 e4a62bd
Fix Fabric mixins and check min height in mod world manager
Redned235 65dd8c1
Add Forge command support
Redned235 9020b5e
Add back modrinth publishing
Redned235 56ad80c
Don't apply application plugin to shared mod sources
Redned235 bc38c2f
Fix docs
Redned235 1d26194
Delete unused class
Redned235 2dabe46
Clean up repositories
Redned235 1e025b6
Merge remote-tracking branch 'upstream/master' into feature/forge-pla…
onebeastchris 6f01dff
- Update to 1.20.2
onebeastchris e584c18
- Fix ClassNotFound errors on Forge due to weird Classloader
onebeastchris 31deca9
Merge pull request #4261 from onebeastchris/feature/forge-platform
onebeastchris da5a7bc
Merge remote-tracking branch 'upstream/master' into feature/forge-pla…
onebeastchris 91bf88d
merge upstream
onebeastchris dc292b5
oh no
onebeastchris 8594ee1
Bump lombok, architectury-loom
onebeastchris 071ee2a
Merge remote-tracking branch 'upstream/master' into feature/forge-pla…
onebeastchris 0b6f558
init: neoforge 1.20.4 support
onebeastchris f4f49cd
NeoForge builds
Kas-tle fbbfa96
Archive neoforge artifacts
Kas-tle 3726b27
Merge pull request #13 from Kas-tle/feature/neoforge
onebeastchris 8ee9c45
transformForge -> transformNeoForge
onebeastchris 178a886
Merge remote-tracking branch 'upstream/master' into feature/forge-pla…
onebeastchris afacada
Neoforge boots!
onebeastchris b9ab9fe
more fixes
onebeastchris a5883bc
Merge remote-tracking branch 'upstream/feature/forge-platform' into f…
onebeastchris 1d3914f
yeet platform executor
onebeastchris 6ab0e7e
yet another temp branch to figure out the runServer task
onebeastchris f640f97
yeet transitive dependency, that cant be right
onebeastchris 7d4a69f
Attempt at getting the runServer task to work, part two
onebeastchris 96c4731
Revert the changes for the runServer task, try and shut down the inje…
onebeastchris e94ef30
Remove spigot weird bug workaround, shut down properly
onebeastchris bb76158
Update forge feature branch to 1.20.4, target NeoForge
onebeastchris d6fb7a1
Merge branch 'master' into feature/forge-platform
onebeastchris 1bd5d49
Merge remote-tracking branch 'upstream/master' into feature/forge-pla…
onebeastchris db7346a
Update to latest restart changes
onebeastchris af7e8d3
Merge remote-tracking branch 'upstream/feature/forge-platform' into f…
onebeastchris fd52a44
Consistent NeoForge spelling, move some dependencies to the version toml
onebeastchris 0a755e4
Add lombok to version catalogue
onebeastchris 7754077
Merge remote-tracking branch 'upstream/master' into feature/forge-pla…
onebeastchris 1c4bf5c
Add plugins to version catalogue
onebeastchris af97df0
revert move to buildSrc
onebeastchris 2a484f4
Create `assets/geyser/icon.png` to reference icon from a single file …
onebeastchris ebbba9a
add fabric permissions api to libs.versions.toml
onebeastchris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ public abstract class PathPackCodec extends PackCodec { | |
*/ | ||
@NonNull | ||
public abstract Path path(); | ||
} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
bootstrap/fabric/src/main/resources/geyser-fabric.mixins.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
architectury { | ||
common("neoforge", "fabric") | ||
} | ||
|
||
loom { | ||
mixin.defaultRefmapName.set("geyser-refmap.json") | ||
} | ||
|
||
dependencies { | ||
api(projects.core) | ||
compileOnly(libs.mixin) | ||
|
||
// Only here to suppress "unknown enum constant EnvType.CLIENT" warnings. DO NOT USE! | ||
compileOnly(libs.fabric.loader) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
plugins { | ||
application | ||
} | ||
|
||
architectury { | ||
platformSetupLoomIde() | ||
fabric() | ||
} | ||
|
||
dependencies { | ||
modImplementation(libs.fabric.loader) | ||
modApi(libs.fabric.api) | ||
|
||
api(project(":mod", configuration = "namedElements")) | ||
shadow(project(path = ":mod", configuration = "transformProductionFabric")) { | ||
isTransitive = false | ||
} | ||
shadow(projects.core) { | ||
exclude(group = "com.google.guava", module = "guava") | ||
exclude(group = "com.google.code.gson", module = "gson") | ||
exclude(group = "org.slf4j") | ||
exclude(group = "com.nukkitx.fastutil") | ||
exclude(group = "io.netty.incubator") | ||
} | ||
|
||
// This should be in the libs TOML, but something about modImplementation AND include just doesn't work | ||
include(modImplementation("me.lucko", "fabric-permissions-api", "0.2-SNAPSHOT")) | ||
onebeastchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
application { | ||
mainClass.set("org.geysermc.geyser.platform.fabric.GeyserFabricMain") | ||
} | ||
|
||
tasks { | ||
remapJar { | ||
archiveBaseName.set("Geyser-Fabric") | ||
} | ||
|
||
remapModrinthJar { | ||
archiveBaseName.set("geyser-fabric") | ||
} | ||
} | ||
|
||
modrinth { | ||
loaders.add("fabric") | ||
dependencies { | ||
required.project("fabric-api") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
loom.platform=fabric |
72 changes: 72 additions & 0 deletions
72
...p/mod/fabric/src/main/java/org/geysermc/geyser/platform/fabric/GeyserFabricBootstrap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @author GeyserMC | ||
* @link https://github.com/GeyserMC/Geyser | ||
*/ | ||
|
||
package org.geysermc.geyser.platform.fabric; | ||
|
||
import me.lucko.fabric.api.permissions.v0.Permissions; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; | ||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.world.entity.player.Player; | ||
import org.geysermc.geyser.platform.mod.GeyserModBootstrap; | ||
import org.geysermc.geyser.platform.mod.GeyserModUpdateListener; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
|
||
public class GeyserFabricBootstrap extends GeyserModBootstrap implements ModInitializer { | ||
|
||
public GeyserFabricBootstrap() { | ||
super(new GeyserFabricPlatform()); | ||
} | ||
|
||
@Override | ||
public void onInitialize() { | ||
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) { | ||
// Set as an event, so we can get the proper IP and port if needed | ||
ServerLifecycleEvents.SERVER_STARTED.register((server) -> { | ||
this.setServer(server); | ||
onGeyserEnable(); | ||
}); | ||
} | ||
|
||
// These are only registered once | ||
ServerLifecycleEvents.SERVER_STOPPING.register((server) -> onGeyserShutdown()); | ||
ServerPlayConnectionEvents.JOIN.register((handler, $, $$) -> GeyserModUpdateListener.onPlayReady(handler.getPlayer())); | ||
|
||
this.onGeyserInitialize(); | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(@NonNull Player source, @NonNull String permissionNode) { | ||
return Permissions.check(source, permissionNode); | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(@NonNull CommandSourceStack source, @NonNull String permissionNode, int permissionLevel) { | ||
return Permissions.check(source, permissionNode, permissionLevel); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
99 changes: 99 additions & 0 deletions
99
...ap/mod/fabric/src/main/java/org/geysermc/geyser/platform/fabric/GeyserFabricPlatform.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @author GeyserMC | ||
* @link https://github.com/GeyserMC/Geyser | ||
*/ | ||
|
||
package org.geysermc.geyser.platform.fabric; | ||
|
||
import net.fabricmc.loader.api.FabricLoader; | ||
import net.fabricmc.loader.api.ModContainer; | ||
import net.minecraft.server.MinecraftServer; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
import org.geysermc.geyser.api.util.PlatformType; | ||
import org.geysermc.geyser.dump.BootstrapDumpInfo; | ||
import org.geysermc.geyser.platform.mod.GeyserModBootstrap; | ||
import org.geysermc.geyser.platform.mod.platform.GeyserModPlatform; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.file.Path; | ||
import java.util.Optional; | ||
|
||
public class GeyserFabricPlatform implements GeyserModPlatform { | ||
|
||
private final ModContainer mod; | ||
|
||
public GeyserFabricPlatform() { | ||
this.mod = FabricLoader.getInstance().getModContainer("geyser-fabric").orElseThrow(); | ||
} | ||
|
||
@Override | ||
public @NonNull PlatformType platformType() { | ||
return PlatformType.FABRIC; | ||
} | ||
|
||
@Override | ||
public @NonNull String configPath() { | ||
return "Geyser-Fabric"; | ||
} | ||
|
||
@Override | ||
public @NonNull Path dataFolder(@NonNull String modId) { | ||
return FabricLoader.getInstance().getConfigDir().resolve(modId); | ||
} | ||
|
||
@Override | ||
public @NonNull BootstrapDumpInfo dumpInfo(@NonNull MinecraftServer server) { | ||
return new GeyserFabricDumpInfo(server); | ||
} | ||
|
||
@Override | ||
public boolean testFloodgatePluginPresent(@NonNull GeyserModBootstrap bootstrap) { | ||
Optional<ModContainer> floodgate = FabricLoader.getInstance().getModContainer("floodgate"); | ||
if (floodgate.isPresent()) { | ||
Path floodgateDataFolder = FabricLoader.getInstance().getConfigDir().resolve("floodgate"); | ||
bootstrap.getGeyserConfig().loadFloodgate(bootstrap, floodgateDataFolder); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
@Override | ||
public @Nullable InputStream resolveResource(@NonNull String resource) { | ||
// We need to handle this differently, because Fabric shares the classloader across multiple mods | ||
Path path = this.mod.findPath(resource).orElse(null); | ||
if (path == null) { | ||
return null; | ||
} | ||
|
||
try { | ||
return path.getFileSystem() | ||
.provider() | ||
.newInputStream(path); | ||
} catch (IOException e) { | ||
return null; | ||
} | ||
} | ||
} |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:(