Skip to content

Commit

Permalink
Added stone types suport
Browse files Browse the repository at this point in the history
You can now also directly get andesite, diorite and granite converted without you have to do it self.
  • Loading branch information
broken1arrow committed Apr 23, 2023
1 parent d8029e2 commit b5a45da
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public ItemStack createStack(final String item, int amount) {
if (item.equals("PLAYER_HEAD")) {
return new ItemStack(Material.valueOf("SKULL_ITEM"), amount);
}
if (item.contains("_ANDESITE") || item.contains("_DIORITE") || item.contains("_GRANITE")) {
return getStoneTypes(Material.STONE, item, amount);
}
if (item.equals("CHARCOAL")) {
return new ItemStack(Material.valueOf("COAL"), amount, (short) 1);
} else {
Expand Down Expand Up @@ -279,6 +282,16 @@ public ItemStack checkAndGetWood(final String itemName, final int amount) {
return null;
}

public ItemStack getStoneTypes(final Material material, final String itemName, final int amount) {
if (material == null) return null;
short stonetype = getStoneTypeData(itemName);
if (stonetype == -1)
return new ItemStack(material, amount);
if (stonetype >= 0)
return new ItemStack(material, amount, stonetype);
return null;
}

public ItemStack getWoodItemStack(final Material material, final String itemName, final int amount) {
return getWoodItemStack(material, (short) -1, itemName, amount);
}
Expand All @@ -292,6 +305,28 @@ public ItemStack getWoodItemStack(final Material material, short woodTypeData, f
return null;
}

public short getStoneTypeData(final String itemName) {
if (itemName.equals("GRANITE")) {
return 1;
}
if (itemName.equals("POLISHED_GRANITE")) {
return 2;
}
if (itemName.equals("DIORITE")) {
return 3;
}
if (itemName.equals("POLISHED_DIORITE")) {
return 4;
}
if (itemName.equals("ANDESITE")) {
return 5;
}
if (itemName.equals("POLISHED_ANDESITE")) {
return 6;
}
return -1;
}

public short getWoodTypeData(final String itemName) {
if (itemName.startsWith("DARK_OAK_")) {
return 5;
Expand Down

0 comments on commit b5a45da

Please sign in to comment.