Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-28 00:50:20 +01:00
Merge branch 'master' into inventory
Dieser Commit ist enthalten in:
Commit
e7a1063ee2
29
.github/workflows/pullrequest.yml
vendored
Normale Datei
29
.github/workflows/pullrequest.yml
vendored
Normale Datei
@ -0,0 +1,29 @@
|
|||||||
|
name: Build Pull Request
|
||||||
|
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.m2/repository
|
||||||
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-maven-
|
||||||
|
- name: Set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn -B package
|
||||||
|
- name: Archive artifacts
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
if: success()
|
||||||
|
with:
|
||||||
|
name: Geyser
|
||||||
|
path: target/Geyser.jar
|
@ -1,4 +1,4 @@
|
|||||||
<img src="https://geysermc.org/img/geyserlogo.png" alt="Geyser" width="600" height="170"/>
|
<img src="https://geysermc.org/img/geyserlogo.png" alt="Geyser" width="600"/>
|
||||||
|
|
||||||
[![forthebadge made-with-java](http://ForTheBadge.com/images/badges/made-with-java.svg)](https://java.com/)
|
[![forthebadge made-with-java](http://ForTheBadge.com/images/badges/made-with-java.svg)](https://java.com/)
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
<artifactId>connector</artifactId>
|
<artifactId>connector</artifactId>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>api</artifactId>
|
<artifactId>api</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
@ -95,6 +94,12 @@
|
|||||||
<artifactId>packetlib</artifactId>
|
<artifactId>packetlib</artifactId>
|
||||||
<version>1.4-SNAPSHOT</version>
|
<version>1.4-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-all</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.steveice10</groupId>
|
<groupId>com.github.steveice10</groupId>
|
||||||
|
@ -110,7 +110,7 @@ public class GeyserConnector implements Connector {
|
|||||||
|
|
||||||
logger.info("******************************************");
|
logger.info("******************************************");
|
||||||
logger.info("");
|
logger.info("");
|
||||||
logger.info("Loading " + NAME + " vesion " + VERSION);
|
logger.info("Loading " + NAME + " version " + VERSION);
|
||||||
logger.info("");
|
logger.info("");
|
||||||
logger.info("******************************************");
|
logger.info("******************************************");
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ public class GeyserConnector implements Connector {
|
|||||||
}).join();
|
}).join();
|
||||||
|
|
||||||
if (config.getMetrics().isEnabled()) {
|
if (config.getMetrics().isEnabled()) {
|
||||||
metrics = new Metrics("GeyserMC", config.getMetrics().getUUID(), true, java.util.logging.Logger.getLogger(""));
|
metrics = new Metrics("GeyserMC", config.getMetrics().getUUID(), false, java.util.logging.Logger.getLogger(""));
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("servers", () -> 1));
|
metrics.addCustomChart(new Metrics.SingleLineChart("servers", () -> 1));
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("players", Geyser::getPlayerCount));
|
metrics.addCustomChart(new Metrics.SingleLineChart("players", Geyser::getPlayerCount));
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("authMode", config.getRemote()::getAuthType));
|
metrics.addCustomChart(new Metrics.SimplePie("authMode", config.getRemote()::getAuthType));
|
||||||
|
@ -125,7 +125,9 @@ public class TranslatorsInit {
|
|||||||
Registry.registerJava(ServerPlayerSetExperiencePacket.class, new JavaPlayerSetExperienceTranslator());
|
Registry.registerJava(ServerPlayerSetExperiencePacket.class, new JavaPlayerSetExperienceTranslator());
|
||||||
Registry.registerJava(ServerPlayerHealthPacket.class, new JavaPlayerHealthTranslator());
|
Registry.registerJava(ServerPlayerHealthPacket.class, new JavaPlayerHealthTranslator());
|
||||||
Registry.registerJava(ServerPlayerActionAckPacket.class, new JavaPlayerActionAckTranslator());
|
Registry.registerJava(ServerPlayerActionAckPacket.class, new JavaPlayerActionAckTranslator());
|
||||||
Registry.registerJava(ServerPlayerAbilitiesPacket.class, new JavaPlayerAbilitiesTranslator());
|
|
||||||
|
// FIXME: This translator messes with allowing flight in creative mode. Will need to be addressed later
|
||||||
|
// Registry.registerJava(ServerPlayerAbilitiesPacket.class, new JavaPlayerAbilitiesTranslator());
|
||||||
|
|
||||||
Registry.registerJava(ServerNotifyClientPacket.class, new JavaNotifyClientTranslator());
|
Registry.registerJava(ServerNotifyClientPacket.class, new JavaNotifyClientTranslator());
|
||||||
Registry.registerJava(ServerChunkDataPacket.class, new JavaChunkDataTranslator());
|
Registry.registerJava(ServerChunkDataPacket.class, new JavaChunkDataTranslator());
|
||||||
|
@ -28,9 +28,9 @@ package org.geysermc.connector.network.translators.java.world;
|
|||||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
|
||||||
import com.nukkitx.math.vector.Vector3f;
|
import com.nukkitx.math.vector.Vector3f;
|
||||||
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket;
|
import com.nukkitx.protocol.bedrock.data.EntityDataDictionary;
|
||||||
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
|
import com.nukkitx.protocol.bedrock.data.EntityFlag;
|
||||||
import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket;
|
import com.nukkitx.protocol.bedrock.packet.*;
|
||||||
import org.geysermc.connector.entity.Entity;
|
import org.geysermc.connector.entity.Entity;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||||
@ -41,6 +41,10 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerNotifyClientPacket packet, GeyserSession session) {
|
public void translate(ServerNotifyClientPacket packet, GeyserSession session) {
|
||||||
|
Entity entity = session.getPlayerEntity();
|
||||||
|
if (entity == null)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (packet.getNotification()) {
|
switch (packet.getNotification()) {
|
||||||
case START_RAIN:
|
case START_RAIN:
|
||||||
LevelEventPacket startRainPacket = new LevelEventPacket();
|
LevelEventPacket startRainPacket = new LevelEventPacket();
|
||||||
@ -57,17 +61,35 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
|
|||||||
session.getUpstream().sendPacket(stopRainPacket);
|
session.getUpstream().sendPacket(stopRainPacket);
|
||||||
break;
|
break;
|
||||||
case CHANGE_GAMEMODE:
|
case CHANGE_GAMEMODE:
|
||||||
|
int playerFlags = 0;
|
||||||
|
|
||||||
GameMode gameMode = (GameMode) packet.getValue();
|
GameMode gameMode = (GameMode) packet.getValue();
|
||||||
|
playerFlags = setPlayerFlag(0x01, gameMode == GameMode.ADVENTURE, playerFlags); // world immutable
|
||||||
|
playerFlags = setPlayerFlag(0x20, true, playerFlags); // auto jump
|
||||||
|
playerFlags = setPlayerFlag(0x40, gameMode == GameMode.CREATIVE || gameMode == GameMode.SPECTATOR, playerFlags); // can fly
|
||||||
|
playerFlags = setPlayerFlag(0x80, gameMode == GameMode.SPECTATOR, playerFlags); // no clip
|
||||||
|
playerFlags = setPlayerFlag(0x200, gameMode == GameMode.SPECTATOR, playerFlags); // is flying
|
||||||
|
|
||||||
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
|
SetPlayerGameTypePacket playerGameTypePacket = new SetPlayerGameTypePacket();
|
||||||
playerGameTypePacket.setGamemode(gameMode.ordinal());
|
playerGameTypePacket.setGamemode(gameMode.ordinal());
|
||||||
session.getUpstream().sendPacket(playerGameTypePacket);
|
session.getUpstream().sendPacket(playerGameTypePacket);
|
||||||
session.setGameMode(gameMode);
|
session.setGameMode(gameMode);
|
||||||
|
|
||||||
|
AdventureSettingsPacket adventureSettingsPacket = new AdventureSettingsPacket();
|
||||||
|
adventureSettingsPacket.setPlayerPermission(1);
|
||||||
|
adventureSettingsPacket.setUniqueEntityId(entity.getGeyserId());
|
||||||
|
adventureSettingsPacket.setPlayerFlags(playerFlags);
|
||||||
|
session.getUpstream().sendPacket(adventureSettingsPacket);
|
||||||
|
|
||||||
|
EntityDataDictionary metadata = entity.getMetadata();
|
||||||
|
metadata.getFlags().setFlag(EntityFlag.CAN_FLY, gameMode == GameMode.CREATIVE || gameMode == GameMode.SPECTATOR);
|
||||||
|
|
||||||
|
SetEntityDataPacket entityDataPacket = new SetEntityDataPacket();
|
||||||
|
entityDataPacket.setRuntimeEntityId(entity.getGeyserId());
|
||||||
|
entityDataPacket.getMetadata().putAll(metadata);
|
||||||
|
session.getUpstream().sendPacket(entityDataPacket);
|
||||||
break;
|
break;
|
||||||
case ENTER_CREDITS:
|
case ENTER_CREDITS:
|
||||||
Entity entity = session.getPlayerEntity();
|
|
||||||
if (entity == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ShowCreditsPacket showCreditsPacket = new ShowCreditsPacket();
|
ShowCreditsPacket showCreditsPacket = new ShowCreditsPacket();
|
||||||
showCreditsPacket.setStatus(ShowCreditsPacket.Status.START_CREDITS);
|
showCreditsPacket.setStatus(ShowCreditsPacket.Status.START_CREDITS);
|
||||||
showCreditsPacket.setRuntimeEntityId(entity.getGeyserId());
|
showCreditsPacket.setRuntimeEntityId(entity.getGeyserId());
|
||||||
@ -77,4 +99,12 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int setPlayerFlag(int flag, boolean value, int playerFlags) {
|
||||||
|
if (value) {
|
||||||
|
return playerFlags | flag;
|
||||||
|
} else {
|
||||||
|
return playerFlags & ~flag;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class SkinUtils {
|
|||||||
Geyser.getLogger().debug("Got invalid texture data for " + profile.getName() + " " + exception.getMessage());
|
Geyser.getLogger().debug("Got invalid texture data for " + profile.getName() + " " + exception.getMessage());
|
||||||
}
|
}
|
||||||
// return default skin with default cape when texture data is invalid
|
// return default skin with default cape when texture data is invalid
|
||||||
return new GameProfileData("", "", false);
|
return new GameProfileData(SkinProvider.EMPTY_SKIN.getTextureUrl(), SkinProvider.EMPTY_CAPE.getTextureUrl(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,76 +432,76 @@
|
|||||||
"bedrock_data": 2
|
"bedrock_data": 2
|
||||||
},
|
},
|
||||||
"minecraft:oak_wood[axis=x]": {
|
"minecraft:oak_wood[axis=x]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 12
|
"bedrock_data": 16
|
||||||
},
|
},
|
||||||
"minecraft:oak_wood[axis=y]": {
|
"minecraft:oak_wood[axis=y]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 12
|
"bedrock_data": 0
|
||||||
},
|
},
|
||||||
"minecraft:oak_wood[axis=z]": {
|
"minecraft:oak_wood[axis=z]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 12
|
"bedrock_data": 32
|
||||||
},
|
},
|
||||||
"minecraft:spruce_wood[axis=x]": {
|
"minecraft:spruce_wood[axis=x]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 13
|
"bedrock_data": 17
|
||||||
},
|
},
|
||||||
"minecraft:spruce_wood[axis=y]": {
|
"minecraft:spruce_wood[axis=y]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 13
|
"bedrock_data": 1
|
||||||
},
|
},
|
||||||
"minecraft:spruce_wood[axis=z]": {
|
"minecraft:spruce_wood[axis=z]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 13
|
"bedrock_data": 33
|
||||||
},
|
},
|
||||||
"minecraft:birch_wood[axis=x]": {
|
"minecraft:birch_wood[axis=x]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 14
|
"bedrock_data": 18
|
||||||
},
|
},
|
||||||
"minecraft:birch_wood[axis=y]": {
|
"minecraft:birch_wood[axis=y]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 14
|
"bedrock_data": 2
|
||||||
},
|
},
|
||||||
"minecraft:birch_wood[axis=z]": {
|
"minecraft:birch_wood[axis=z]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 14
|
"bedrock_data": 34
|
||||||
},
|
},
|
||||||
"minecraft:jungle_wood[axis=x]": {
|
"minecraft:jungle_wood[axis=x]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 15
|
"bedrock_data": 19
|
||||||
},
|
},
|
||||||
"minecraft:jungle_wood[axis=y]": {
|
"minecraft:jungle_wood[axis=y]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 15
|
"bedrock_data": 3
|
||||||
},
|
},
|
||||||
"minecraft:jungle_wood[axis=z]": {
|
"minecraft:jungle_wood[axis=z]": {
|
||||||
"bedrock_identifier": "minecraft:log",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 15
|
"bedrock_data": 35
|
||||||
},
|
},
|
||||||
"minecraft:acacia_wood[axis=x]": {
|
"minecraft:acacia_wood[axis=x]": {
|
||||||
"bedrock_identifier": "minecraft:log2",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 12
|
"bedrock_data": 20
|
||||||
},
|
},
|
||||||
"minecraft:acacia_wood[axis=y]": {
|
"minecraft:acacia_wood[axis=y]": {
|
||||||
"bedrock_identifier": "minecraft:log2",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 12
|
"bedrock_data": 4
|
||||||
},
|
},
|
||||||
"minecraft:acacia_wood[axis=z]": {
|
"minecraft:acacia_wood[axis=z]": {
|
||||||
"bedrock_identifier": "minecraft:log2",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 12
|
"bedrock_data": 36
|
||||||
},
|
},
|
||||||
"minecraft:dark_oak_wood[axis=x]": {
|
"minecraft:dark_oak_wood[axis=x]": {
|
||||||
"bedrock_identifier": "minecraft:log2",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 13
|
"bedrock_data": 21
|
||||||
},
|
},
|
||||||
"minecraft:dark_oak_wood[axis=y]": {
|
"minecraft:dark_oak_wood[axis=y]": {
|
||||||
"bedrock_identifier": "minecraft:log2",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 13
|
"bedrock_data": 5
|
||||||
},
|
},
|
||||||
"minecraft:dark_oak_wood[axis=z]": {
|
"minecraft:dark_oak_wood[axis=z]": {
|
||||||
"bedrock_identifier": "minecraft:log2",
|
"bedrock_identifier": "minecraft:wood",
|
||||||
"bedrock_data": 13
|
"bedrock_data": 37
|
||||||
},
|
},
|
||||||
"minecraft:stripped_oak_wood[axis=x]": {
|
"minecraft:stripped_oak_wood[axis=x]": {
|
||||||
"bedrock_identifier": "minecraft:stripped_oak_log",
|
"bedrock_identifier": "minecraft:stripped_oak_log",
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren