Removed upgrade items in favor of component items

This commit is contained in:
Unknown 2018-02-19 02:50:24 +01:00 committed by LemADEC
parent d835480ac5
commit ea506af4f2
4 changed files with 0 additions and 148 deletions

View file

@ -131,7 +131,6 @@ import cr0s.warpdrive.item.ItemForceFieldUpgrade;
import cr0s.warpdrive.item.ItemIC2reactorLaserFocus;
import cr0s.warpdrive.item.ItemTuningDriver;
import cr0s.warpdrive.item.ItemTuningFork;
import cr0s.warpdrive.item.ItemUpgrade;
import cr0s.warpdrive.item.ItemWarpArmor;
import cr0s.warpdrive.network.PacketHandler;
import cr0s.warpdrive.render.ClientCameraHandler;
@ -245,7 +244,6 @@ public class WarpDrive {
public static Item itemIC2reactorLaserFocus;
public static ItemComponent itemComponent;
public static ItemShipToken itemShipToken;
public static ItemUpgrade itemUpgrade;
public static ItemTuningFork itemTuningFork;
public static ItemTuningDriver itemTuningDriver;
public static ItemForceFieldShape itemForceFieldShape;
@ -641,11 +639,6 @@ public class WarpDrive {
GameRegistry.registerItem(itemAirTanks[index], "itemAirTank" + index);
}
if (WarpDriveConfig.RECIPES_ENABLE_VANILLA) {
itemUpgrade = new ItemUpgrade();
GameRegistry.registerItem(itemUpgrade, "itemUpgrade");
}
// tool items
itemTuningFork = new ItemTuningFork();
GameRegistry.registerItem(itemTuningFork, "itemTuningFork");
@ -859,9 +852,6 @@ public class WarpDrive {
case "WarpDrive:transporter":
mapping.remap(Item.getItemFromBlock(blockTransporter));
break;
case "WarpDrive:upgrade":
mapping.remap(itemUpgrade);
break;
case "WarpDrive:warpCore":
mapping.remap(Item.getItemFromBlock(blockShipCore));
break;

View file

@ -8,13 +8,11 @@ import cr0s.warpdrive.data.EnumComponentType;
import cr0s.warpdrive.data.EnumDecorativeType;
import cr0s.warpdrive.data.EnumForceFieldShape;
import cr0s.warpdrive.data.EnumForceFieldUpgrade;
import cr0s.warpdrive.data.UpgradeType;
import cr0s.warpdrive.item.ItemComponent;
import cr0s.warpdrive.item.ItemElectromagneticCell;
import cr0s.warpdrive.item.ItemForceFieldShape;
import cr0s.warpdrive.item.ItemForceFieldUpgrade;
import cr0s.warpdrive.item.ItemTuningDriver;
import cr0s.warpdrive.item.ItemUpgrade;
import java.util.ArrayList;
@ -110,27 +108,6 @@ public class Recipes {
's', BlockDecorative.getItemStack(EnumDecorativeType.PLAIN),
'c', ItemComponent.getItemStack(EnumComponentType.COMPUTER_INTERFACE)));
// Upgrade items
GameRegistry.addRecipe(new ShapedOreRecipe(ItemUpgrade.getItemStack(UpgradeType.Energy), false, "c", "e", "r",
'c', ItemComponent.getItemStack(EnumComponentType.EMERALD_CRYSTAL),
'e', ItemComponent.getItemStack(EnumComponentType.CAPACITIVE_CRYSTAL),
'r', Items.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(ItemUpgrade.getItemStack(UpgradeType.Power), false, "c", "e", "r",
'c', ItemComponent.getItemStack(EnumComponentType.EMERALD_CRYSTAL),
'e', ItemComponent.getItemStack(EnumComponentType.POWER_INTERFACE),
'r', Items.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(ItemUpgrade.getItemStack(UpgradeType.Speed), false, "c", "e", "r",
'c', ItemComponent.getItemStack(EnumComponentType.EMERALD_CRYSTAL),
'e', Items.sugar,
'r', Items.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(ItemUpgrade.getItemStack(UpgradeType.Range), false, "c", "e", "r",
'c', ItemComponent.getItemStack(EnumComponentType.EMERALD_CRYSTAL),
'e', WarpDrive.blockTransportBeacon,
'r', Items.redstone));
// WarpCore
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockShipCore), false, "ipi", "ici", "idi",
'i', Items.iron_ingot,

View file

@ -1,6 +0,0 @@
package cr0s.warpdrive.data;
public @Deprecated
enum UpgradeType {
Power, Energy, Speed, Range
}

View file

@ -1,109 +0,0 @@
package cr0s.warpdrive.item;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.data.UpgradeType;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemUpgrade extends Item {
private static ItemStack[] isCache = new ItemStack[UpgradeType.values().length];
@SideOnly(Side.CLIENT)
private IIcon[] iconBuffer;
public ItemUpgrade() {
setHasSubtypes(true);
setUnlocalizedName("warpdrive.upgrade.Malformed");
setCreativeTab(WarpDrive.creativeTabWarpDrive);
}
private static boolean isValidDamage(int damage) {
return damage >= 0 && damage < UpgradeType.values().length;
}
public static ItemStack getItemStack(UpgradeType energy) {
if (!isValidDamage(energy.ordinal())) {
return null;
}
if (isCache[energy.ordinal()] == null) {
isCache[energy.ordinal()] = getItemStackNoCache(energy);
}
return isCache[energy.ordinal()];
}
public static ItemStack getItemStackNoCache(UpgradeType energy) {
if (!isValidDamage(energy.ordinal())) {
return null;
}
return new ItemStack(WarpDrive.itemUpgrade, 1, energy.ordinal());
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
if (itemStack == null) {
return null;
}
int damage = itemStack.getItemDamage();
if (isValidDamage(damage)) {
return "item.warpdrive.upgrade." + UpgradeType.values()[damage];
}
return null;
}
@Override
public void getSubItems(Item item, CreativeTabs creativeTab, List list) {
for (UpgradeType upgradeType : UpgradeType.values()) {
list.add(getItemStack(upgradeType));
}
}
@Override
public void addInformation(ItemStack is, EntityPlayer pl, List list, boolean par4) {
if (is == null) {
return;
}
int damage = is.getItemDamage();
if (damage == UpgradeType.Energy.ordinal()) {
list.add("Increases the max energy of the machine");
} else if (damage == UpgradeType.Power.ordinal()) {
list.add("Decreases the power usage of the machine");
} else if (damage == UpgradeType.Speed.ordinal()) {
list.add("Increases the speed of the machine");
} else if (damage == UpgradeType.Range.ordinal()) {
list.add("Increases the range of the machine");
}
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(final IIconRegister iconRegister) {
iconBuffer = new IIcon[UpgradeType.values().length];
for (UpgradeType val : UpgradeType.values()) {
iconBuffer[val.ordinal()] = iconRegister.registerIcon("warpdrive:upgrade" + val);
}
}
@Override
public IIcon getIconFromDamage(int damage) {
if (damage >= 0 && damage < UpgradeType.values().length) {
return iconBuffer[damage];
}
return iconBuffer[0];
}
}