Skip to content

Commit

Permalink
Add stackSize to ItemEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ-Ferguson committed Jan 4, 2021
1 parent 8928d55 commit a160e36
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@ToString
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 bedrockIdentifier;
Expand All @@ -43,6 +43,7 @@ public class ItemEntry {
private final int bedrockData;

private final boolean block;
private final int stackSize;

@Override
public boolean equals(Object obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,26 +147,30 @@ public static void init() {
if (bedrockIdentifier == null) {
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_tier")) {
ITEM_ENTRIES.put(itemIndex, 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") != null && entry.getValue().get("is_block").booleanValue()));
entry.getValue().get("is_block") != null && entry.getValue().get("is_block").booleanValue(),
stackSize));
} else {
ITEM_ENTRIES.put(itemIndex, 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()));
"", entry.getValue().get("is_block").booleanValue(),
stackSize));
}
} else {
ITEM_ENTRIES.put(itemIndex, new ItemEntry(
entry.getKey(), bedrockIdentifier, itemIndex, bedrockId,
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()) {
case "minecraft:barrier":
Expand Down Expand Up @@ -209,7 +213,7 @@ public static void init() {

// 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));
lodestoneCompassId, 0, false, 1));

/* Load creative items */
stream = FileUtils.getResource("bedrock/creative_items.json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ 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) {
super(javaIdentifier, bedrockIdentifier, javaId, bedrockId, bedrockData, 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, stackSize);
this.toolType = toolType;
this.toolTier = toolTier;
}
Expand Down
2 changes: 1 addition & 1 deletion connector/src/main/resources/mappings
Submodule mappings updated 1 files
+339 −154 items.json

0 comments on commit a160e36

Please sign in to comment.