Search in sources :

Example 1 with JetPlate

use of tonius.simplyjetpacks.item.meta.JetPlate in project SimplyJetpacks by Tonius.

the class UpgradingRecipe method getCraftingResult.

@Override
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
    int addedEnergy = 0;
    ParticleType particleType = null;
    NBTTagCompound tags = null;
    boolean enderiumUpgrade = false;
    ItemStack slotStack;
    for (int i = 0; i < inventoryCrafting.getSizeInventory(); i++) {
        slotStack = inventoryCrafting.getStackInSlot(i);
        if (slotStack != null && slotStack.getItem() != null) {
            if (slotStack.getItem() instanceof ItemPack) {
                tags = (NBTTagCompound) NBTHelper.getNBT(slotStack).copy();
            }
            if (slotStack.getItem() instanceof IEnergyContainerItem) {
                addedEnergy += ((IEnergyContainerItem) slotStack.getItem()).getEnergyStored(slotStack);
            } else if (slotStack.getItem() == ModItems.particleCustomizers) {
                particleType = ParticleType.values()[slotStack.getItemDamage()];
            } else if (ModItems.enderiumUpgrade != null && slotStack.getItem() == ModItems.enderiumUpgrade.getItem() && slotStack.getItemDamage() == ModItems.enderiumUpgrade.getItemDamage()) {
                enderiumUpgrade = true;
            }
        }
    }
    ItemStack result = new ItemStack((Item) this.resultItem, 1, this.resultMeta);
    if (tags != null) {
        result.setTagCompound(tags);
    }
    NBTHelper.getNBT(result).setInteger("Energy", Math.min(addedEnergy, this.resultItem.getMaxEnergyStored(result)));
    if (this.resultItem instanceof ItemJetpack && particleType != null) {
        ((ItemJetpack) this.resultItem).getPack(result).setParticleType(result, particleType);
    }
    if (enderiumUpgrade && this.resultItem instanceof ItemPack) {
        PackBase pack = ((ItemPack) this.resultItem).getPack(result);
        if (pack instanceof JetPlate) {
            ((JetPlate) pack).setEnderiumUpgrade(result, true);
        }
    }
    return result;
}
Also used : ItemJetpack(tonius.simplyjetpacks.item.ItemPack.ItemJetpack) JetPlate(tonius.simplyjetpacks.item.meta.JetPlate) PackBase(tonius.simplyjetpacks.item.meta.PackBase) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ParticleType(tonius.simplyjetpacks.setup.ParticleType) ItemPack(tonius.simplyjetpacks.item.ItemPack) ItemStack(net.minecraft.item.ItemStack) IEnergyContainerItem(cofh.api.energy.IEnergyContainerItem)

Example 2 with JetPlate

use of tonius.simplyjetpacks.item.meta.JetPlate in project SimplyJetpacks by Tonius.

the class Packs method preInit.

