forked from GeyserMC/Geyser
Hybrid mode start + try fixing chunks (hashcodes, etc.)
This commit is contained in:
parent
6cb80dea28
commit
59e0aff289
14 changed files with 240 additions and 6 deletions
|
@ -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,7 +97,7 @@ 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 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");
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue