Search in sources :

Example 11 with EntityAutoRocket

use of micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket in project Galacticraft by micdoodle8.

the class ItemTier2Rocket method placeRocketOnPad.

public static boolean placeRocketOnPad(ItemStack stack, World world, TileEntity tile, float centerX, float centerY, float centerZ) {
    // Check whether there is already a rocket on the pad
    if (tile instanceof TileEntityLandingPad) {
        if (((TileEntityLandingPad) tile).getDockedEntity() != null) {
            return false;
        }
    } else {
        return false;
    }
    EntityAutoRocket rocket;
    if (stack.getItemDamage() < 10) {
        rocket = new EntityTier2Rocket(world, centerX, centerY, centerZ, EnumRocketType.values()[stack.getItemDamage()]);
    } else {
        rocket = new EntityCargoRocket(world, centerX, centerY, centerZ, EnumRocketType.values()[stack.getItemDamage() - 10]);
    }
    rocket.setPosition(rocket.posX, rocket.posY + rocket.getOnPadYOffset(), rocket.posZ);
    world.spawnEntityInWorld(rocket);
    if (((IRocketType) rocket).getType().getPreFueled()) {
        if (rocket instanceof EntityTieredRocket) {
            ((EntityTieredRocket) rocket).fuelTank.fill(new FluidStack(GCFluids.fluidFuel, rocket.getMaxFuel()), true);
        } else {
            ((EntityCargoRocket) rocket).fuelTank.fill(new FluidStack(GCFluids.fluidFuel, rocket.getMaxFuel()), true);
        }
    } else if (stack.hasTagCompound() && stack.getTagCompound().hasKey("RocketFuel")) {
        rocket.fuelTank.fill(new FluidStack(GCFluids.fluidFuel, stack.getTagCompound().getInteger("RocketFuel")), true);
    }
    return true;
}
Also used : EntityCargoRocket(micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket) EntityTieredRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket) FluidStack(net.minecraftforge.fluids.FluidStack) EntityAutoRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket) TileEntityLandingPad(micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad) EntityTier2Rocket(micdoodle8.mods.galacticraft.planets.mars.entities.EntityTier2Rocket)

Example 12 with EntityAutoRocket

use of micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket in project Galacticraft by micdoodle8.

the class ItemTier2Rocket method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer player, List<String> tooltip, boolean b) {
    EnumRocketType type;
    if (par1ItemStack.getItemDamage() < 10) {
        type = EnumRocketType.values()[par1ItemStack.getItemDamage()];
    } else {
        type = EnumRocketType.values()[par1ItemStack.getItemDamage() - 10];
    }
    if (!type.getTooltip().isEmpty()) {
        tooltip.add(type.getTooltip());
    }
    if (type.getPreFueled()) {
        tooltip.add(EnumColor.RED + "\u00a7o" + GCCoreUtil.translate("gui.creative_only.desc"));
    }
    if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("RocketFuel")) {
        EntityAutoRocket rocket;
        if (par1ItemStack.getItemDamage() < 10) {
            rocket = new EntityTier2Rocket(FMLClientHandler.instance().getWorldClient(), 0, 0, 0, EnumRocketType.values()[par1ItemStack.getItemDamage()]);
        } else {
            rocket = new EntityCargoRocket(FMLClientHandler.instance().getWorldClient(), 0, 0, 0, EnumRocketType.values()[par1ItemStack.getItemDamage() - 10]);
        }
        tooltip.add(GCCoreUtil.translate("gui.message.fuel.name") + ": " + par1ItemStack.getTagCompound().getInteger("RocketFuel") + " / " + rocket.fuelTank.getCapacity());
    }
    if (par1ItemStack.getItemDamage() >= 10) {
        tooltip.add(EnumColor.AQUA + GCCoreUtil.translate("gui.requires_controller.desc"));
    }
}
Also used : EntityCargoRocket(micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket) EnumRocketType(micdoodle8.mods.galacticraft.api.entity.IRocketType.EnumRocketType) EntityAutoRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket) EntityTier2Rocket(micdoodle8.mods.galacticraft.planets.mars.entities.EntityTier2Rocket) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

EntityAutoRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket)9 EntitySpaceshipBase (micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase)4 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)4 Entity (net.minecraft.entity.Entity)4 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)3 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 ItemStack (net.minecraft.item.ItemStack)3 EntityTieredRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket)2 EntityBuggy (micdoodle8.mods.galacticraft.core.entities.EntityBuggy)2 EntityCelestialFake (micdoodle8.mods.galacticraft.core.entities.EntityCelestialFake)2 EntityLanderBase (micdoodle8.mods.galacticraft.core.entities.EntityLanderBase)2 IControllableEntity (micdoodle8.mods.galacticraft.core.entities.IControllableEntity)2 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)2 GCPlayerStatsClient (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient)2 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)2 EntityCargoRocket (micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket)2 EntityTier2Rocket (micdoodle8.mods.galacticraft.planets.mars.entities.EntityTier2Rocket)2 WorldServer (net.minecraft.world.WorldServer)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2