From 893719f77ae2fc765059fd0991953f183d9b20be Mon Sep 17 00:00:00 2001 From: DoctorDark Date: Sun, 20 Jul 2014 08:13:14 +0100 Subject: [PATCH 1/4] Name lookup for blocks. Adds a way to get the friendly name for a given block. --- Lib/src/main/java/me/desht/dhutils/ItemNames.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Lib/src/main/java/me/desht/dhutils/ItemNames.java b/Lib/src/main/java/me/desht/dhutils/ItemNames.java index 336c11b..b386624 100644 --- a/Lib/src/main/java/me/desht/dhutils/ItemNames.java +++ b/Lib/src/main/java/me/desht/dhutils/ItemNames.java @@ -620,6 +620,17 @@ public static String lookup(ItemStack stack) { return result; } + + /** + * Given an item stack, return a friendly printable name for the block, as + * the (English-language) vanilla Minecraft client would display it. + * + * @param block the block + * @return a friendly printable name for the block + */ + public static String lookup(Block block) { + return lookup(new ItemStack(block.getType(), 1, block.getData())); + } /** * Given an item stack return a friendly name for the item, in the form @@ -634,4 +645,5 @@ public static String lookupWithAmount(ItemStack stack) { String s = lookup(stack); return stack.getAmount() + " x " + s; } + } From 503b02856642df9d1999723fea0f34ca84d8b412 Mon Sep 17 00:00:00 2001 From: DoctorDark Date: Sun, 20 Jul 2014 08:18:57 +0100 Subject: [PATCH 2/4] Splash potion changes Fixed the leaping potion id's --- Lib/src/main/java/me/desht/dhutils/ItemNames.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/src/main/java/me/desht/dhutils/ItemNames.java b/Lib/src/main/java/me/desht/dhutils/ItemNames.java index b386624..82f38df 100644 --- a/Lib/src/main/java/me/desht/dhutils/ItemNames.java +++ b/Lib/src/main/java/me/desht/dhutils/ItemNames.java @@ -433,7 +433,6 @@ public class ItemNames { .put("373:8200", "Weakness Potion (1:30)") .put("373:8201", "Strength Potion (3:00)") .put("373:8202", "Slowness Potion (1:30)") - .put("373:8203", "Potion of Leaping (3:00)") .put("373:8204", "Harming Potion") .put("373:8225", "Regeneration Potion II (0:22)") .put("373:8226", "Swiftness Potion II (1:30)") @@ -441,7 +440,7 @@ public class ItemNames { .put("373:8229", "Healing Potion II") .put("373:8230", "Night Vision Potion (3:00)") .put("373:8233", "Strength Potion II (1:30)") - .put("373:8235", "Potion of Leaping (1:30)") + .put("373:8235", "Leaping Potion II (1:30)") .put("373:8236", "Harming Potion II") .put("373:8237", "Water Breathing Potion (3:00)") .put("373:8238", "Invisibility Potion (3:00)") @@ -453,6 +452,7 @@ public class ItemNames { .put("373:8264", "Weakness Potion (4:00)") .put("373:8265", "Strength Potion (8:00)") .put("373:8266", "Slowness Potion (4:00)") + .put("373:8267", "Leaping Potion (3:00)") .put("373:8269", "Water Breathing Potion (8:00)") .put("373:8270", "Invisibility Potion (8:00)") .put("373:16378", "Fire Resistance Splash (2:15)") @@ -469,6 +469,7 @@ public class ItemNames { .put("373:16421", "Healing Splash II") .put("373:16422", "Night Vision Splash (2:15)") .put("373:16425", "Strength Splash II (1:07)") + .put("373:16427", "Leaping Splash II (1:07)") .put("373:16428", "Harming Splash II") .put("373:16429", "Water Breathing Splash (2:15)") .put("373:16430", "Invisibility Splash (2:15)") @@ -480,6 +481,7 @@ public class ItemNames { .put("373:16456", "Weakness Splash (3:00)") .put("373:16457", "Strength Splash (6:00)") .put("373:16458", "Slowness Splash (3:00)") + .put("373:16459", "Leaping Splash (2:15)") .put("373:16461", "Water Breathing Splash (6:00)") .put("373:16462", "Invisibility Splash (6:00)") .put("373:16471", "Regeneration Splash II (0:16)") From 7d85ae9ad2bbefdb185c32c27b87840c3f2cb42d Mon Sep 17 00:00:00 2001 From: DoctorDark Date: Mon, 21 Jul 2014 10:58:47 +0100 Subject: [PATCH 3/4] Indentation fix --- Lib/src/main/java/me/desht/dhutils/ItemNames.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/src/main/java/me/desht/dhutils/ItemNames.java b/Lib/src/main/java/me/desht/dhutils/ItemNames.java index 82f38df..9f2aec8 100644 --- a/Lib/src/main/java/me/desht/dhutils/ItemNames.java +++ b/Lib/src/main/java/me/desht/dhutils/ItemNames.java @@ -630,9 +630,9 @@ public static String lookup(ItemStack stack) { * @param block the block * @return a friendly printable name for the block */ - public static String lookup(Block block) { - return lookup(new ItemStack(block.getType(), 1, block.getData())); - } + public static String lookup(Block block) { + return lookup(new ItemStack(block.getType(), 1, block.getData())); + } /** * Given an item stack return a friendly name for the item, in the form From 2d5aae1fc43bbfca45ed6a98ad61e54e57f0d5a3 Mon Sep 17 00:00:00 2001 From: DoctorDark Date: Mon, 21 Jul 2014 10:59:28 +0100 Subject: [PATCH 4/4] Update ItemNames.java --- Lib/src/main/java/me/desht/dhutils/ItemNames.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/src/main/java/me/desht/dhutils/ItemNames.java b/Lib/src/main/java/me/desht/dhutils/ItemNames.java index 9f2aec8..613d978 100644 --- a/Lib/src/main/java/me/desht/dhutils/ItemNames.java +++ b/Lib/src/main/java/me/desht/dhutils/ItemNames.java @@ -624,7 +624,7 @@ public static String lookup(ItemStack stack) { } /** - * Given an item stack, return a friendly printable name for the block, as + * Given a block, return a friendly printable name for the block, as * the (English-language) vanilla Minecraft client would display it. * * @param block the block