Fixed crash when not running with MCMP

This commit is contained in:
modmuss50 2016-03-27 13:14:57 +01:00
parent a0dea07407
commit 96464980c2
3 changed files with 54 additions and 9 deletions

View file

@ -43,7 +43,7 @@ configurations {
compile.extendsFrom shade
}
version = "1.0.0"
version = "1.0.1"
def ENV = System.getenv()
if (ENV.BUILD_NUMBER) {

View file

@ -0,0 +1,44 @@
package techreborn.parts;
import net.minecraft.util.IStringSerializable;
import reborncore.api.power.EnumPowerTier;
public enum EnumStandaloneCableType implements IStringSerializable
{
COPPER("copper", "techreborn:blocks/cables/copper_cable", 128, 12.0, true, EnumPowerTier.LOW), TIN("tin",
"techreborn:blocks/cables/tin_cable", 32, 12.0, true, EnumPowerTier.MEDIUM), GOLD("gold",
"techreborn:blocks/cables/gold_cable", 512, 12.0, true, EnumPowerTier.MEDIUM), HV("hv",
"techreborn:blocks/cables/hv_cable", 2048, 12.0, true,
EnumPowerTier.HIGH), GLASSFIBER("glassfiber", "techreborn:blocks/cables/glass_fiber_cable",
8192, 12.0, false, EnumPowerTier.HIGH), ICOPPER("insulatedcopper",
"techreborn:blocks/cables/copper_insulated_cable", 128, 10.0, false,
EnumPowerTier.LOW), IGOLD("insulatedgold",
"techreborn:blocks/cables/gold_insulated_cable", 512, 10.0, false,
EnumPowerTier.MEDIUM), IHV("insulatedhv",
"techreborn:blocks/cables/hv_insulated_cable", 2048, 10.0,
false, EnumPowerTier.HIGH);
public String textureName = "minecraft:blocks/iron_block";
public int transferRate = 128;
public double cableThickness = 3.0;
public boolean canKill = false;
public EnumPowerTier tier;
private String friendlyName;
EnumStandaloneCableType(String friendlyName, String textureName, int transferRate, double cableThickness,
boolean canKill, EnumPowerTier tier)
{
this.friendlyName = friendlyName;
this.textureName = textureName;
this.transferRate = transferRate;
this.cableThickness = cableThickness / 2;
this.canKill = canKill;
this.tier = tier;
}
@Override
public String getName()
{
return friendlyName.toLowerCase();
}
}

View file

@ -32,9 +32,9 @@ public class ItemStandaloneCables extends ItemTextureBase
public static ItemStack getCableByName(String name, int count)
{
for (int i = 0; i < EnumCableType.values().length; i++)
for (int i = 0; i < EnumStandaloneCableType.values().length; i++)
{
if (EnumCableType.values()[i].getName().equalsIgnoreCase(name))
if (EnumStandaloneCableType.values()[i].getName().equalsIgnoreCase(name))
{
return new ItemStack(mcPartCable != null ? mcPartCable : StandalonePartCompact.itemStandaloneCable,
count, i);
@ -53,18 +53,18 @@ public class ItemStandaloneCables extends ItemTextureBase
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = itemStack.getItemDamage();
if (meta < 0 || meta >= EnumCableType.values().length)
if (meta < 0 || meta >= EnumStandaloneCableType.values().length)
{
meta = 0;
}
return super.getUnlocalizedName() + "." + EnumCableType.values()[meta];
return super.getUnlocalizedName() + "." + EnumStandaloneCableType.values()[meta];
}
// Adds Dusts SubItems To Creative Tab
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
{
for (int meta = 0; meta < EnumCableType.values().length; ++meta)
for (int meta = 0; meta < EnumStandaloneCableType.values().length; ++meta)
{
list.add(new ItemStack(item, 1, meta));
}
@ -73,13 +73,13 @@ public class ItemStandaloneCables extends ItemTextureBase
@Override
public String getTextureName(int damage)
{
return ModInfo.MOD_ID + ":items/cables/" + EnumCableType.values()[damage].getName();
return ModInfo.MOD_ID + ":items/cables/" + EnumStandaloneCableType.values()[damage].getName();
}
@Override
public int getMaxMeta()
{
return EnumCableType.values().length;
return EnumStandaloneCableType.values().length;
}
// @Override
@ -92,11 +92,12 @@ public class ItemStandaloneCables extends ItemTextureBase
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
EnumCableType type = EnumCableType.values()[stack.getItemDamage()];
EnumStandaloneCableType type = EnumStandaloneCableType.values()[stack.getItemDamage()];
tooltip.add(TextFormatting.GREEN + "EU Transfer: " + TextFormatting.LIGHT_PURPLE + type.transferRate);
if (type.canKill)
{
tooltip.add(TextFormatting.RED + "Damages entity's!");
}
tooltip.add(TextFormatting.RED + "!!INSTALL MCMP TO PLACE CABLES!!");
}
}