3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-04 23:30:17 +01:00

Java-1.18 (WIP) (#43)

Dieser Commit ist enthalten in:
Akashii Kun 2021-12-02 16:08:25 +00:00 committet von GitHub
Ursprung 3f88f20272
Commit 4f44fa8358
13 geänderte Dateien mit 60 neuen und 60 gelöschten Zeilen

Datei anzeigen

@ -15,6 +15,7 @@ local.properties
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
@ -134,6 +135,7 @@ hs_err_pid*
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
/.gradle/
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
@ -235,5 +237,3 @@ nbdist/
# End of https://www.gitignore.io/api/git,java,maven,eclipse,netbeans,jetbrains+all,visualstudiocode
### Geyser ###
run/

Datei anzeigen

@ -1,15 +1,15 @@
plugins {
id 'fabric-loom' version '0.8-SNAPSHOT'
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'java'
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
@ -27,8 +27,8 @@ dependencies {
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.
implementation 'org.geysermc:connector:1.4.3-SNAPSHOT'
shadow('org.geysermc:connector:1.4.3-SNAPSHOT') {
implementation 'org.geysermc:core:2.0.0-SNAPSHOT'
shadow('org.geysermc:core:2.0.0-SNAPSHOT') {
exclude group: 'com.google.guava', module: "guava"
exclude group: 'com.google.code.gson', module: "gson"
exclude group: 'org.slf4j'

Datei anzeigen

@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.14
loader_version=0.11.6
minecraft_version=1.18
yarn_mappings=1.18+build.1
loader_version=0.12.8
# Mod Properties
mod_version=1.4.3-SNAPSHOT
maven_group=org.geysermc.platform
archives_base_name=Geyser-Fabric
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.37.0+1.17
fabric_version=0.43.1+1.18

Datei anzeigen

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Datei anzeigen

@ -28,8 +28,8 @@ package org.geysermc.platform.fabric;
import com.fasterxml.jackson.annotation.JsonIgnore;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import org.geysermc.connector.FloodgateKeyLoader;
import org.geysermc.connector.configuration.GeyserJacksonConfiguration;
import org.geysermc.geyser.FloodgateKeyLoader;
import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
import java.nio.file.Path;

Datei anzeigen

@ -29,8 +29,8 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.minecraft.server.MinecraftServer;
import org.geysermc.connector.common.serializer.AsteriskSerializer;
import org.geysermc.connector.dump.BootstrapDumpInfo;
import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.geysermc.geyser.text.AsteriskSerializer;
import java.util.ArrayList;
import java.util.List;

Datei anzeigen

@ -27,7 +27,7 @@ package org.geysermc.platform.fabric;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.geysermc.connector.GeyserLogger;
import org.geysermc.geyser.GeyserLogger;
public class GeyserFabricLogger implements GeyserLogger {

Datei anzeigen

@ -35,19 +35,19 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource;
import org.apache.logging.log4j.LogManager;
import org.geysermc.common.PlatformType;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.GeyserLogger;
import org.geysermc.connector.bootstrap.GeyserBootstrap;
import org.geysermc.connector.command.CommandManager;
import org.geysermc.connector.command.GeyserCommand;
import org.geysermc.connector.common.AuthType;
import org.geysermc.connector.configuration.GeyserConfiguration;
import org.geysermc.connector.dump.BootstrapDumpInfo;
import org.geysermc.connector.network.translators.world.WorldManager;
import org.geysermc.connector.ping.GeyserLegacyPingPassthrough;
import org.geysermc.connector.ping.IGeyserPingPassthrough;
import org.geysermc.connector.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.command.CommandManager;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.dump.BootstrapDumpInfo;
import org.geysermc.geyser.ping.GeyserLegacyPingPassthrough;
import org.geysermc.geyser.session.auth.AuthType;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.configuration.GeyserConfiguration;
import org.geysermc.geyser.level.WorldManager;
import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import org.geysermc.geyser.util.FileUtils;
import org.geysermc.platform.fabric.command.GeyserFabricCommandExecutor;
import org.geysermc.platform.fabric.command.GeyserFabricCommandManager;
import org.geysermc.platform.fabric.world.GeyserFabricWorldManager;
@ -65,7 +65,7 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
private boolean reloading;
private GeyserConnector connector;
private GeyserImpl connector;
private Path dataFolder;
private MinecraftServer server;
@ -106,7 +106,7 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
File permissionsFile = fileOrCopiedFromResource(dataFolder.resolve("permissions.yml").toFile(), "permissions.yml");
this.playerCommands = Arrays.asList(FileUtils.loadConfig(permissionsFile, GeyserFabricPermissions.class).getCommands());
} catch (IOException ex) {
LogManager.getLogger("geyser-fabric").error(LanguageUtils.getLocaleStringLog("geyser.config.failed"), ex);
LogManager.getLogger("geyser-fabric").error(GeyserLocale.getLocaleStringLog("geyser.config.failed"), ex);
ex.printStackTrace();
return;
}
@ -152,7 +152,7 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
Optional<ModContainer> floodgate = FabricLoader.getInstance().getModContainer("floodgate");
boolean floodgatePresent = floodgate.isPresent();
if (geyserConfig.getRemote().getAuthType() == AuthType.FLOODGATE && !floodgatePresent) {
geyserLogger.severe(LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + LanguageUtils.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
geyserLogger.severe(GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.not_installed") + " " + GeyserLocale.getLocaleStringLog("geyser.bootstrap.floodgate.disabling"));
return;
} else if (geyserConfig.isAutoconfiguredRemote() && floodgatePresent) {
// Floodgate installed means that the user wants Floodgate authentication
@ -162,7 +162,7 @@ public class GeyserFabricMod implements ModInitializer, GeyserBootstrap {
geyserConfig.loadFloodgate(this, floodgate.orElse(null));
this.connector = GeyserConnector.start(PlatformType.FABRIC, this);
this.connector = GeyserImpl.start(PlatformType.FABRIC, this);
this.geyserPingPassthrough = GeyserLegacyPingPassthrough.init(connector);

Datei anzeigen

@ -28,9 +28,9 @@ package org.geysermc.platform.fabric.command;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.command.CommandSender;
import org.geysermc.connector.common.ChatColor;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.command.CommandSender;
import org.geysermc.geyser.text.ChatColor;
import org.geysermc.platform.fabric.GeyserFabricMod;
public class FabricCommandSender implements CommandSender {
@ -42,7 +42,7 @@ public class FabricCommandSender implements CommandSender {
}
@Override
public String getName() {
public String name() {
return source.getName();
}
@ -51,7 +51,7 @@ public class FabricCommandSender implements CommandSender {
if (source.getEntity() instanceof ServerPlayerEntity) {
((ServerPlayerEntity) source.getEntity()).sendMessage(new LiteralText(message), false);
} else {
GeyserConnector.getInstance().getLogger().info(ChatColor.toANSI(message + ChatColor.RESET));
GeyserImpl.getInstance().getLogger().info(ChatColor.toANSI(message + ChatColor.RESET));
}
}

Datei anzeigen

@ -28,12 +28,12 @@ package org.geysermc.platform.fabric.command;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.context.CommandContext;
import net.minecraft.server.command.ServerCommandSource;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.command.CommandExecutor;
import org.geysermc.connector.command.GeyserCommand;
import org.geysermc.connector.common.ChatColor;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.utils.LanguageUtils;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.command.CommandExecutor;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.ChatColor;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.platform.fabric.GeyserFabricMod;
import org.geysermc.platform.fabric.GeyserFabricPermissions;
@ -45,7 +45,7 @@ public class GeyserFabricCommandExecutor extends CommandExecutor implements Comm
*/
private final boolean requiresPermission;
public GeyserFabricCommandExecutor(GeyserConnector connector, GeyserCommand command, boolean requiresPermission) {
public GeyserFabricCommandExecutor(GeyserImpl connector, GeyserCommand command, boolean requiresPermission) {
super(connector);
this.command = command;
this.requiresPermission = requiresPermission;
@ -67,7 +67,7 @@ public class GeyserFabricCommandExecutor extends CommandExecutor implements Comm
FabricCommandSender sender = new FabricCommandSender(source);
GeyserSession session = getGeyserSession(sender);
if (!canRun(source)) {
sender.sendMessage(LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.permission_fail"));
sender.sendMessage(GeyserLocale.getLocaleStringLog("geyser.bootstrap.command.permission_fail"));
return 0;
}
if (this.command.getName().equals("reload")) {
@ -75,7 +75,7 @@ public class GeyserFabricCommandExecutor extends CommandExecutor implements Comm
}
if (command.isBedrockOnly() && session == null) {
sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.getLocale()));
sender.sendMessage(ChatColor.RED + GeyserLocale.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.getLocale()));
return 0;
}
command.execute(session, sender, new String[0]);

Datei anzeigen

@ -25,12 +25,12 @@
package org.geysermc.platform.fabric.command;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.command.CommandManager;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.command.CommandManager;
public class GeyserFabricCommandManager extends CommandManager {
public GeyserFabricCommandManager(GeyserConnector connector) {
public GeyserFabricCommandManager(GeyserImpl connector) {
super(connector);
}

Datei anzeigen

@ -32,7 +32,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.text.LiteralText;
import net.minecraft.world.GameMode;
import org.geysermc.connector.utils.LanguageUtils;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.platform.fabric.GeyserFabricMod;
import org.geysermc.platform.fabric.GeyserServerPortGetter;
import org.spongepowered.asm.mixin.Final;
@ -56,9 +56,9 @@ public class IntegratedServerMixin implements GeyserServerPortGetter {
// If the LAN is opened, starts Geyser.
GeyserFabricMod.getInstance().startGeyser((MinecraftServer) (Object) this);
// Ensure player locale has been loaded, in case it's different from Java system language
LanguageUtils.loadGeyserLocale(this.client.options.language);
GeyserLocale.loadGeyserLocale(this.client.options.language);
// Give indication that Geyser is loaded
this.client.player.sendMessage(new LiteralText(LanguageUtils.getPlayerLocaleString("geyser.core.start",
this.client.player.sendMessage(new LiteralText(GeyserLocale.getPlayerLocaleString("geyser.core.start",
this.client.options.language, "localhost", String.valueOf(this.lanPort))), false);
}
}

Datei anzeigen

@ -38,10 +38,10 @@ import net.minecraft.item.WrittenBookItem;
import net.minecraft.nbt.NbtList;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.inventory.translators.LecternInventoryTranslator;
import org.geysermc.connector.network.translators.world.GeyserWorldManager;
import org.geysermc.connector.utils.BlockEntityUtils;
import org.geysermc.geyser.level.GeyserWorldManager;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.inventory.LecternInventoryTranslator;
import org.geysermc.geyser.util.BlockEntityUtils;
import org.geysermc.platform.fabric.GeyserFabricMod;
import org.geysermc.platform.fabric.command.GeyserFabricCommandExecutor;
@ -115,7 +115,7 @@ public class GeyserFabricWorldManager extends GeyserWorldManager {
};
if (isChunkLoad) {
// Hacky hacks to allow lectern loading to be delayed
session.getConnector().getGeneralThreadPool().schedule(() -> server.execute(lecternGet), 1, TimeUnit.SECONDS);
session.scheduleInEventLoop(() -> server.execute(lecternGet), 1, TimeUnit.SECONDS);
} else {
server.execute(lecternGet);
}