Search in sources :

Example 1 with EntityInfectedPurloniteBomb

use of stevekung.mods.moreplanets.planets.diona.entity.EntityInfectedPurloniteBomb in project MorePlanets by SteveKunG.

the class ItemInfectedPurloniteBomb method onItemRightClick.

@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    ItemStack itemStack = player.getHeldItem(hand);
    if (!player.capabilities.isCreativeMode) {
        itemStack.shrink(1);
    }
    world.playSound(null, player.getPosition(), SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
    player.swingArm(hand);
    if (!world.isRemote) {
        EntityInfectedPurloniteBomb bomb = new EntityInfectedPurloniteBomb(world, player);
        bomb.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
        world.spawnEntity(bomb);
    }
    player.addStat(StatList.getObjectUseStats(this));
    return new ActionResult<>(EnumActionResult.SUCCESS, itemStack);
}
Also used : EnumActionResult(net.minecraft.util.EnumActionResult) ActionResult(net.minecraft.util.ActionResult) ItemStack(net.minecraft.item.ItemStack) EntityInfectedPurloniteBomb(stevekung.mods.moreplanets.planets.diona.entity.EntityInfectedPurloniteBomb)

Example 2 with EntityInfectedPurloniteBomb

use of stevekung.mods.moreplanets.planets.diona.entity.EntityInfectedPurloniteBomb in project MorePlanets by SteveKunG.

the class RenderInfectedPurloniteBomb method render.

public void render() {
    EntityInfectedPurloniteBomb entity = new EntityInfectedPurloniteBomb(Minecraft.getMinecraft().world);
    GlStateManager.translate(0.5F, 0.5F, 0.5F);
    GlStateManager.rotate(0.0F, 0.0F, 0.0F, 0.0F);
    GlStateManager.scale(1.0F, 1.0F, 1.0F);
    GlStateManager.pushMatrix();
    GlStateManager.translate(0.0F, 1.5F, 0.0F);
    GlStateManager.scale(-1.0F, -1.0F, 1.0F);
    Minecraft.getMinecraft().renderEngine.bindTexture(RenderInfectedPurloniteBomb.TEXTURE);
    this.model.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
    float lightMapSaveX = OpenGlHelper.lastBrightnessX;
    float lightMapSaveY = OpenGlHelper.lastBrightnessY;
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
    GlStateManager.disableLighting();
    Minecraft.getMinecraft().renderEngine.bindTexture(RenderInfectedPurloniteBomb.GLOW);
    this.model.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
    GlStateManager.enableBlend();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
    OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightMapSaveX, lightMapSaveY);
    GlStateManager.popMatrix();
    GlStateManager.enableBlend();
}
Also used : EntityInfectedPurloniteBomb(stevekung.mods.moreplanets.planets.diona.entity.EntityInfectedPurloniteBomb)

Aggregations

EntityInfectedPurloniteBomb (stevekung.mods.moreplanets.planets.diona.entity.EntityInfectedPurloniteBomb)2 ItemStack (net.minecraft.item.ItemStack)1 ActionResult (net.minecraft.util.ActionResult)1 EnumActionResult (net.minecraft.util.EnumActionResult)1