Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-08 17:20:20 +01:00
Add stackSize to ItemEntry
Dieser Commit ist enthalten in:
Ursprung
8928d554a1
Commit
a160e3694b
@ -34,7 +34,7 @@ import lombok.ToString;
|
|||||||
@ToString
|
@ToString
|
||||||
public class ItemEntry {
|
public class ItemEntry {
|
||||||
|
|
||||||
public static ItemEntry AIR = new ItemEntry("minecraft:air", "minecraft:air", 0, 0, 0, false);
|
public static ItemEntry AIR = new ItemEntry("minecraft:air", "minecraft:air", 0, 0, 0, false, 64);
|
||||||
|
|
||||||
private final String javaIdentifier;
|
private final String javaIdentifier;
|
||||||
private final String bedrockIdentifier;
|
private final String bedrockIdentifier;
|
||||||
@ -43,6 +43,7 @@ public class ItemEntry {
|
|||||||
private final int bedrockData;
|
private final int bedrockData;
|
||||||
|
|
||||||
private final boolean block;
|
private final boolean block;
|
||||||
|
private final int stackSize;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
@ -147,6 +147,7 @@ public class ItemRegistry {
|
|||||||
if (bedrockIdentifier == null) {
|
if (bedrockIdentifier == null) {
|
||||||
throw new RuntimeException("Missing Bedrock ID in mappings!: " + bedrockId);
|
throw new RuntimeException("Missing Bedrock ID in mappings!: " + bedrockId);
|
||||||
}
|
}
|
||||||
|
int stackSize = entry.getValue().get("stack_size") == null ? 64 : entry.getValue().get("stack_size").intValue();
|
||||||
if (entry.getValue().has("tool_type")) {
|
if (entry.getValue().has("tool_type")) {
|
||||||
if (entry.getValue().has("tool_tier")) {
|
if (entry.getValue().has("tool_tier")) {
|
||||||
ITEM_ENTRIES.put(itemIndex, new ToolItemEntry(
|
ITEM_ENTRIES.put(itemIndex, new ToolItemEntry(
|
||||||
@ -154,19 +155,22 @@ public class ItemRegistry {
|
|||||||
entry.getValue().get("bedrock_data").intValue(),
|
entry.getValue().get("bedrock_data").intValue(),
|
||||||
entry.getValue().get("tool_type").textValue(),
|
entry.getValue().get("tool_type").textValue(),
|
||||||
entry.getValue().get("tool_tier").textValue(),
|
entry.getValue().get("tool_tier").textValue(),
|
||||||
entry.getValue().get("is_block") != null && entry.getValue().get("is_block").booleanValue()));
|
entry.getValue().get("is_block") != null && entry.getValue().get("is_block").booleanValue(),
|
||||||
|
stackSize));
|
||||||
} else {
|
} else {
|
||||||
ITEM_ENTRIES.put(itemIndex, new ToolItemEntry(
|
ITEM_ENTRIES.put(itemIndex, new ToolItemEntry(
|
||||||
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
|
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
|
||||||
entry.getValue().get("bedrock_data").intValue(),
|
entry.getValue().get("bedrock_data").intValue(),
|
||||||
entry.getValue().get("tool_type").textValue(),
|
entry.getValue().get("tool_type").textValue(),
|
||||||
"", entry.getValue().get("is_block").booleanValue()));
|
"", entry.getValue().get("is_block").booleanValue(),
|
||||||
|
stackSize));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ITEM_ENTRIES.put(itemIndex, new ItemEntry(
|
ITEM_ENTRIES.put(itemIndex, new ItemEntry(
|
||||||
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
|
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
|
||||||
entry.getValue().get("bedrock_data").intValue(),
|
entry.getValue().get("bedrock_data").intValue(),
|
||||||
entry.getValue().get("is_block") != null && entry.getValue().get("is_block").booleanValue()));
|
entry.getValue().get("is_block") != null && entry.getValue().get("is_block").booleanValue(),
|
||||||
|
stackSize));
|
||||||
}
|
}
|
||||||
switch (entry.getKey()) {
|
switch (entry.getKey()) {
|
||||||
case "minecraft:barrier":
|
case "minecraft:barrier":
|
||||||
@ -209,7 +213,7 @@ public class ItemRegistry {
|
|||||||
|
|
||||||
// Add the loadstone compass since it doesn't exist on java but we need it for item conversion
|
// 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,
|
ITEM_ENTRIES.put(itemIndex, new ItemEntry("minecraft:lodestone_compass", "minecraft:lodestone_compass", itemIndex,
|
||||||
lodestoneCompassId, 0, false));
|
lodestoneCompassId, 0, false, 1));
|
||||||
|
|
||||||
/* Load creative items */
|
/* Load creative items */
|
||||||
stream = FileUtils.getResource("bedrock/creative_items.json");
|
stream = FileUtils.getResource("bedrock/creative_items.json");
|
||||||
|
@ -32,8 +32,8 @@ public class ToolItemEntry extends ItemEntry {
|
|||||||
private final String toolType;
|
private final String toolType;
|
||||||
private final String toolTier;
|
private final String toolTier;
|
||||||
|
|
||||||
public ToolItemEntry(String javaIdentifier, String bedrockIdentifier, int javaId, int bedrockId, int bedrockData, String toolType, String toolTier, boolean isBlock) {
|
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);
|
super(javaIdentifier, bedrockIdentifier, javaId, bedrockId, bedrockData, isBlock, stackSize);
|
||||||
this.toolType = toolType;
|
this.toolType = toolType;
|
||||||
this.toolTier = toolTier;
|
this.toolTier = toolTier;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 143285afb4bdf4d5ef40ef7a7959477dabf4d34c
|
Subproject commit 62e39acaf3859da86189a76fff57b30c2403ef3d
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren