Merge branch 'master' of https://github.com/GeyserMC/Geyser into feature/1.17

This commit is contained in:
Camotoy 2021-06-06 11:42:59 -04:00
commit 19f8e2dfac
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
7 changed files with 56 additions and 18 deletions

View file

@ -8,4 +8,23 @@ api-version: 1.13
commands:
geyser:
description: The main command for Geyser.
usage: /geyser help
usage: /geyser help
permissions:
geyser.command.help:
description: Shows help for all registered commands.
geyser.command.advancement:
description: Shows the advancements of the player on the server.
geyser.command.dump:
description: Dumps Geyser debug information for bug reports.
geyser.command.list:
description: List all players connected through Geyser.
geyser.command.offhand:
description: Puts an items in your offhand.
geyser.command.reload:
description: Reloads the Geyser configurations. Kicks all players when used!
geyser.command.shutdown:
description: Shuts down Geyser.
geyser.command.statistics:
description: Shows the statistics of the player on the server.
geyser.command.version:
description: Shows the current Geyser version and checks for updates.

View file

@ -106,6 +106,12 @@ public class GeyserConnector {
private static GeyserConnector instance;
/**
* This is used in GeyserConnect to stop the bedrock server binding to a port
*/
@Setter
private static boolean shouldStartListener = true;
@Setter
private AuthType defaultAuthType;
@ -261,14 +267,17 @@ public class GeyserConnector {
}
bedrockServer.setHandler(new ConnectorServerEventHandler(this));
bedrockServer.bind().whenComplete((avoid, throwable) -> {
if (throwable == null) {
logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
} else {
logger.severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
throwable.printStackTrace();
}
}).join();
if (shouldStartListener) {
bedrockServer.bind().whenComplete((avoid, throwable) -> {
if (throwable == null) {
logger.info(LanguageUtils.getLocaleStringLog("geyser.core.start", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
} else {
logger.severe(LanguageUtils.getLocaleStringLog("geyser.core.fail", config.getBedrock().getAddress(), String.valueOf(config.getBedrock().getPort())));
throwable.printStackTrace();
}
}).join();
}
if (config.getMetrics().isEnabled()) {
metrics = new Metrics(this, "GeyserMC", config.getMetrics().getUniqueId(), false, java.util.logging.Logger.getLogger(""));

View file

@ -29,6 +29,7 @@ import com.github.steveice10.mc.protocol.data.game.entity.metadata.EntityMetadat
import com.nukkitx.math.vector.Vector3f;
import com.nukkitx.protocol.bedrock.data.entity.EntityData;
import com.nukkitx.protocol.bedrock.packet.AnimatePacket;
import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket;
import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession;
@ -65,7 +66,19 @@ public class BoatEntity extends Entity {
@Override
public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) {
// We don't include the rotation (y) as it causes the boat to appear sideways
super.moveAbsolute(session, position.add(0d, this.entityType.getOffset(), 0d), Vector3f.from(rotation.getX() + 90, 0, rotation.getX() + 90), isOnGround, teleported);
setPosition(position.add(0d, this.entityType.getOffset(), 0d));
setRotation(Vector3f.from(rotation.getX() + 90, 0, rotation.getX() + 90));
setOnGround(isOnGround);
MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket();
moveEntityPacket.setRuntimeEntityId(geyserId);
// Minimal glitching when ServerVehicleMovePacket is sent
moveEntityPacket.setPosition(session.getRidingVehicleEntity() == this ? position.up(EntityType.PLAYER.getOffset() - this.entityType.getOffset()) : this.position);
moveEntityPacket.setRotation(getBedrockRotation());
moveEntityPacket.setOnGround(isOnGround);
moveEntityPacket.setTeleported(teleported);
session.sendUpstreamPacket(moveEntityPacket);
}
@Override
@ -85,7 +98,6 @@ public class BoatEntity extends Entity {
@Override
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
// Time since last hit
if (entityMetadata.getId() == 8) {
metadata.put(EntityData.HURT_TIME, entityMetadata.getValue());

View file

@ -130,7 +130,7 @@ public enum EntityType {
THROWN_ENDERPEARL(ThrowableEntity.class, 87, 0.25f, 0.25f, 0.25f, 0f, "minecraft:ender_pearl"),
LEASH_KNOT(LeashKnotEntity.class, 88, 0.5f, 0.375f),
WITHER_SKULL(WitherSkullEntity.class, 89, 0.3125f),
BOAT(BoatEntity.class, 90, 0.7f, 1.6f, 1.6f, 0.35f),
BOAT(BoatEntity.class, 90, 0.6f, 1.6f, 1.6f, 0.35f),
WITHER_SKULL_DANGEROUS(WitherSkullEntity.class, 91, 0f),
LIGHTNING_BOLT(Entity.class, 93, 0f),
SMALL_FIREBALL(ItemedFireballEntity.class, 94, 0.3125f),

View file

@ -45,9 +45,8 @@ public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator<MoveEn
float y = packet.getPosition().getY();
if (session.getRidingVehicleEntity() instanceof BoatEntity) {
// Remove some Y position to prevents boats from looking like they're floating in water
// Not by the full boat offset because 1.16.100 complains and that's probably not good for the future
y -= (EntityType.BOAT.getOffset() - 0.5f);
// Remove the offset to prevents boats from looking like they're floating in water
y -= EntityType.BOAT.getOffset();
}
ClientVehicleMovePacket clientVehicleMovePacket = new ClientVehicleMovePacket(
packet.getPosition().getX(), y, packet.getPosition().getZ(),

View file

@ -40,7 +40,6 @@ public class JavaVehicleMoveTranslator extends PacketTranslator<ServerVehicleMov
Entity entity = session.getRidingVehicleEntity();
if (entity == null) return;
entity.moveAbsolute(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), false, false);
entity.moveAbsolute(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), false, true);
}
}

View file

@ -71,7 +71,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
</dependencies>