Fix any other potential bugs with the gems or any other forgotten items from the great rename of December 2016. This day shall be known as the day that I have prevented more bugs from the 8 or so bug reports I have caused from a single line of code changed about a week ago. It was a shame that it had gotten so far, but this should make sure that it does not happen again. All ingots/gems/plates/dusts/nuggets/smalldusts now convert any camelCase input to snake_case before handling it. This is probably the longest commit message I have ever written. Closes #860
This commit is contained in:
parent
bfa6e657a6
commit
bdde7859f9
6 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
package techreborn.items;
|
package techreborn.items;
|
||||||
|
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -28,6 +29,7 @@ public class ItemDusts extends ItemTRNoDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getDustByName(String name, int count) {
|
public static ItemStack getDustByName(String name, int count) {
|
||||||
|
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||||
for (int i = 0; i < types.length; i++) {
|
for (int i = 0; i < types.length; i++) {
|
||||||
if (types[i].equalsIgnoreCase(name)) {
|
if (types[i].equalsIgnoreCase(name)) {
|
||||||
if (types[i].equals(ModItems.META_PLACEHOLDER)) {
|
if (types[i].equals(ModItems.META_PLACEHOLDER)) {
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package techreborn.items;
|
package techreborn.items;
|
||||||
|
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import reborncore.common.util.StringUtils;
|
|
||||||
import techreborn.client.TechRebornCreativeTabMisc;
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
import techreborn.init.ModItems;
|
import techreborn.init.ModItems;
|
||||||
import techreborn.lib.ModInfo;
|
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
|
@ -29,6 +28,7 @@ public class ItemDustsSmall extends ItemTRNoDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getSmallDustByName(String name, int count) {
|
public static ItemStack getSmallDustByName(String name, int count) {
|
||||||
|
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||||
for (int i = 0; i < types.length; i++) {
|
for (int i = 0; i < types.length; i++) {
|
||||||
if (types[i].equalsIgnoreCase(name)) {
|
if (types[i].equalsIgnoreCase(name)) {
|
||||||
if (types[i].equals(ModItems.META_PLACEHOLDER)) {
|
if (types[i].equals(ModItems.META_PLACEHOLDER)) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package techreborn.items;
|
package techreborn.items;
|
||||||
|
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -20,6 +21,7 @@ public class ItemGems extends ItemTRNoDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getGemByName(String name, int count) {
|
public static ItemStack getGemByName(String name, int count) {
|
||||||
|
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||||
for (int i = 0; i < types.length; i++) {
|
for (int i = 0; i < types.length; i++) {
|
||||||
if (types[i].equalsIgnoreCase(name)) {
|
if (types[i].equalsIgnoreCase(name)) {
|
||||||
return new ItemStack(ModItems.gems, count, i);
|
return new ItemStack(ModItems.gems, count, i);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package techreborn.items;
|
package techreborn.items;
|
||||||
|
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -22,6 +23,7 @@ public class ItemIngots extends ItemTRNoDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getIngotByName(String name, int count) {
|
public static ItemStack getIngotByName(String name, int count) {
|
||||||
|
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||||
for (int i = 0; i < types.length; i++) {
|
for (int i = 0; i < types.length; i++) {
|
||||||
if (types[i].equalsIgnoreCase(name)) {
|
if (types[i].equalsIgnoreCase(name)) {
|
||||||
return new ItemStack(ModItems.ingots, count, i);
|
return new ItemStack(ModItems.ingots, count, i);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package techreborn.items;
|
package techreborn.items;
|
||||||
|
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -23,6 +24,7 @@ public class ItemNuggets extends ItemTRNoDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getNuggetByName(String name, int count) {
|
public static ItemStack getNuggetByName(String name, int count) {
|
||||||
|
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||||
for (int i = 0; i < types.length; i++) {
|
for (int i = 0; i < types.length; i++) {
|
||||||
if (types[i].equalsIgnoreCase(name)) {
|
if (types[i].equalsIgnoreCase(name)) {
|
||||||
return new ItemStack(ModItems.nuggets, count, i);
|
return new ItemStack(ModItems.nuggets, count, i);
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class ItemPlates extends ItemTRNoDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getPlateByName(String name, int count) {
|
public static ItemStack getPlateByName(String name, int count) {
|
||||||
|
name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
|
||||||
for (int i = 0; i < types.length; i++) {
|
for (int i = 0; i < types.length; i++) {
|
||||||
if (types[i].equalsIgnoreCase(name)) {
|
if (types[i].equalsIgnoreCase(name)) {
|
||||||
return new ItemStack(ModItems.plate, count, i);
|
return new ItemStack(ModItems.plate, count, i);
|
||||||
|
|
Loading…
Reference in a new issue