Fixed crash when not running with MCMP
This commit is contained in:
parent
a0dea07407
commit
96464980c2
3 changed files with 54 additions and 9 deletions
|
@ -43,7 +43,7 @@ configurations {
|
||||||
compile.extendsFrom shade
|
compile.extendsFrom shade
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
|
|
||||||
def ENV = System.getenv()
|
def ENV = System.getenv()
|
||||||
if (ENV.BUILD_NUMBER) {
|
if (ENV.BUILD_NUMBER) {
|
||||||
|
|
44
src/main/java/techreborn/parts/EnumStandaloneCableType.java
Normal file
44
src/main/java/techreborn/parts/EnumStandaloneCableType.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,9 +32,9 @@ public class ItemStandaloneCables extends ItemTextureBase
|
||||||
|
|
||||||
public static ItemStack getCableByName(String name, int count)
|
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,
|
return new ItemStack(mcPartCable != null ? mcPartCable : StandalonePartCompact.itemStandaloneCable,
|
||||||
count, i);
|
count, i);
|
||||||
|
@ -53,18 +53,18 @@ public class ItemStandaloneCables extends ItemTextureBase
|
||||||
public String getUnlocalizedName(ItemStack itemStack)
|
public String getUnlocalizedName(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
int meta = itemStack.getItemDamage();
|
int meta = itemStack.getItemDamage();
|
||||||
if (meta < 0 || meta >= EnumCableType.values().length)
|
if (meta < 0 || meta >= EnumStandaloneCableType.values().length)
|
||||||
{
|
{
|
||||||
meta = 0;
|
meta = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getUnlocalizedName() + "." + EnumCableType.values()[meta];
|
return super.getUnlocalizedName() + "." + EnumStandaloneCableType.values()[meta];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adds Dusts SubItems To Creative Tab
|
// Adds Dusts SubItems To Creative Tab
|
||||||
public void getSubItems(Item item, CreativeTabs creativeTabs, List list)
|
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));
|
list.add(new ItemStack(item, 1, meta));
|
||||||
}
|
}
|
||||||
|
@ -73,13 +73,13 @@ public class ItemStandaloneCables extends ItemTextureBase
|
||||||
@Override
|
@Override
|
||||||
public String getTextureName(int damage)
|
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
|
@Override
|
||||||
public int getMaxMeta()
|
public int getMaxMeta()
|
||||||
{
|
{
|
||||||
return EnumCableType.values().length;
|
return EnumStandaloneCableType.values().length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
|
@ -92,11 +92,12 @@ public class ItemStandaloneCables extends ItemTextureBase
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
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);
|
tooltip.add(TextFormatting.GREEN + "EU Transfer: " + TextFormatting.LIGHT_PURPLE + type.transferRate);
|
||||||
if (type.canKill)
|
if (type.canKill)
|
||||||
{
|
{
|
||||||
tooltip.add(TextFormatting.RED + "Damages entity's!");
|
tooltip.add(TextFormatting.RED + "Damages entity's!");
|
||||||
}
|
}
|
||||||
|
tooltip.add(TextFormatting.RED + "!!INSTALL MCMP TO PLACE CABLES!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue