Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +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/)
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
<artifactId>connector</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
<groupId>org.geysermc</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
@ -95,6 +94,12 @@
|
||||
<artifactId>packetlib</artifactId>
|
||||
<version>1.4-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.steveice10</groupId>
|
||||
|
@ -110,7 +110,7 @@ public class GeyserConnector implements Connector {
|
||||
|
||||
logger.info("******************************************");
|
||||
logger.info("");
|
||||
logger.info("Loading " + NAME + " vesion " + VERSION);
|
||||
logger.info("Loading " + NAME + " version " + VERSION);
|
||||
logger.info("");
|
||||
logger.info("******************************************");
|
||||
|
||||
@ -155,7 +155,7 @@ public class GeyserConnector implements Connector {
|
||||
}).join();
|
||||
|
||||
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("players", Geyser::getPlayerCount));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("authMode", config.getRemote()::getAuthType));
|
||||
|
@ -125,7 +125,9 @@ public class TranslatorsInit {
|
||||
Registry.registerJava(ServerPlayerSetExperiencePacket.class, new JavaPlayerSetExperienceTranslator());
|
||||
Registry.registerJava(ServerPlayerHealthPacket.class, new JavaPlayerHealthTranslator());
|
||||
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(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.packet.ingame.server.world.ServerNotifyClientPacket;
|
||||
import com.nukkitx.math.vector.Vector3f;
|
||||
import com.nukkitx.protocol.bedrock.packet.LevelEventPacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
|
||||
import com.nukkitx.protocol.bedrock.packet.ShowCreditsPacket;
|
||||
import com.nukkitx.protocol.bedrock.data.EntityDataDictionary;
|
||||
import com.nukkitx.protocol.bedrock.data.EntityFlag;
|
||||
import com.nukkitx.protocol.bedrock.packet.*;
|
||||
import org.geysermc.connector.entity.Entity;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.PacketTranslator;
|
||||
@ -41,6 +41,10 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
|
||||
|
||||
@Override
|
||||
public void translate(ServerNotifyClientPacket packet, GeyserSession session) {
|
||||
Entity entity = session.getPlayerEntity();
|
||||
if (entity == null)
|
||||
return;
|
||||
|
||||
switch (packet.getNotification()) {
|
||||
case START_RAIN:
|
||||
LevelEventPacket startRainPacket = new LevelEventPacket();
|
||||
@ -57,17 +61,35 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
|
||||
session.getUpstream().sendPacket(stopRainPacket);
|
||||
break;
|
||||
case CHANGE_GAMEMODE:
|
||||
int playerFlags = 0;
|
||||
|
||||
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();
|
||||
playerGameTypePacket.setGamemode(gameMode.ordinal());
|
||||
session.getUpstream().sendPacket(playerGameTypePacket);
|
||||
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;
|
||||
case ENTER_CREDITS:
|
||||
Entity entity = session.getPlayerEntity();
|
||||
if (entity == null)
|
||||
return;
|
||||
|
||||
ShowCreditsPacket showCreditsPacket = new ShowCreditsPacket();
|
||||
showCreditsPacket.setStatus(ShowCreditsPacket.Status.START_CREDITS);
|
||||
showCreditsPacket.setRuntimeEntityId(entity.getGeyserId());
|
||||
@ -77,4 +99,12 @@ public class JavaNotifyClientTranslator extends PacketTranslator<ServerNotifyCli
|
||||
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());
|
||||
}
|
||||
// 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
|
||||
},
|
||||
"minecraft:oak_wood[axis=x]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 12
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 16
|
||||
},
|
||||
"minecraft:oak_wood[axis=y]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 12
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 0
|
||||
},
|
||||
"minecraft:oak_wood[axis=z]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 12
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 32
|
||||
},
|
||||
"minecraft:spruce_wood[axis=x]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 13
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 17
|
||||
},
|
||||
"minecraft:spruce_wood[axis=y]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 13
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 1
|
||||
},
|
||||
"minecraft:spruce_wood[axis=z]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 13
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 33
|
||||
},
|
||||
"minecraft:birch_wood[axis=x]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 14
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 18
|
||||
},
|
||||
"minecraft:birch_wood[axis=y]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 14
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 2
|
||||
},
|
||||
"minecraft:birch_wood[axis=z]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 14
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 34
|
||||
},
|
||||
"minecraft:jungle_wood[axis=x]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 15
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 19
|
||||
},
|
||||
"minecraft:jungle_wood[axis=y]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 15
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 3
|
||||
},
|
||||
"minecraft:jungle_wood[axis=z]": {
|
||||
"bedrock_identifier": "minecraft:log",
|
||||
"bedrock_data": 15
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 35
|
||||
},
|
||||
"minecraft:acacia_wood[axis=x]": {
|
||||
"bedrock_identifier": "minecraft:log2",
|
||||
"bedrock_data": 12
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 20
|
||||
},
|
||||
"minecraft:acacia_wood[axis=y]": {
|
||||
"bedrock_identifier": "minecraft:log2",
|
||||
"bedrock_data": 12
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 4
|
||||
},
|
||||
"minecraft:acacia_wood[axis=z]": {
|
||||
"bedrock_identifier": "minecraft:log2",
|
||||
"bedrock_data": 12
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 36
|
||||
},
|
||||
"minecraft:dark_oak_wood[axis=x]": {
|
||||
"bedrock_identifier": "minecraft:log2",
|
||||
"bedrock_data": 13
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 21
|
||||
},
|
||||
"minecraft:dark_oak_wood[axis=y]": {
|
||||
"bedrock_identifier": "minecraft:log2",
|
||||
"bedrock_data": 13
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 5
|
||||
},
|
||||
"minecraft:dark_oak_wood[axis=z]": {
|
||||
"bedrock_identifier": "minecraft:log2",
|
||||
"bedrock_data": 13
|
||||
"bedrock_identifier": "minecraft:wood",
|
||||
"bedrock_data": 37
|
||||
},
|
||||
"minecraft:stripped_oak_wood[axis=x]": {
|
||||
"bedrock_identifier": "minecraft:stripped_oak_log",
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren