mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Merge remote-tracking branch 'upstream/chunks' into chunks
# Conflicts: # connector/src/main/java/org/geysermc/connector/utils/ChunkUtils.java
This commit is contained in:
commit
d8388d0315
14 changed files with 190 additions and 13 deletions
15
.idea/encodings.xml
Normal file
15
.idea/encodings.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/api" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/api" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/common" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/connector" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/connector" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/plugin" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/plugin" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
12
.idea/modules.xml
Normal file
12
.idea/modules.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/api/api.iml" filepath="$PROJECT_DIR$/api/api.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/common/common.iml" filepath="$PROJECT_DIR$/common/common.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/connector/connector.iml" filepath="$PROJECT_DIR$/connector/connector.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/geyser-parent.iml" filepath="$PROJECT_DIR$/geyser-parent.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugin/plugin.iml" filepath="$PROJECT_DIR$/plugin/plugin.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
69
connector/connector.iml
Normal file
69
connector/connector.iml
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/../target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/../target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="api" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.2" level="project" />
|
||||
<orderEntry type="module" module-name="common" />
|
||||
<orderEntry type="library" name="Maven: com.auth0:java-jwt:3.3.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.sentry:sentry:1.7.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.minecrell:terminalconsoleappender:1.0.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.8.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.8.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jline:jline-reader:3.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jline:jline-terminal:3.5.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jline:jline-terminal-jna:3.5.1" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: net.java.dev.jna:jna:4.2.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-simple:1.6.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.fusesource.jansi:jansi:1.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.nukkitx.protocol:bedrock-v361:2.1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.nukkitx.protocol:bedrock-common:2.1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.nukkitx.protocol:common:2.1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.nukkitx.network:common:1.6.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.36.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-epoll:linux-x86_64:4.1.36.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-unix-common:4.1.36.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport-native-kqueue:osx-x86_64:4.1.36.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.nukkit:nukkit-natives:1.0.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.nukkitx:nbt:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.flowpowered:flow-math:1.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sf.trove4j:trove:3.1.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sf.trove4j:trove-generator:3.1.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.nukkitx.network:raknet:1.6.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.36.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.36.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.36.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.36.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.36.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.nimbusds:nimbus-jose-jwt:4.41.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.stephenc.jcip:jcip-annotations:1.0-1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.minidev:json-smart:2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.nukkitx:fastutil-lite:8.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.steveice10:opennbt:1.3-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.steveice10:packetlib:1.4-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: io.netty:netty-all:4.1.25.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.steveice10:mcauthlib:1.1-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: junit:junit:4.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.steveice10:mcprotocollib:1.14.4-SNAPSHOT" level="project" />
|
||||
</component>
|
||||
</module>
|
|
@ -91,6 +91,7 @@ public class GeyserConnector implements Connector {
|
|||
}
|
||||
|
||||
private GeyserConnector() {
|
||||
System.out.println(UUID.randomUUID().toString());
|
||||
//Metric
|
||||
if(!(System.console() == null) && System.getProperty("os.name", "Windows 10").toLowerCase().contains("windows")) {
|
||||
AnsiConsole.systemInstall();
|
||||
|
|
|
@ -37,6 +37,6 @@ public class RemoteConfiguration {
|
|||
private String motd1;
|
||||
private String motd2;
|
||||
|
||||
@JsonProperty("online-mode")
|
||||
private boolean onlineMode;
|
||||
@JsonProperty("auth-type")
|
||||
private String authType;
|
||||
}
|
|
@ -119,7 +119,7 @@ public class GeyserSession implements PlayerSession, Player {
|
|||
startGame();
|
||||
|
||||
this.remoteServer = remoteServer;
|
||||
if (!connector.getConfig().getRemote().isOnlineMode()) {
|
||||
if (!(connector.getConfig().getRemote().getAuthType().hashCode() == "online".hashCode())) {
|
||||
connector.getLogger().info("Attempting to login using offline mode... authentication is disabled.");
|
||||
authenticate(authenticationData.getName());
|
||||
}
|
||||
|
|
|
@ -37,4 +37,14 @@ public class BedrockItem {
|
|||
private String identifier;
|
||||
private int id;
|
||||
private int data;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id << 4 | data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj == this || (obj instanceof BedrockItem && ((BedrockItem) obj).id == this.id && ((BedrockItem) obj).identifier.equals(this.identifier) && ((BedrockItem) obj).data == this.data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,9 +97,9 @@ public class ItemTranslator {
|
|||
}
|
||||
|
||||
public BedrockItem getBedrockBlock(BlockState state) {
|
||||
BedrockItem bedrockItem = Remapper.BLOCK_REMAPPER.convertToBedrock(new ItemStack(state.getId()));
|
||||
BedrockItem bedrockItem = Remapper.BLOCK_REMAPPER.convertToBedrockB(new ItemStack(state.getId()));
|
||||
if (bedrockItem == null) {
|
||||
//GeyserLogger.DEFAULT.debug("Missing mapping for java item " + state.getId());
|
||||
// GeyserLogger.DEFAULT.debug("Missing mapping for java block " + state.getId());
|
||||
return BedrockItem.AIR;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class JavaItem {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return id & identifier.hashCode();
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -107,6 +107,19 @@ public class Remapper {
|
|||
return null;
|
||||
}
|
||||
|
||||
public BedrockItem convertToBedrockB(ItemStack block) {
|
||||
for (Map.Entry<String, JavaItem> javaItem : Toolbox.JAVA_BLOCKS.entrySet()) {
|
||||
if (javaItem.getValue().getId() != block.getId())
|
||||
continue;
|
||||
|
||||
return javaToBedrock.get(javaItem.getValue());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static String getBedrockIdentifier(String javaIdentifier) {
|
||||
javaIdentifier = javaIdentifier.toLowerCase();
|
||||
javaIdentifier = javaIdentifier.replace("terracotta", "stained_hardened_clay");
|
||||
|
|
|
@ -31,15 +31,13 @@ public class Toolbox {
|
|||
Map<String, BedrockItem> bedrockBlocks = new HashMap<>();
|
||||
Map<String, BedrockItem> bedrockItems = new HashMap<>();
|
||||
|
||||
for (Map<String, Object> e : entries) {
|
||||
BedrockItem bedrockItem = new BedrockItem((String) e.get("name"), (int) e.get("id"), (int) e.get("data"));
|
||||
bedrockBlocks.put(bedrockItem.getIdentifier(), bedrockItem);
|
||||
bedrockItems.put(bedrockItem.getIdentifier() + ":" + bedrockItem.getData(), bedrockItem);
|
||||
}
|
||||
|
||||
ByteBuf b = Unpooled.buffer();
|
||||
VarInts.writeUnsignedInt(b, entries.size());
|
||||
for (Map<String, Object> e : entries) {
|
||||
BedrockItem bedrockItem = new BedrockItem((String) e.get("name"), (int) e.get("id"), (int) e.get("data"));
|
||||
bedrockItems.put(bedrockItem.getIdentifier() + ":" + bedrockItem.getData(), bedrockItem);
|
||||
bedrockBlocks.put(bedrockItem.getIdentifier() + ":" + bedrockItem.getData(), bedrockItem);
|
||||
|
||||
GlobalBlockPalette.registerMapping((int) e.get("id") << 4 | (int) e.get("data"));
|
||||
BedrockUtils.writeString(b, (String) e.get("name"));
|
||||
b.writeShortLE((int) e.get("data"));
|
||||
|
|
|
@ -19,7 +19,9 @@ remote:
|
|||
address: 127.0.0.1
|
||||
# The port of the remote (Java Edition) server
|
||||
port: 25565
|
||||
online-mode: false
|
||||
|
||||
# Authentication type. Can be offline, online, or hybrid (see the wiki).
|
||||
auth-type: offline
|
||||
|
||||
## the Xbox/MCPE username is the key for the Java server auth-info
|
||||
## this allows automatic configuration/login to the remote Java server
|
||||
|
|
15
plugin/plugin.iml
Normal file
15
plugin/plugin.iml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="waterfall-294" level="project" />
|
||||
</component>
|
||||
</module>
|
42
plugin/src/main/java/org/geysermc/plugin/GeyserPlugin.java
Normal file
42
plugin/src/main/java/org/geysermc/plugin/GeyserPlugin.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package org.geysermc.plugin;
|
||||
|
||||
|
||||
public class GeyserPlugin {
|
||||
/*private List<ConnectedPlayer> players;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void onEnable() {
|
||||
try {
|
||||
Class<? extends ProxyServer> clazz = getProxy().getClass();
|
||||
|
||||
Field field = clazz.getDeclaredField("connections");
|
||||
|
||||
field.setAccessible(true);
|
||||
|
||||
players = (List<ConnectedPlayer>) field.get(getProxy());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
RakNetServer server = new RakNetServer(new InetSocketAddress("0.0.0.0", 65500), 1000000);
|
||||
|
||||
server.addListener(new RakNetServerListener() {
|
||||
@Override
|
||||
public void handleMessage(RakNetServer server, RakNetClientPeer peer, RakNetPacket packet, int channel) {
|
||||
if(packet.getId() == 0) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private UUID fromXUID(String XUID) {
|
||||
String one = XUID.substring(0, XUID.length()/2);
|
||||
String two = XUID.substring(XUID.length()/2, XUID.length());
|
||||
|
||||
long L1 = Long.parseLong(one);
|
||||
long L2 = Long.parseLong(two);
|
||||
|
||||
return new UUID(L1, L2);
|
||||
}*/
|
||||
}
|
Loading…
Reference in a new issue