Search in sources :

Example 1 with EntityTier3Rocket

use of micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityTier3Rocket in project Galacticraft by micdoodle8.

the class ItemTier3Rocket method placeRocketOnPad.

public static boolean placeRocketOnPad(ItemStack stack, World worldIn, 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;
    }
    EntityTier3Rocket rocket = new EntityTier3Rocket(worldIn, centerX, centerY, centerZ, EnumRocketType.values()[stack.getItemDamage()]);
    rocket.rotationYaw += 45;
    rocket.setPosition(rocket.posX, rocket.posY + rocket.getOnPadYOffset(), rocket.posZ);
    worldIn.spawnEntityInWorld(rocket);
    if (rocket.getType().getPreFueled()) {
        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 : FluidStack(net.minecraftforge.fluids.FluidStack) EntityTier3Rocket(micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityTier3Rocket) TileEntityLandingPad(micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad)

Example 2 with EntityTier3Rocket

use of micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityTier3Rocket in project Galacticraft by micdoodle8.

the class RenderTier3Rocket method doRender.

@Override
public void doRender(EntityTier3Rocket entity, double par2, double par4, double par6, float par8, float par9) {
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPushMatrix();
    final float var24 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9 + 180;
    final float var25 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9 + 45;
    GL11.glTranslatef((float) par2, (float) par4 + entity.getRenderOffsetY(), (float) par6);
    GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F);
    final float var28 = entity.rollAmplitude / 3 - par9;
    if (var28 > 0.0F) {
        final float i = entity.getLaunched() ? (5 - MathHelper.floor_double(entity.timeUntilLaunch / 85)) / 10F : 0.3F;
        GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 1.0F);
    }
    updateModel();
    RenderHelper.disableStandardItemLighting();
    this.bindTexture(TextureMap.locationBlocksTexture);
    if (Minecraft.isAmbientOcclusionEnabled()) {
        GlStateManager.shadeModel(GL11.GL_SMOOTH);
    } else {
        GlStateManager.shadeModel(GL11.GL_FLAT);
    }
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    GL11.glScalef(0.8F, 0.8F, 0.8F);
    ClientUtil.drawBakedModel(rocketModel);
    Vector3 teamColor = ClientUtil.updateTeamColor(FMLClientHandler.instance().getClient().thePlayer.getName(), true);
    if (teamColor != null) {
        GL11.glColor3f(teamColor.floatX(), teamColor.floatY(), teamColor.floatZ());
    }
    if (FMLClientHandler.instance().getClient().thePlayer.ticksExisted / 10 % 2 < 1) {
        GL11.glColor3f(1, 0, 0);
    } else {
        GL11.glColor3f(0, 1, 0);
    }
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glColor3f(1, 1, 1);
    GL11.glPopMatrix();
    RenderHelper.enableStandardItemLighting();
}
Also used : Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3)

Example 3 with EntityTier3Rocket

use of micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityTier3Rocket in project Galacticraft by micdoodle8.

the class ItemTier3Rocket 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")) {
        EntityTier3Rocket rocket = new EntityTier3Rocket(FMLClientHandler.instance().getWorldClient(), 0, 0, 0, EnumRocketType.values()[par1ItemStack.getItemDamage()]);
        tooltip.add(GCCoreUtil.translate("gui.message.fuel.name") + ": " + par1ItemStack.getTagCompound().getInteger("RocketFuel") + " / " + rocket.fuelTank.getCapacity());
    }
}
Also used : EnumRocketType(micdoodle8.mods.galacticraft.api.entity.IRocketType.EnumRocketType) EntityTier3Rocket(micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityTier3Rocket) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

EntityTier3Rocket (micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityTier3Rocket)2 EnumRocketType (micdoodle8.mods.galacticraft.api.entity.IRocketType.EnumRocketType)1 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)1 TileEntityLandingPad (micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad)1 FluidStack (net.minecraftforge.fluids.FluidStack)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1