diff --git a/README.md b/README.md
index a21a1b6c9..4a522f21f 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ The ultimate goal of this project is to allow Minecraft: Bedrock Edition users t
Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have now joined us here!
-### Currently supporting Minecraft Bedrock v1.16.100 - v1.16.210 and Minecraft Java v1.16.4 - v1.16.5.
+### Currently supporting Minecraft Bedrock v1.16.100 - v1.16.220 and Minecraft Java v1.16.4 - v1.16.5.
## Setting Up
Take a look [here](https://github.com/GeyserMC/Geyser/wiki#Setup) for how to set up Geyser.
diff --git a/bootstrap/bungeecord/pom.xml b/bootstrap/bungeecord/pom.xml
index 10855aed4..a62faa33a 100644
--- a/bootstrap/bungeecord/pom.xml
+++ b/bootstrap/bungeecord/pom.xml
@@ -6,7 +6,7 @@
org.geysermc
bootstrap-parent
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
bootstrap-bungeecord
@@ -14,7 +14,7 @@
org.geysermc
connector
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
compile
diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml
index 4b61a65c3..b06fc59cf 100644
--- a/bootstrap/pom.xml
+++ b/bootstrap/pom.xml
@@ -6,7 +6,7 @@
org.geysermc
geyser-parent
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
bootstrap-parent
pom
diff --git a/bootstrap/spigot/pom.xml b/bootstrap/spigot/pom.xml
index d1cba8aea..12c8292e9 100644
--- a/bootstrap/spigot/pom.xml
+++ b/bootstrap/spigot/pom.xml
@@ -6,7 +6,7 @@
org.geysermc
bootstrap-parent
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
bootstrap-spigot
@@ -14,7 +14,7 @@
org.geysermc
connector
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
compile
diff --git a/bootstrap/sponge/pom.xml b/bootstrap/sponge/pom.xml
index 97c4ac8a4..93ae3ab6b 100644
--- a/bootstrap/sponge/pom.xml
+++ b/bootstrap/sponge/pom.xml
@@ -6,7 +6,7 @@
org.geysermc
bootstrap-parent
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
bootstrap-sponge
@@ -14,7 +14,7 @@
org.geysermc
connector
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
compile
diff --git a/bootstrap/standalone/pom.xml b/bootstrap/standalone/pom.xml
index 831239f66..122991357 100644
--- a/bootstrap/standalone/pom.xml
+++ b/bootstrap/standalone/pom.xml
@@ -6,7 +6,7 @@
org.geysermc
bootstrap-parent
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
bootstrap-standalone
@@ -14,7 +14,7 @@
org.geysermc
connector
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
compile
diff --git a/bootstrap/velocity/pom.xml b/bootstrap/velocity/pom.xml
index 58eee1f77..bcc62ed4c 100644
--- a/bootstrap/velocity/pom.xml
+++ b/bootstrap/velocity/pom.xml
@@ -6,7 +6,7 @@
org.geysermc
bootstrap-parent
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
bootstrap-velocity
@@ -14,7 +14,7 @@
org.geysermc
connector
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
compile
diff --git a/common/pom.xml b/common/pom.xml
index 32c4b1876..e40e40c55 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -6,7 +6,7 @@
org.geysermc
geyser-parent
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
common
diff --git a/connector/pom.xml b/connector/pom.xml
index 6f2cdab4e..90ee8a5c9 100644
--- a/connector/pom.xml
+++ b/connector/pom.xml
@@ -6,7 +6,7 @@
org.geysermc
geyser-parent
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
connector
@@ -20,7 +20,7 @@
org.geysermc
common
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
compile
@@ -31,8 +31,8 @@
com.github.CloudburstMC.Protocol
- bedrock-v428
- 42da92f
+ bedrock-v431
+ f8ecf54
compile
diff --git a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java
index a898ea389..e10ad0afd 100644
--- a/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java
+++ b/connector/src/main/java/org/geysermc/connector/entity/ItemFrameEntity.java
@@ -107,7 +107,7 @@ public class ItemFrameEntity extends Entity {
if (itemData.getTag() != null) {
builder.put("tag", itemData.getTag().toBuilder().build());
}
- builder.putShort("Damage", itemData.getDamage());
+ builder.putShort("Damage", (short) itemData.getDamage());
builder.putString("Name", itemEntry.getBedrockIdentifier());
NbtMapBuilder tag = getDefaultTag().toBuilder();
tag.put("Item", builder.build());
diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java
index 5fdde5272..d575f9521 100644
--- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java
+++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/LlamaEntity.java
@@ -56,9 +56,12 @@ public class LlamaEntity extends ChestedHorseEntity {
// -1 means no armor
if ((int) entityMetadata.getValue() != -1) {
// The damage value is the dye color that Java sends us
- // Always going to be a carpet so we can hardcode 171 in BlockTranslator
- // The int then short conversion is required or we get a ClassCastException
- equipmentPacket.setChestplate(ItemData.of(BlockTranslator.CARPET, (short) ((int) entityMetadata.getValue()), 1));
+ // The item is always going to be a carpet
+ equipmentPacket.setChestplate(ItemData.builder()
+ .id(BlockTranslator.CARPET)
+ .damage((int) entityMetadata.getValue())
+ .count(1)
+ .build());
} else {
equipmentPacket.setChestplate(ItemData.AIR);
}
diff --git a/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java b/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java
index b4e91c1d6..1cfd425d9 100644
--- a/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java
+++ b/connector/src/main/java/org/geysermc/connector/inventory/GeyserItemStack.java
@@ -101,6 +101,7 @@ public class GeyserItemStack {
public ItemData getItemData(GeyserSession session) {
ItemData itemData = ItemTranslator.translateToBedrock(session, getItemStack());
itemData.setNetId(getNetId());
+ itemData.setUsingNetId(true); // Seems silly - this should probably be on the protocol level
return itemData;
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java
index 3b5af7f99..2d29ddd88 100644
--- a/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java
+++ b/connector/src/main/java/org/geysermc/connector/network/BedrockProtocol.java
@@ -29,6 +29,7 @@ import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
import com.nukkitx.protocol.bedrock.v419.Bedrock_v419;
import com.nukkitx.protocol.bedrock.v422.Bedrock_v422;
import com.nukkitx.protocol.bedrock.v428.Bedrock_v428;
+import com.nukkitx.protocol.bedrock.v431.Bedrock_v431;
import java.util.ArrayList;
import java.util.List;
@@ -55,6 +56,7 @@ public class BedrockProtocol {
.minecraftVersion("1.16.200/1.16.201")
.build());
SUPPORTED_BEDROCK_CODECS.add(DEFAULT_BEDROCK_CODEC);
+ SUPPORTED_BEDROCK_CODECS.add(Bedrock_v431.V431_CODEC);
}
/**
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemEntry.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemEntry.java
index 278d708f9..3d92e823c 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemEntry.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemEntry.java
@@ -28,23 +28,32 @@ package org.geysermc.connector.network.translators.item;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
+import org.geysermc.connector.network.translators.world.block.BlockTranslator1_16_210;
@Getter
@AllArgsConstructor
@ToString
public class ItemEntry {
- public static ItemEntry AIR = new ItemEntry("minecraft:air", "minecraft:air", 0, 0, 0, false, 64);
+ public static ItemEntry AIR = new ItemEntry("minecraft:air", "minecraft:air", 0, 0, 0,
+ BlockTranslator1_16_210.INSTANCE.getBedrockAirId(), 64);
private final String javaIdentifier;
private final String bedrockIdentifier;
private final int javaId;
private final int bedrockId;
private final int bedrockData;
-
- private final boolean block;
+ /**
+ * The Bedrock block runtime ID to render this item with. The specific state *does* matter in how this item is rendered.
+ * Required since 1.16.220.
+ */
+ private final int bedrockBlockId;
private final int stackSize;
+ public boolean isBlock() {
+ return bedrockBlockId != -1;
+ }
+
@Override
public boolean equals(Object obj) {
return obj == this || (obj instanceof ItemEntry && ((ItemEntry) obj).getBedrockId() == this.getBedrockId() && ((ItemEntry) obj).getJavaIdentifier().equals(this.getJavaIdentifier()));
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemRegistry.java
index be190f6ff..4690fb700 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemRegistry.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemRegistry.java
@@ -42,6 +42,7 @@ import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import org.geysermc.connector.GeyserConnector;
+import org.geysermc.connector.network.translators.world.block.BlockTranslator1_16_210;
import org.geysermc.connector.utils.FileUtils;
import org.geysermc.connector.utils.LanguageUtils;
@@ -176,54 +177,64 @@ public class ItemRegistry {
}
JsonNode stackSizeNode = entry.getValue().get("stack_size");
int stackSize = stackSizeNode == null ? 64 : stackSizeNode.intValue();
+
+ int bedrockBlockId = -1;
+ JsonNode blockRuntimeIdNode = entry.getValue().get("blockRuntimeId");
+ if (blockRuntimeIdNode != null) {
+ bedrockBlockId = BlockTranslator1_16_210.INSTANCE.getBedrockBlockId(blockRuntimeIdNode.intValue());
+ }
+
+ ItemEntry itemEntry;
if (entry.getValue().has("tool_type")) {
if (entry.getValue().has("tool_tier")) {
- ITEM_ENTRIES.put(itemIndex, new ToolItemEntry(
+ itemEntry = new ToolItemEntry(
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
entry.getValue().get("bedrock_data").intValue(),
entry.getValue().get("tool_type").textValue(),
entry.getValue().get("tool_tier").textValue(),
- entry.getValue().get("is_block").booleanValue(),
- stackSize));
+ bedrockBlockId,
+ stackSize);
} else {
- ITEM_ENTRIES.put(itemIndex, new ToolItemEntry(
+ itemEntry = new ToolItemEntry(
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
entry.getValue().get("bedrock_data").intValue(),
entry.getValue().get("tool_type").textValue(),
- "", entry.getValue().get("is_block").booleanValue(),
- stackSize));
+ "", bedrockBlockId,
+ stackSize);
}
} else {
- ITEM_ENTRIES.put(itemIndex, new ItemEntry(
+ itemEntry = new ItemEntry(
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
entry.getValue().get("bedrock_data").intValue(),
- entry.getValue().get("is_block").booleanValue(),
- stackSize));
+ bedrockBlockId,
+ stackSize);
}
+ ITEM_ENTRIES.put(itemIndex, itemEntry);
+
switch (entry.getKey()) {
case "minecraft:barrier":
BARRIER_INDEX = itemIndex;
break;
case "minecraft:bamboo":
- BAMBOO = ITEM_ENTRIES.get(itemIndex);
+ BAMBOO = itemEntry;
break;
case "minecraft:egg":
- EGG = ITEM_ENTRIES.get(itemIndex);
+ EGG = itemEntry;
break;
case "minecraft:gold_ingot":
- GOLD = ITEM_ENTRIES.get(itemIndex);
+ GOLD = itemEntry;
break;
case "minecraft:shield":
- SHIELD = ITEM_ENTRIES.get(itemIndex);
+ SHIELD = itemEntry;
break;
case "minecraft:milk_bucket":
- MILK_BUCKET = ITEM_ENTRIES.get(itemIndex);
+ MILK_BUCKET = itemEntry;
break;
case "minecraft:wheat":
- WHEAT = ITEM_ENTRIES.get(itemIndex);
+ WHEAT = itemEntry;
break;
case "minecraft:writable_book":
- WRITABLE_BOOK = ITEM_ENTRIES.get(itemIndex);
+ WRITABLE_BOOK = itemEntry;
break;
default:
break;
@@ -249,7 +260,7 @@ public class ItemRegistry {
// Add the loadstone compass since it doesn't exist on java but we need it for item conversion
ITEM_ENTRIES.put(itemIndex, new ItemEntry("minecraft:lodestone_compass", "minecraft:lodestone_compass", itemIndex,
- lodestoneCompassId, 0, false, 1));
+ lodestoneCompassId, 0, -1, 1));
/* Load creative items */
stream = FileUtils.getResource("bedrock/creative_items.json");
@@ -261,11 +272,24 @@ public class ItemRegistry {
throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.toolbox.fail.creative"), e);
}
+ Set javaOnlyItems = new ObjectOpenHashSet<>();
+ Collections.addAll(javaOnlyItems, "minecraft:spectral_arrow", "minecraft:debug_stick",
+ "minecraft:knowledge_book", "minecraft:tipped_arrow");
+ if (!usingFurnaceMinecart) {
+ javaOnlyItems.add("minecraft:furnace_minecart");
+ }
+ JAVA_ONLY_ITEMS = ImmutableSet.copyOf(javaOnlyItems);
+
int netId = 1;
List creativeItems = new ArrayList<>();
for (JsonNode itemNode : creativeItemEntries) {
- ItemData item = getBedrockItemFromJson(itemNode);
- creativeItems.add(ItemData.fromNet(netId++, item.getId(), item.getDamage(), item.getCount(), item.getTag()));
+ ItemData.Builder item = getBedrockItemFromJson(itemNode);
+ int bedrockRuntimeId = 0;
+ ItemEntry itemEntry = getItem(item.build()); // please
+ if (itemEntry.isBlock()) {
+ bedrockRuntimeId = itemEntry.getBedrockBlockId();
+ }
+ creativeItems.add(item.netId(netId++).blockRuntimeId(bedrockRuntimeId).build());
}
if (usingFurnaceMinecart) {
@@ -274,8 +298,11 @@ public class ItemRegistry {
ITEMS.add(new StartGamePacket.ItemEntry("geysermc:furnace_minecart", (short) furnaceMinecartId, true));
ITEM_ENTRIES.put(javaFurnaceMinecartId, new ItemEntry("minecraft:furnace_minecart", "geysermc:furnace_minecart", javaFurnaceMinecartId,
- furnaceMinecartId, 0, false, 1));
- creativeItems.add(ItemData.fromNet(netId, furnaceMinecartId, (short) 0, 1, null));
+ furnaceMinecartId, 0, -1, 1));
+ creativeItems.add(ItemData.builder()
+ .netId(netId)
+ .id(furnaceMinecartId)
+ .count(1).build());
NbtMapBuilder builder = NbtMap.builder();
builder.putString("name", "geysermc:furnace_minecart")
@@ -312,14 +339,6 @@ public class ItemRegistry {
CREATIVE_ITEMS = creativeItems.toArray(new ItemData[0]);
ITEM_NAMES = itemNames.toArray(new String[0]);
-
- Set javaOnlyItems = new ObjectOpenHashSet<>();
- Collections.addAll(javaOnlyItems, "minecraft:spectral_arrow", "minecraft:debug_stick",
- "minecraft:knowledge_book", "minecraft:tipped_arrow");
- if (!usingFurnaceMinecart) {
- javaOnlyItems.add("minecraft:furnace_minecart");
- }
- JAVA_ONLY_ITEMS = ImmutableSet.copyOf(javaOnlyItems);
}
/**
@@ -376,11 +395,11 @@ public class ItemRegistry {
}
/**
- * Gets a Bedrock {@link ItemData} from a {@link JsonNode}
+ * Gets a Bedrock {@link com.nukkitx.protocol.bedrock.data.inventory.ItemData.Builder} from a {@link JsonNode}
* @param itemNode the JSON node that contains ProxyPass-compatible Bedrock item data
* @return
*/
- public static ItemData getBedrockItemFromJson(JsonNode itemNode) {
+ public static ItemData.Builder getBedrockItemFromJson(JsonNode itemNode) {
int count = 1;
short damage = 0;
NbtMap tag = null;
@@ -399,6 +418,10 @@ public class ItemRegistry {
e.printStackTrace();
}
}
- return ItemData.of(itemNode.get("id").asInt(), damage, count, tag);
+ return ItemData.builder()
+ .id(itemNode.get("id").asInt())
+ .damage(damage)
+ .count(count)
+ .tag(tag);
}
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java
index f1ae98faf..2cd1aad94 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ItemTranslator.java
@@ -149,12 +149,15 @@ public abstract class ItemTranslator {
translateDisplayProperties(session, nbt);
- ItemData itemData;
+ ItemData.Builder builder;
ItemTranslator itemStackTranslator = ITEM_STACK_TRANSLATORS.get(bedrockItem.getJavaId());
if (itemStackTranslator != null) {
- itemData = itemStackTranslator.translateToBedrock(itemStack, bedrockItem);
+ builder = itemStackTranslator.translateToBedrock(itemStack, bedrockItem);
} else {
- itemData = DEFAULT_TRANSLATOR.translateToBedrock(itemStack, bedrockItem);
+ builder = DEFAULT_TRANSLATOR.translateToBedrock(itemStack, bedrockItem);
+ }
+ if (bedrockItem.isBlock()) {
+ builder.blockRuntimeId(bedrockItem.getBedrockBlockId());
}
if (nbt != null) {
@@ -165,10 +168,11 @@ public abstract class ItemTranslator {
String[] canPlace = new String[0];
canBreak = getCanModify(session, canDestroy, canBreak);
canPlace = getCanModify(session, canPlaceOn, canPlace);
- itemData = ItemData.of(itemData.getId(), itemData.getDamage(), itemData.getCount(), itemData.getTag(), canPlace, canBreak);
+ builder.canBreak(canBreak);
+ builder.canPlace(canPlace);
}
- return itemData;
+ return builder.build();
}
/**
@@ -202,14 +206,19 @@ public abstract class ItemTranslator {
}
};
- public ItemData translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
+ public ItemData.Builder translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
if (itemStack == null) {
- return ItemData.AIR;
+ // Return, essentially, air
+ return ItemData.builder();
}
- if (itemStack.getNbt() == null) {
- return ItemData.of(itemEntry.getBedrockId(), (short) itemEntry.getBedrockData(), itemStack.getAmount());
+ ItemData.Builder builder = ItemData.builder()
+ .id(itemEntry.getBedrockId())
+ .damage(itemEntry.getBedrockData())
+ .count(itemStack.getAmount());
+ if (itemStack.getNbt() != null) {
+ builder.tag(this.translateNbtToBedrock(itemStack.getNbt()));
}
- return ItemData.of(itemEntry.getBedrockId(), (short) itemEntry.getBedrockData(), itemStack.getAmount(), this.translateNbtToBedrock(itemStack.getNbt()));
+ return builder;
}
public ItemStack translateToJava(ItemData itemData, ItemEntry itemEntry) {
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/Potion.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/Potion.java
index d81e059e9..4e710c550 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/Potion.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/Potion.java
@@ -91,7 +91,7 @@ public enum Potion {
return null;
}
- public static Potion getByBedrockId(short bedrockId) {
+ public static Potion getByBedrockId(int bedrockId) {
for (Potion potion : Potion.values()) {
if (potion.bedrockId == bedrockId) {
return potion;
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/RecipeRegistry.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/RecipeRegistry.java
index 110014bf5..b570df8a1 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/RecipeRegistry.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/RecipeRegistry.java
@@ -272,7 +272,11 @@ public class RecipeRegistry {
e.printStackTrace();
}
}
- return ItemData.of(itemEntry.getBedrockId(), damage, count, tag);
+ return ItemData.builder()
+ .id(itemEntry.getBedrockId())
+ .damage(damage)
+ .count(count)
+ .tag(tag).build();
}
public static void init() {
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java
index 0125dae05..5aac09790 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/TippedArrowPotion.java
@@ -100,7 +100,7 @@ public enum TippedArrowPotion {
return null;
}
- public static TippedArrowPotion getByBedrockId(short bedrockId) {
+ public static TippedArrowPotion getByBedrockId(int bedrockId) {
for (TippedArrowPotion potion : TippedArrowPotion.values()) {
if (potion.bedrockId == bedrockId) {
return potion;
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/ToolItemEntry.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/ToolItemEntry.java
index ba1753a35..2e93811c0 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/ToolItemEntry.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/ToolItemEntry.java
@@ -32,8 +32,9 @@ public class ToolItemEntry extends ItemEntry {
private final String toolType;
private final String toolTier;
- public ToolItemEntry(String javaIdentifier, String bedrockIdentifier, int javaId, int bedrockId, int bedrockData, String toolType, String toolTier, boolean isBlock, int stackSize) {
- super(javaIdentifier, bedrockIdentifier, javaId, bedrockId, bedrockData, isBlock, stackSize);
+ public ToolItemEntry(String javaIdentifier, String bedrockIdentifier, int javaId, int bedrockId, int bedrockData,
+ String toolType, String toolTier, int bedrockBlockId, int stackSize) {
+ super(javaIdentifier, bedrockIdentifier, javaId, bedrockId, bedrockData, bedrockBlockId, stackSize);
this.toolType = toolType;
this.toolTier = toolTier;
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java
index a96c47f6a..b127e1928 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/BannerTranslator.java
@@ -153,30 +153,30 @@ public class BannerTranslator extends ItemTranslator {
}
@Override
- public ItemData translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
+ public ItemData.Builder translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
if (itemStack.getNbt() == null) {
return super.translateToBedrock(itemStack, itemEntry);
}
- ItemData itemData = super.translateToBedrock(itemStack, itemEntry);
+ ItemData.Builder builder = super.translateToBedrock(itemStack, itemEntry);
CompoundTag blockEntityTag = itemStack.getNbt().get("BlockEntityTag");
if (blockEntityTag != null && blockEntityTag.contains("Patterns")) {
ListTag patterns = blockEntityTag.get("Patterns");
- NbtMapBuilder builder = itemData.getTag().toBuilder();
+ NbtMapBuilder nbtBuilder = builder.build().getTag().toBuilder(); //TODO fix ugly hack
if (patterns.equals(OMINOUS_BANNER_PATTERN)) {
// Remove the current patterns and set the ominous banner type
- builder.remove("Patterns");
- builder.putInt("Type", 1);
+ nbtBuilder.remove("Patterns");
+ nbtBuilder.putInt("Type", 1);
} else {
- builder.put("Patterns", convertBannerPattern(patterns));
+ nbtBuilder.put("Patterns", convertBannerPattern(patterns));
}
- itemData = ItemData.of(itemData.getId(), itemData.getDamage(), itemData.getCount(), builder.build());
+ builder.tag(nbtBuilder.build());
}
- return itemData;
+ return builder;
}
@Override
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java
index 9e3bf7d46..08c7426fe 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/CompassTranslator.java
@@ -47,7 +47,7 @@ public class CompassTranslator extends ItemTranslator {
}
@Override
- public ItemData translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
+ public ItemData.Builder translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
if (itemStack.getNbt() == null) return super.translateToBedrock(itemStack, itemEntry);
Tag lodestoneTag = itemStack.getNbt().get("LodestoneTracked");
@@ -75,9 +75,7 @@ public class CompassTranslator extends ItemTranslator {
}
}
- ItemData itemData = super.translateToBedrock(itemStack, itemEntry);
-
- return itemData;
+ return super.translateToBedrock(itemStack, itemEntry);
}
@Override
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java
index 20a36c9e2..9f41472fe 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/PotionTranslator.java
@@ -49,13 +49,17 @@ public class PotionTranslator extends ItemTranslator {
}
@Override
- public ItemData translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
+ public ItemData.Builder translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
if (itemStack.getNbt() == null) return super.translateToBedrock(itemStack, itemEntry);
Tag potionTag = itemStack.getNbt().get("Potion");
if (potionTag instanceof StringTag) {
Potion potion = Potion.getByJavaIdentifier(((StringTag) potionTag).getValue());
if (potion != null) {
- return ItemData.of(itemEntry.getBedrockId(), potion.getBedrockId(), itemStack.getAmount(), translateNbtToBedrock(itemStack.getNbt()));
+ return ItemData.builder()
+ .id(itemEntry.getBedrockId())
+ .damage(potion.getBedrockId())
+ .count(itemStack.getAmount())
+ .tag(translateNbtToBedrock(itemStack.getNbt()));
}
GeyserConnector.getInstance().getLogger().debug("Unknown Java potion: " + potionTag.getValue());
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java
index dd151dcd8..8b64732c4 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/TippedArrowTranslator.java
@@ -52,7 +52,7 @@ public class TippedArrowTranslator extends ItemTranslator {
}
@Override
- public ItemData translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
+ public ItemData.Builder translateToBedrock(ItemStack itemStack, ItemEntry itemEntry) {
if (!itemEntry.getJavaIdentifier().equals("minecraft:tipped_arrow") || itemStack.getNbt() == null) {
// We're only concerned about minecraft:arrow when translating Bedrock -> Java
return super.translateToBedrock(itemStack, itemEntry);
@@ -61,7 +61,11 @@ public class TippedArrowTranslator extends ItemTranslator {
if (potionTag instanceof StringTag) {
TippedArrowPotion tippedArrowPotion = TippedArrowPotion.getByJavaIdentifier(((StringTag) potionTag).getValue());
if (tippedArrowPotion != null) {
- return ItemData.of(itemEntry.getBedrockId(), tippedArrowPotion.getBedrockId(), itemStack.getAmount(), translateNbtToBedrock(itemStack.getNbt()));
+ return ItemData.builder()
+ .id(itemEntry.getBedrockId())
+ .damage(tippedArrowPotion.getBedrockId())
+ .count(itemStack.getAmount())
+ .tag(translateNbtToBedrock(itemStack.getNbt()));
}
GeyserConnector.getInstance().getLogger().debug("Unknown Java potion (tipped arrow): " + potionTag.getValue());
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java
index 2af803807..ae52e4221 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/item/translators/nbt/CrossbowTranslator.java
@@ -55,7 +55,7 @@ public class CrossbowTranslator extends NbtItemStackTranslator {
newProjectile.put(new ByteTag("Count", (byte) itemData.getCount()));
newProjectile.put(new StringTag("Name", projectileEntry.getBedrockIdentifier()));
- newProjectile.put(new ShortTag("Damage", itemData.getDamage()));
+ newProjectile.put(new ShortTag("Damage", (short) itemData.getDamage()));
itemTag.put(newProjectile);
}
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java
index 7de101811..942bc7fdc 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareCommandsTranslator.java
@@ -30,8 +30,8 @@ import com.github.steveice10.mc.protocol.data.game.command.CommandParser;
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerDeclareCommandsPacket;
import com.nukkitx.protocol.bedrock.data.command.CommandData;
import com.nukkitx.protocol.bedrock.data.command.CommandEnumData;
+import com.nukkitx.protocol.bedrock.data.command.CommandParam;
import com.nukkitx.protocol.bedrock.data.command.CommandParamData;
-import com.nukkitx.protocol.bedrock.data.command.CommandParamType;
import com.nukkitx.protocol.bedrock.packet.AvailableCommandsPacket;
import it.unimi.dsi.fastutil.Hash;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
@@ -200,47 +200,47 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator=", "==", etc
- return CommandParamType.OPERATOR;
+ return CommandParam.OPERATOR;
case BLOCK_STATE:
return BlockTranslator.getAllBlockIdentifiers();
@@ -261,7 +261,7 @@ public class JavaDeclareCommandsTranslator extends PacketTranslator
diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java
index bf78d52c6..693bf94f3 100644
--- a/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java
+++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/JavaDeclareRecipesTranslator.java
@@ -69,7 +69,7 @@ public class JavaDeclareRecipesTranslator extends PacketTranslator4.0.0
org.geysermc
geyser-parent
- 1.2.0-SNAPSHOT
+ 1.2.1-SNAPSHOT
pom
Geyser
Allows for players from Minecraft Bedrock Edition to join Minecraft Java Edition servers.