public static void preInit() {
    jetpackPotato = new JetpackPotato(0, EnumRarity.common, "jetpackPotato");
    jetpackCreative = (Jetpack) new JetPlate(9001, EnumRarity.epic, "jetpackCreative").setDefaultParticleType(ParticleType.RAINBOW_SMOKE).setUsesFuel(false).setHasFuelIndicator(false).setShowEmptyInCreativeTab(false);
    fluxPackCreative = (FluxPack) new FluxPack(9001, EnumRarity.epic, "fluxPackCreative").setUsesFuel(false).setHasFuelIndicator(false).setShowEmptyInCreativeTab(false).setIsArmored(true).setShowArmored(false);
    if (ModType.THERMAL_EXPANSION.loaded) {
        jetpackTE1 = new Jetpack(1, EnumRarity.common, "jetpackTE1");
        jetpackTE1Armored = (Jetpack) new Jetpack(1, EnumRarity.common, "jetpackTE1").setIsArmored(true).setPlatingMeta(1);
        jetpackTE2 = new Jetpack(2, EnumRarity.common, "jetpackTE2");
        jetpackTE2Armored = (Jetpack) new Jetpack(2, EnumRarity.common, "jetpackTE2").setIsArmored(true).setPlatingMeta(2);
        jetpackTE3 = new Jetpack(3, EnumRarity.uncommon, "jetpackTE3");
        jetpackTE3Armored = (Jetpack) new Jetpack(3, EnumRarity.uncommon, "jetpackTE3").setIsArmored(true).setPlatingMeta(3);
        jetpackTE4 = new Jetpack(4, EnumRarity.rare, "jetpackTE4");
        jetpackTE4Armored = (Jetpack) new Jetpack(4, EnumRarity.rare, "jetpackTE4").setIsArmored(true).setPlatingMeta(4);
        jetpackTE5 = (Jetpack) new JetPlate(5, EnumRarity.epic, "jetpackTE5").setFluxBased(true);
        fluxPackTE1 = new FluxPack(1, EnumRarity.common, "fluxPackTE1");
        fluxPackTE2 = new FluxPack(2, EnumRarity.common, "fluxPackTE2");
        fluxPackTE2Armored = (FluxPack) new FluxPack(2, EnumRarity.common, "fluxPackTE2").setIsArmored(true).setPlatingMeta(1);
        fluxPackTE3 = new FluxPack(3, EnumRarity.uncommon, "fluxPackTE3");
        fluxPackTE3Armored = (FluxPack) new FluxPack(3, EnumRarity.uncommon, "fluxPackTE3").setIsArmored(true).setPlatingMeta(2);
        fluxPackTE4 = new FluxPack(4, EnumRarity.rare, "fluxPackTE4");
        fluxPackTE4Armored = (FluxPack) new FluxPack(4, EnumRarity.rare, "fluxPackTE4").setIsArmored(true).setPlatingMeta(3);
    }
    if (ModType.ENDER_IO.loaded) {
        jetpackEIO1 = new Jetpack(1, EnumRarity.common, "jetpackEIO1");
        jetpackEIO1Armored = (Jetpack) new Jetpack(1, EnumRarity.common, "jetpackEIO1").setIsArmored(true).setPlatingMeta(11);
        jetpackEIO2 = new Jetpack(2, EnumRarity.common, "jetpackEIO2");
        jetpackEIO2Armored = (Jetpack) new Jetpack(2, EnumRarity.common, "jetpackEIO2").setIsArmored(true).setPlatingMeta(12);
        jetpackEIO3 = new Jetpack(3, EnumRarity.uncommon, "jetpackEIO3");
        jetpackEIO3Armored = (Jetpack) new Jetpack(3, EnumRarity.uncommon, "jetpackEIO3").setIsArmored(true).setPlatingMeta(13);
        jetpackEIO4 = new Jetpack(4, EnumRarity.rare, "jetpackEIO4");
        jetpackEIO4Armored = (Jetpack) new Jetpack(4, EnumRarity.rare, "jetpackEIO4").setIsArmored(true).setPlatingMeta(14);
        jetpackEIO5 = new JetPlate(5, EnumRarity.epic, "jetpackEIO5");
        fluxPackEIO1 = new FluxPack(1, EnumRarity.common, "fluxPackEIO1");
        fluxPackEIO2 = new FluxPack(2, EnumRarity.common, "fluxPackEIO2");
        fluxPackEIO2Armored = (FluxPack) new FluxPack(2, EnumRarity.common, "fluxPackEIO2").setIsArmored(true).setPlatingMeta(11);
        fluxPackEIO3 = new FluxPack(3, EnumRarity.uncommon, "fluxPackEIO3");
        fluxPackEIO3Armored = (FluxPack) new FluxPack(3, EnumRarity.uncommon, "fluxPackEIO3").setIsArmored(true).setPlatingMeta(12);
        fluxPackEIO4 = new FluxPack(4, EnumRarity.rare, "fluxPackEIO4");
        fluxPackEIO4Armored = (FluxPack) new FluxPack(4, EnumRarity.rare, "fluxPackEIO4").setIsArmored(true).setPlatingMeta(13);
    }
    if (ModType.BUILDCRAFT.loaded) {
        boolean energyFactoryLoaded = Loader.isModLoaded("BuildCraft|Energy") && Loader.isModLoaded("BuildCraft|Factory");
        if (energyFactoryLoaded) {
            jetpackBC1 = (Jetpack) new Jetpack(1, EnumRarity.common, "jetpackBC1").setFuelFluid("fuel");
            jetpackBC1Armored = (Jetpack) new Jetpack(1, EnumRarity.common, "jetpackBC1").setFuelFluid("fuel").setIsArmored(true).setPlatingMeta(21);
        }
        jetpackBC2 = (Jetpack) new Jetpack(2, EnumRarity.uncommon, "jetpackBC2").setShowTier(energyFactoryLoaded);
        jetpackBC2Armored = (Jetpack) new Jetpack(2, EnumRarity.uncommon, "jetpackBC2").setIsArmored(true).setPlatingMeta(22).setShowTier(energyFactoryLoaded);
    }
}
Also used : JetpackPotato(tonius.simplyjetpacks.item.meta.JetpackPotato) JetPlate(tonius.simplyjetpacks.item.meta.JetPlate) FluxPack(tonius.simplyjetpacks.item.meta.FluxPack) Jetpack(tonius.simplyjetpacks.item.meta.Jetpack)

Aggregations

JetPlate (tonius.simplyjetpacks.item.meta.JetPlate)2 IEnergyContainerItem (cofh.api.energy.IEnergyContainerItem)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 ItemPack (tonius.simplyjetpacks.item.ItemPack)1 ItemJetpack (tonius.simplyjetpacks.item.ItemPack.ItemJetpack)1 FluxPack (tonius.simplyjetpacks.item.meta.FluxPack)1 Jetpack (tonius.simplyjetpacks.item.meta.Jetpack)1 JetpackPotato (tonius.simplyjetpacks.item.meta.JetpackPotato)1 PackBase (tonius.simplyjetpacks.item.meta.PackBase)1 ParticleType (tonius.simplyjetpacks.setup.ParticleType)1