Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Merge branch 'feature/1.19.1'
Dieser Commit ist enthalten in:
Commit
8f8964761a
@ -6,9 +6,9 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>ap</artifactId>
|
<artifactId>ap</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>api-parent</artifactId>
|
<artifactId>api-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>api-parent</artifactId>
|
<artifactId>api-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -26,7 +26,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>base-api</artifactId>
|
<artifactId>base-api</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>api-parent</artifactId>
|
<artifactId>api-parent</artifactId>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-bungeecord</artifactId>
|
<artifactId>bootstrap-bungeecord</artifactId>
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Used for better working with internals without reflection -->
|
<!-- Used for better working with internals without reflection -->
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>ap</artifactId>
|
<artifactId>ap</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-spigot</artifactId>
|
<artifactId>bootstrap-spigot</artifactId>
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-sponge</artifactId>
|
<artifactId>bootstrap-sponge</artifactId>
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-standalone</artifactId>
|
<artifactId>bootstrap-standalone</artifactId>
|
||||||
|
|
||||||
@ -18,7 +18,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>bootstrap-parent</artifactId>
|
<artifactId>bootstrap-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>bootstrap-velocity</artifactId>
|
<artifactId>bootstrap-velocity</artifactId>
|
||||||
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
|
|
||||||
|
10
core/pom.xml
10
core/pom.xml
@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>core</artifactId>
|
<artifactId>core</artifactId>
|
||||||
|
|
||||||
@ -29,19 +29,19 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>ap</artifactId>
|
<artifactId>ap</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-api</artifactId>
|
<artifactId>geyser-api</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Jackson JSON and YAML serialization -->
|
<!-- Jackson JSON and YAML serialization -->
|
||||||
@ -163,7 +163,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.GeyserMC</groupId>
|
<groupId>com.github.GeyserMC</groupId>
|
||||||
<artifactId>MCProtocolLib</artifactId>
|
<artifactId>MCProtocolLib</artifactId>
|
||||||
<version>ecc04fd</version>
|
<version>9f78bd5</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
@ -453,6 +453,8 @@ public final class EntityDefinitions {
|
|||||||
ALLAY = EntityDefinition.inherited(AllayEntity::new, mobEntityBase)
|
ALLAY = EntityDefinition.inherited(AllayEntity::new, mobEntityBase)
|
||||||
.type(EntityType.ALLAY)
|
.type(EntityType.ALLAY)
|
||||||
.height(0.6f).width(0.35f)
|
.height(0.6f).width(0.35f)
|
||||||
|
.addTranslator(MetadataType.BOOLEAN, AllayEntity::setDancing)
|
||||||
|
.addTranslator(MetadataType.BOOLEAN, AllayEntity::setCanDuplicate)
|
||||||
.build();
|
.build();
|
||||||
BAT = EntityDefinition.inherited(BatEntity::new, mobEntityBase)
|
BAT = EntityDefinition.inherited(BatEntity::new, mobEntityBase)
|
||||||
.type(EntityType.BAT)
|
.type(EntityType.BAT)
|
||||||
|
@ -25,8 +25,10 @@
|
|||||||
|
|
||||||
package org.geysermc.geyser.entity.type.living;
|
package org.geysermc.geyser.entity.type.living;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.type.BooleanEntityMetadata;
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
|
||||||
import com.nukkitx.math.vector.Vector3f;
|
import com.nukkitx.math.vector.Vector3f;
|
||||||
|
import com.nukkitx.protocol.bedrock.data.entity.EntityFlag;
|
||||||
import org.geysermc.geyser.entity.EntityDefinition;
|
import org.geysermc.geyser.entity.EntityDefinition;
|
||||||
import org.geysermc.geyser.inventory.GeyserItemStack;
|
import org.geysermc.geyser.inventory.GeyserItemStack;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
@ -37,14 +39,27 @@ import javax.annotation.Nonnull;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class AllayEntity extends MobEntity {
|
public class AllayEntity extends MobEntity {
|
||||||
|
private boolean canDuplicate;
|
||||||
|
|
||||||
public AllayEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
public AllayEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
|
||||||
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
super(session, entityId, geyserId, uuid, definition, position, motion, yaw, pitch, headYaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDancing(BooleanEntityMetadata entityMetadata) {
|
||||||
|
setFlag(EntityFlag.DANCING, entityMetadata.getPrimitiveValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCanDuplicate(BooleanEntityMetadata entityMetadata) {
|
||||||
|
this.canDuplicate = entityMetadata.getPrimitiveValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
protected InteractiveTag testMobInteraction(@Nonnull Hand hand, @Nonnull GeyserItemStack itemInHand) {
|
protected InteractiveTag testMobInteraction(@Nonnull Hand hand, @Nonnull GeyserItemStack itemInHand) {
|
||||||
if (!this.hand.isValid() && !itemInHand.isEmpty()) {
|
if (this.canDuplicate && getFlag(EntityFlag.DANCING) && isDuplicationItem(itemInHand)) {
|
||||||
|
// Maybe better as another tag?
|
||||||
|
return InteractiveTag.GIVE_ITEM_TO_ALLAY;
|
||||||
|
} else if (!this.hand.isValid() && !itemInHand.isEmpty()) {
|
||||||
return InteractiveTag.GIVE_ITEM_TO_ALLAY;
|
return InteractiveTag.GIVE_ITEM_TO_ALLAY;
|
||||||
} else if (this.hand.isValid() && hand == Hand.MAIN_HAND && itemInHand.isEmpty()) {
|
} else if (this.hand.isValid() && hand == Hand.MAIN_HAND && itemInHand.isEmpty()) {
|
||||||
// Seems like there isn't a good tag for this yet
|
// Seems like there isn't a good tag for this yet
|
||||||
@ -57,7 +72,10 @@ public class AllayEntity extends MobEntity {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
protected InteractionResult mobInteract(@Nonnull Hand hand, @Nonnull GeyserItemStack itemInHand) {
|
protected InteractionResult mobInteract(@Nonnull Hand hand, @Nonnull GeyserItemStack itemInHand) {
|
||||||
if (!this.hand.isValid() && !itemInHand.isEmpty()) {
|
if (this.canDuplicate && getFlag(EntityFlag.DANCING) && isDuplicationItem(itemInHand)) {
|
||||||
|
//TOCHECK sound
|
||||||
|
return InteractionResult.SUCCESS;
|
||||||
|
} else if (!this.hand.isValid() && !itemInHand.isEmpty()) {
|
||||||
//TODO play sound?
|
//TODO play sound?
|
||||||
return InteractionResult.SUCCESS;
|
return InteractionResult.SUCCESS;
|
||||||
} else if (this.hand.isValid() && hand == Hand.MAIN_HAND && itemInHand.isEmpty()) {
|
} else if (this.hand.isValid() && hand == Hand.MAIN_HAND && itemInHand.isEmpty()) {
|
||||||
@ -67,4 +85,8 @@ public class AllayEntity extends MobEntity {
|
|||||||
return super.mobInteract(hand, itemInHand);
|
return super.mobInteract(hand, itemInHand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isDuplicationItem(GeyserItemStack itemStack) {
|
||||||
|
return itemStack.getJavaId() == session.getItemMappings().getStoredItems().amethystShard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ import java.util.Map;
|
|||||||
@Getter
|
@Getter
|
||||||
@Accessors(fluent = true)
|
@Accessors(fluent = true)
|
||||||
public class StoredItemMappings {
|
public class StoredItemMappings {
|
||||||
|
private final int amethystShard;
|
||||||
private final ItemMapping bamboo;
|
private final ItemMapping bamboo;
|
||||||
private final ItemMapping banner;
|
private final ItemMapping banner;
|
||||||
private final ItemMapping barrier;
|
private final ItemMapping barrier;
|
||||||
@ -71,6 +72,7 @@ public class StoredItemMappings {
|
|||||||
private final ItemMapping writableBook;
|
private final ItemMapping writableBook;
|
||||||
|
|
||||||
public StoredItemMappings(Map<String, ItemMapping> itemMappings) {
|
public StoredItemMappings(Map<String, ItemMapping> itemMappings) {
|
||||||
|
this.amethystShard = load(itemMappings, "amethyst_shard").getJavaId();
|
||||||
this.bamboo = load(itemMappings, "bamboo");
|
this.bamboo = load(itemMappings, "bamboo");
|
||||||
this.banner = load(itemMappings, "white_banner"); // As of 1.17.10, all banners have the same Bedrock ID
|
this.banner = load(itemMappings, "white_banner"); // As of 1.17.10, all banners have the same Bedrock ID
|
||||||
this.barrier = load(itemMappings, "barrier");
|
this.barrier = load(itemMappings, "barrier");
|
||||||
|
@ -123,9 +123,9 @@ import org.geysermc.geyser.session.auth.AuthType;
|
|||||||
import org.geysermc.geyser.session.auth.BedrockClientData;
|
import org.geysermc.geyser.session.auth.BedrockClientData;
|
||||||
import org.geysermc.geyser.session.cache.*;
|
import org.geysermc.geyser.session.cache.*;
|
||||||
import org.geysermc.geyser.skin.FloodgateSkinUploader;
|
import org.geysermc.geyser.skin.FloodgateSkinUploader;
|
||||||
import org.geysermc.geyser.text.ChatTypeEntry;
|
|
||||||
import org.geysermc.geyser.text.GeyserLocale;
|
import org.geysermc.geyser.text.GeyserLocale;
|
||||||
import org.geysermc.geyser.text.MinecraftLocale;
|
import org.geysermc.geyser.text.MinecraftLocale;
|
||||||
|
import org.geysermc.geyser.text.TextDecoration;
|
||||||
import org.geysermc.geyser.translator.inventory.InventoryTranslator;
|
import org.geysermc.geyser.translator.inventory.InventoryTranslator;
|
||||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||||
import org.geysermc.geyser.util.ChunkUtils;
|
import org.geysermc.geyser.util.ChunkUtils;
|
||||||
@ -341,7 +341,7 @@ public class GeyserSession implements GeyserConnection, CommandSender {
|
|||||||
*/
|
*/
|
||||||
private final Map<String, JavaDimension> dimensions = new Object2ObjectOpenHashMap<>(3);
|
private final Map<String, JavaDimension> dimensions = new Object2ObjectOpenHashMap<>(3);
|
||||||
|
|
||||||
private final Int2ObjectMap<ChatTypeEntry> chatTypes = new Int2ObjectOpenHashMap<>(8);
|
private final Int2ObjectMap<TextDecoration> chatTypes = new Int2ObjectOpenHashMap<>(7);
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private int breakingBlock;
|
private int breakingBlock;
|
||||||
@ -564,8 +564,6 @@ public class GeyserSession implements GeyserConnection, CommandSender {
|
|||||||
this.playerEntity = new SessionPlayerEntity(this);
|
this.playerEntity = new SessionPlayerEntity(this);
|
||||||
collisionManager.updatePlayerBoundingBox(this.playerEntity.getPosition());
|
collisionManager.updatePlayerBoundingBox(this.playerEntity.getPosition());
|
||||||
|
|
||||||
ChatTypeEntry.applyDefaults(chatTypes);
|
|
||||||
|
|
||||||
this.playerInventory = new PlayerInventory();
|
this.playerInventory = new PlayerInventory();
|
||||||
this.openInventory = null;
|
this.openInventory = null;
|
||||||
this.craftingRecipes = new Int2ObjectOpenHashMap<>();
|
this.craftingRecipes = new Int2ObjectOpenHashMap<>();
|
||||||
@ -1388,14 +1386,14 @@ public class GeyserSession implements GeyserConnection, CommandSender {
|
|||||||
* Sends a chat message to the Java server.
|
* Sends a chat message to the Java server.
|
||||||
*/
|
*/
|
||||||
public void sendChat(String message) {
|
public void sendChat(String message) {
|
||||||
sendDownstreamPacket(new ServerboundChatPacket(message, Instant.now().toEpochMilli(), 0L, ByteArrays.EMPTY_ARRAY, false));
|
sendDownstreamPacket(new ServerboundChatPacket(message, Instant.now().toEpochMilli(), 0L, ByteArrays.EMPTY_ARRAY, false, Collections.emptyList(), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a command to the Java server.
|
* Sends a command to the Java server.
|
||||||
*/
|
*/
|
||||||
public void sendCommand(String command) {
|
public void sendCommand(String command) {
|
||||||
sendDownstreamPacket(new ServerboundChatCommandPacket(command, Instant.now().toEpochMilli(), 0L, Collections.emptyMap(), false));
|
sendDownstreamPacket(new ServerboundChatCommandPacket(command, Instant.now().toEpochMilli(), 0L, Collections.emptyList(), false, Collections.emptyList(), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setServerRenderDistance(int renderDistance) {
|
public void setServerRenderDistance(int renderDistance) {
|
||||||
|
@ -34,9 +34,7 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
public record ChatTypeEntry(@Nonnull TextPacket.Type bedrockChatType, @Nullable TextDecoration textDecoration) {
|
public record ChatTypeEntry(@Nonnull TextPacket.Type bedrockChatType, @Nullable TextDecoration textDecoration) {
|
||||||
private static final ChatTypeEntry CHAT = new ChatTypeEntry(TextPacket.Type.CHAT, null);
|
private static final ChatTypeEntry CHAT = new ChatTypeEntry(TextPacket.Type.CHAT, null);
|
||||||
private static final ChatTypeEntry SYSTEM = new ChatTypeEntry(TextPacket.Type.CHAT, null);
|
private static final ChatTypeEntry RAW = new ChatTypeEntry(TextPacket.Type.RAW, null);
|
||||||
private static final ChatTypeEntry TIP = new ChatTypeEntry(TextPacket.Type.CHAT, null);
|
|
||||||
private static final ChatTypeEntry RAW = new ChatTypeEntry(TextPacket.Type.CHAT, null);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply defaults to a map so it isn't empty in the event a chat message is sent before the login packet.
|
* Apply defaults to a map so it isn't empty in the event a chat message is sent before the login packet.
|
||||||
@ -46,12 +44,11 @@ public record ChatTypeEntry(@Nonnull TextPacket.Type bedrockChatType, @Nullable
|
|||||||
// But, the only way this happens is if a chat message is sent to us before the login packet, which is rare.
|
// But, the only way this happens is if a chat message is sent to us before the login packet, which is rare.
|
||||||
// So we'll just make sure chat ends up in the right place.
|
// So we'll just make sure chat ends up in the right place.
|
||||||
chatTypes.put(BuiltinChatType.CHAT.ordinal(), CHAT);
|
chatTypes.put(BuiltinChatType.CHAT.ordinal(), CHAT);
|
||||||
chatTypes.put(BuiltinChatType.SYSTEM.ordinal(), SYSTEM);
|
|
||||||
chatTypes.put(BuiltinChatType.GAME_INFO.ordinal(), TIP);
|
|
||||||
chatTypes.put(BuiltinChatType.SAY_COMMAND.ordinal(), RAW);
|
chatTypes.put(BuiltinChatType.SAY_COMMAND.ordinal(), RAW);
|
||||||
chatTypes.put(BuiltinChatType.MSG_COMMAND.ordinal(), RAW);
|
chatTypes.put(BuiltinChatType.MSG_COMMAND_INCOMING.ordinal(), RAW);
|
||||||
chatTypes.put(BuiltinChatType.TEAM_MSG_COMMAND.ordinal(), RAW);
|
chatTypes.put(BuiltinChatType.MSG_COMMAND_OUTGOING.ordinal(), RAW);
|
||||||
|
chatTypes.put(BuiltinChatType.TEAM_MSG_COMMAND_INCOMING.ordinal(), RAW);
|
||||||
|
chatTypes.put(BuiltinChatType.TEAM_MSG_COMMAND_OUTGOING.ordinal(), RAW);
|
||||||
chatTypes.put(BuiltinChatType.EMOTE_COMMAND.ordinal(), RAW);
|
chatTypes.put(BuiltinChatType.EMOTE_COMMAND.ordinal(), RAW);
|
||||||
chatTypes.put(BuiltinChatType.TELLRAW_COMMAND.ordinal(), RAW);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,14 +46,16 @@ public final class TextDecoration {
|
|||||||
|
|
||||||
CompoundTag styleTag = tag.get("style");
|
CompoundTag styleTag = tag.get("style");
|
||||||
Style.Builder builder = Style.style();
|
Style.Builder builder = Style.style();
|
||||||
StringTag color = styleTag.get("color");
|
if (styleTag != null) {
|
||||||
if (color != null) {
|
StringTag color = styleTag.get("color");
|
||||||
builder.color(NamedTextColor.NAMES.value(color.getValue()));
|
if (color != null) {
|
||||||
}
|
builder.color(NamedTextColor.NAMES.value(color.getValue()));
|
||||||
//TODO implement the rest
|
}
|
||||||
Tag italic = styleTag.get("italic");
|
//TODO implement the rest
|
||||||
if (italic != null && ((Number) italic.getValue()).byteValue() == (byte) 1) {
|
Tag italic = styleTag.get("italic");
|
||||||
builder.decorate(net.kyori.adventure.text.format.TextDecoration.ITALIC);
|
if (italic != null && ((Number) italic.getValue()).byteValue() == (byte) 1) {
|
||||||
|
builder.decorate(net.kyori.adventure.text.format.TextDecoration.ITALIC);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
style = builder.build();
|
style = builder.build();
|
||||||
|
|
||||||
@ -88,6 +90,6 @@ public final class TextDecoration {
|
|||||||
public enum Parameter {
|
public enum Parameter {
|
||||||
CONTENT,
|
CONTENT,
|
||||||
SENDER,
|
SENDER,
|
||||||
TEAM_NAME
|
TARGET
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
|
|||||||
CommandNode node = nodes[nodeIndex];
|
CommandNode node = nodes[nodeIndex];
|
||||||
|
|
||||||
// Make sure we don't have duplicated commands (happens if there is more than 1 root node)
|
// Make sure we don't have duplicated commands (happens if there is more than 1 root node)
|
||||||
if (!commandNodes.add(nodeIndex) || !knownAliases.add(node.getName().toLowerCase())) continue;
|
if (!commandNodes.add(nodeIndex) || !knownAliases.add(node.getName().toLowerCase(Locale.ROOT))) continue;
|
||||||
|
|
||||||
// Get and update the commandArgs list with the found arguments
|
// Get and update the commandArgs list with the found arguments
|
||||||
if (node.getChildIndices().length >= 1) {
|
if (node.getChildIndices().length >= 1) {
|
||||||
@ -319,7 +319,7 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
|
|||||||
CommandParam type = null;
|
CommandParam type = null;
|
||||||
boolean optional = this.paramNode.isExecutable();
|
boolean optional = this.paramNode.isExecutable();
|
||||||
if (mappedType instanceof String[]) {
|
if (mappedType instanceof String[]) {
|
||||||
enumData = new CommandEnumData(paramNode.getParser().name().toLowerCase(), (String[]) mappedType, false);
|
enumData = new CommandEnumData(paramNode.getParser().name().toLowerCase(Locale.ROOT), (String[]) mappedType, false);
|
||||||
} else {
|
} else {
|
||||||
type = (CommandParam) mappedType;
|
type = (CommandParam) mappedType;
|
||||||
// Bedrock throws a fit if an optional message comes after a string or target
|
// Bedrock throws a fit if an optional message comes after a string or target
|
||||||
|
@ -25,25 +25,21 @@
|
|||||||
|
|
||||||
package org.geysermc.geyser.translator.protocol.java;
|
package org.geysermc.geyser.translator.protocol.java;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.BuiltinChatType;
|
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
|
||||||
import com.nukkitx.protocol.bedrock.data.GameRuleData;
|
import com.nukkitx.protocol.bedrock.data.GameRuleData;
|
||||||
import com.nukkitx.protocol.bedrock.data.PlayerPermission;
|
import com.nukkitx.protocol.bedrock.data.PlayerPermission;
|
||||||
import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket;
|
import com.nukkitx.protocol.bedrock.packet.AdventureSettingsPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.GameRulesChangedPacket;
|
import com.nukkitx.protocol.bedrock.packet.GameRulesChangedPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
|
import com.nukkitx.protocol.bedrock.packet.SetPlayerGameTypePacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.TextPacket;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import org.geysermc.floodgate.pluginmessage.PluginMessageChannels;
|
import org.geysermc.floodgate.pluginmessage.PluginMessageChannels;
|
||||||
import org.geysermc.geyser.entity.type.player.SessionPlayerEntity;
|
import org.geysermc.geyser.entity.type.player.SessionPlayerEntity;
|
||||||
import org.geysermc.geyser.level.JavaDimension;
|
import org.geysermc.geyser.level.JavaDimension;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.session.auth.AuthType;
|
import org.geysermc.geyser.session.auth.AuthType;
|
||||||
import org.geysermc.geyser.text.ChatTypeEntry;
|
|
||||||
import org.geysermc.geyser.text.TextDecoration;
|
import org.geysermc.geyser.text.TextDecoration;
|
||||||
import org.geysermc.geyser.translator.level.BiomeTranslator;
|
import org.geysermc.geyser.translator.level.BiomeTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
@ -68,7 +64,7 @@ public class JavaLoginTranslator extends PacketTranslator<ClientboundLoginPacket
|
|||||||
|
|
||||||
JavaDimension.load(packet.getRegistry(), dimensions);
|
JavaDimension.load(packet.getRegistry(), dimensions);
|
||||||
|
|
||||||
Int2ObjectMap<ChatTypeEntry> chatTypes = session.getChatTypes();
|
Int2ObjectMap<TextDecoration> chatTypes = session.getChatTypes();
|
||||||
chatTypes.clear();
|
chatTypes.clear();
|
||||||
for (CompoundTag tag : JavaCodecEntry.iterateAsTag(packet.getRegistry().get("minecraft:chat_type"))) {
|
for (CompoundTag tag : JavaCodecEntry.iterateAsTag(packet.getRegistry().get("minecraft:chat_type"))) {
|
||||||
// The ID is NOT ALWAYS THE SAME! ViaVersion as of 1.19 adds two registry entries that do NOT match vanilla.
|
// The ID is NOT ALWAYS THE SAME! ViaVersion as of 1.19 adds two registry entries that do NOT match vanilla.
|
||||||
@ -77,21 +73,9 @@ public class JavaLoginTranslator extends PacketTranslator<ClientboundLoginPacket
|
|||||||
CompoundTag chat = element.get("chat");
|
CompoundTag chat = element.get("chat");
|
||||||
TextDecoration textDecoration = null;
|
TextDecoration textDecoration = null;
|
||||||
if (chat != null) {
|
if (chat != null) {
|
||||||
CompoundTag decorationTag = chat.get("decoration");
|
textDecoration = new TextDecoration(chat);
|
||||||
if (decorationTag != null) {
|
|
||||||
textDecoration = new TextDecoration(decorationTag);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BuiltinChatType type = BuiltinChatType.from(((StringTag) tag.get("name")).getValue());
|
chatTypes.put(id, textDecoration);
|
||||||
// TODO new types?
|
|
||||||
// The built-in type can be null if custom plugins/mods add in new types
|
|
||||||
TextPacket.Type bedrockType = type != null ? switch (type) {
|
|
||||||
case CHAT -> TextPacket.Type.CHAT;
|
|
||||||
case SYSTEM -> TextPacket.Type.SYSTEM;
|
|
||||||
case GAME_INFO -> TextPacket.Type.TIP;
|
|
||||||
default -> TextPacket.Type.RAW;
|
|
||||||
} : TextPacket.Type.RAW;
|
|
||||||
chatTypes.put(id, new ChatTypeEntry(bedrockType, textDecoration));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the player is already initialized and a join game packet is sent, they
|
// If the player is already initialized and a join game packet is sent, they
|
||||||
|
@ -30,7 +30,6 @@ import com.nukkitx.protocol.bedrock.packet.TextPacket;
|
|||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TranslatableComponent;
|
import net.kyori.adventure.text.TranslatableComponent;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.text.ChatTypeEntry;
|
|
||||||
import org.geysermc.geyser.text.TextDecoration;
|
import org.geysermc.geyser.text.TextDecoration;
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
@ -45,18 +44,16 @@ public class JavaPlayerChatTranslator extends PacketTranslator<ClientboundPlayer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundPlayerChatPacket packet) {
|
public void translate(GeyserSession session, ClientboundPlayerChatPacket packet) {
|
||||||
ChatTypeEntry entry = session.getChatTypes().get(packet.getTypeId());
|
|
||||||
|
|
||||||
TextPacket textPacket = new TextPacket();
|
TextPacket textPacket = new TextPacket();
|
||||||
textPacket.setPlatformChatId("");
|
textPacket.setPlatformChatId("");
|
||||||
textPacket.setSourceName("");
|
textPacket.setSourceName("");
|
||||||
textPacket.setXuid(session.getAuthData().xuid());
|
textPacket.setXuid(session.getAuthData().xuid());
|
||||||
textPacket.setType(entry.bedrockChatType());
|
textPacket.setType(TextPacket.Type.CHAT);
|
||||||
|
|
||||||
textPacket.setNeedsTranslation(false);
|
textPacket.setNeedsTranslation(false);
|
||||||
Component message = packet.getUnsignedContent() == null ? packet.getSignedContent() : packet.getUnsignedContent();
|
Component message = packet.getUnsignedContent() == null ? packet.getMessageDecorated() : packet.getUnsignedContent();
|
||||||
|
|
||||||
TextDecoration decoration = entry.textDecoration();
|
TextDecoration decoration = session.getChatTypes().get(packet.getChatType());
|
||||||
if (decoration != null) {
|
if (decoration != null) {
|
||||||
// As of 1.19 - do this to apply all the styling for signed messages
|
// As of 1.19 - do this to apply all the styling for signed messages
|
||||||
// Though, Bedrock cannot care about the signed stuff.
|
// Though, Bedrock cannot care about the signed stuff.
|
||||||
@ -65,11 +62,11 @@ public class JavaPlayerChatTranslator extends PacketTranslator<ClientboundPlayer
|
|||||||
.style(decoration.style());
|
.style(decoration.style());
|
||||||
Set<TextDecoration.Parameter> parameters = decoration.parameters();
|
Set<TextDecoration.Parameter> parameters = decoration.parameters();
|
||||||
List<Component> args = new ArrayList<>(3);
|
List<Component> args = new ArrayList<>(3);
|
||||||
if (parameters.contains(TextDecoration.Parameter.TEAM_NAME)) {
|
if (parameters.contains(TextDecoration.Parameter.TARGET)) {
|
||||||
args.add(packet.getSenderTeamName());
|
args.add(packet.getTargetName());
|
||||||
}
|
}
|
||||||
if (parameters.contains(TextDecoration.Parameter.SENDER)) {
|
if (parameters.contains(TextDecoration.Parameter.SENDER)) {
|
||||||
args.add(packet.getSenderName());
|
args.add(packet.getName());
|
||||||
}
|
}
|
||||||
if (parameters.contains(TextDecoration.Parameter.CONTENT)) {
|
if (parameters.contains(TextDecoration.Parameter.CONTENT)) {
|
||||||
args.add(message);
|
args.add(message);
|
||||||
|
@ -28,7 +28,6 @@ package org.geysermc.geyser.translator.protocol.java;
|
|||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundSystemChatPacket;
|
||||||
import com.nukkitx.protocol.bedrock.packet.TextPacket;
|
import com.nukkitx.protocol.bedrock.packet.TextPacket;
|
||||||
import org.geysermc.geyser.session.GeyserSession;
|
import org.geysermc.geyser.session.GeyserSession;
|
||||||
import org.geysermc.geyser.text.ChatTypeEntry;
|
|
||||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||||
import org.geysermc.geyser.translator.protocol.Translator;
|
import org.geysermc.geyser.translator.protocol.Translator;
|
||||||
import org.geysermc.geyser.translator.text.MessageTranslator;
|
import org.geysermc.geyser.translator.text.MessageTranslator;
|
||||||
@ -38,15 +37,11 @@ public class JavaSystemChatTranslator extends PacketTranslator<ClientboundSystem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(GeyserSession session, ClientboundSystemChatPacket packet) {
|
public void translate(GeyserSession session, ClientboundSystemChatPacket packet) {
|
||||||
ChatTypeEntry chatTypeEntry = session.getChatTypes().get(packet.getTypeId());
|
|
||||||
// This probably isn't proper but system chat won't care about the registry in 1.19.1 anyway
|
|
||||||
TextPacket.Type chatType = chatTypeEntry == null ? TextPacket.Type.RAW : chatTypeEntry.bedrockChatType();
|
|
||||||
|
|
||||||
TextPacket textPacket = new TextPacket();
|
TextPacket textPacket = new TextPacket();
|
||||||
textPacket.setPlatformChatId("");
|
textPacket.setPlatformChatId("");
|
||||||
textPacket.setSourceName("");
|
textPacket.setSourceName("");
|
||||||
textPacket.setXuid(session.getAuthData().xuid());
|
textPacket.setXuid(session.getAuthData().xuid());
|
||||||
textPacket.setType(chatType);
|
textPacket.setType(packet.isOverlay() ? TextPacket.Type.TIP : TextPacket.Type.SYSTEM);
|
||||||
|
|
||||||
textPacket.setNeedsTranslation(false);
|
textPacket.setNeedsTranslation(false);
|
||||||
textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.getLocale()));
|
textPacket.setMessage(MessageTranslator.convertMessage(packet.getContent(), session.getLocale()));
|
||||||
|
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.geysermc</groupId>
|
<groupId>org.geysermc</groupId>
|
||||||
<artifactId>geyser-parent</artifactId>
|
<artifactId>geyser-parent</artifactId>
|
||||||
<version>2.0.5-SNAPSHOT</version>
|
<version>2.0.6-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Geyser</name>
|
<name>Geyser</name>
|
||||||
<description>Allows for players from Minecraft Bedrock Edition to join Minecraft Java Edition servers.</description>
|
<description>Allows for players from Minecraft Bedrock Edition to join Minecraft Java Edition servers.</description>
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren