Search in sources :

Example 1 with EntityShulkerBullet

use of net.minecraft.entity.projectile.EntityShulkerBullet in project takumicraft by TNTModders.

the class TakumiEntityCore method renderRegister.

@SideOnly(Side.CLIENT)
private static void renderRegister() {
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiArrow.class, manager -> new RenderArrow<EntityArrow>(manager) {

        @Override
        protected ResourceLocation getEntityTexture(EntityArrow entity) {
            return new ResourceLocation(TakumiCraftCore.MODID, "textures/entity/item/carrow.png");
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiSnowBall.class, manager -> new RenderSnowball<>(manager, Items.SNOWBALL, Minecraft.getMinecraft().getRenderItem()));
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiExpEgg.class, manager -> new RenderSnowball<>(manager, Items.EGG, Minecraft.getMinecraft().getRenderItem()));
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiTNTPrimed.class, RenderTakumiTNTPrimed::new);
    RenderingRegistry.registerEntityRenderingHandler(EntityLlamaCreeperSpit.class, RenderLlamaCreeperSpit::new);
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiChocolateBall.class, manager -> new RenderSnowball<>(manager, TakumiItemCore.TAKUMI_CHOCO_BALL, Minecraft.getMinecraft().getRenderItem()));
    RenderingRegistry.registerEntityRenderingHandler(EntityDarkVillager.class, RenderDarkVillager::new);
    RenderingRegistry.registerEntityRenderingHandler(EntityTransHomingBomb.class, manager -> new RenderShulkerBullet(manager) {

        @Override
        public void doRender(EntityShulkerBullet entity, double x, double y, double z, float entityYaw, float partialTicks) {
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityAttackBlock.class, RenderAttackBlock::new);
}
Also used : EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) EntityArrow(net.minecraft.entity.projectile.EntityArrow) RenderTakumiTNTPrimed(com.tntmodders.takumi.client.render.RenderTakumiTNTPrimed) RenderAttackBlock(com.tntmodders.takumi.client.render.RenderAttackBlock) RenderShulkerBullet(net.minecraft.client.renderer.entity.RenderShulkerBullet) RenderDarkVillager(com.tntmodders.takumi.client.render.RenderDarkVillager) RenderLlamaCreeperSpit(com.tntmodders.takumi.client.render.RenderLlamaCreeperSpit) ResourceLocation(net.minecraft.util.ResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with EntityShulkerBullet

use of net.minecraft.entity.projectile.EntityShulkerBullet in project MorePlanets by SteveKunG.

the class TileEntityShieldGenerator method update.

@Override
public void update() {
    super.update();
    this.renderTicks++;
    if (!this.initialize) {
        this.renderTicks = this.renderTicks + this.world.rand.nextInt(100);
        this.solarRotate = this.solarRotate + this.world.rand.nextInt(360);
        this.initialize = TileEntityDummy.initialiseMultiTiles(this.getPos(), this.getWorld(), this);
    }
    if (this.hasEnoughEnergyToRun && !this.disabled) {
        this.solarRotate++;
        this.solarRotate %= 360;
        MorePlanetsMod.PROXY.spawnParticle(EnumParticleTypesMP.ALIEN_MINER_SPARK, this.pos.getX() + 0.5D, this.pos.getY() + 1.5D, this.pos.getZ() + 0.5D, new Object[] { -0.5F });
        if (this.ticks % 33 == 0) {
            this.world.playSound(null, this.getPos(), MPSounds.MACHINE_GENERATOR_AMBIENT, SoundCategory.BLOCKS, 0.075F, 1.0F);
        }
    }
    if (!this.world.isRemote) {
        int count = 0;
        int capacityUpgradeCount = 0;
        // shield damage upgrade
        if (!this.getInventory().get(1).isEmpty()) {
            count = this.getInventory().get(1).getCount();
            this.maxShieldDamage = 8 * count;
        } else {
            this.maxShieldDamage = 8;
        }
        // shield size upgrade
        if (!this.getInventory().get(2).isEmpty()) {
            count = this.getInventory().get(2).getCount();
            this.maxShieldSizeUpgrade = 16 + count;
        } else {
            this.maxShieldSizeUpgrade = 16;
        }
        // shield capacity upgrade
        if (!this.getInventory().get(3).isEmpty()) {
            count = this.getInventory().get(3).getCount();
            capacityUpgradeCount = this.getInventory().get(3).getCount();
            this.maxShieldCapacity = 32000 * count;
        } else {
            this.maxShieldCapacity = 16000;
        }
        int sum = (int) (this.shieldDamage + this.shieldSize + capacityUpgradeCount) / 2;
        this.storage.setMaxExtract(250 * sum);
        if (!this.needCharged && this.shieldCapacity == 0) {
            this.needCharged = true;
            this.shieldChargeCooldown = 1200;
            if (this.shieldChargeCooldown == 0) {
                this.shieldCapacity = 100;
            }
        }
        if (!this.disabled && this.getEnergyStoredGC() > 0.0F && this.hasEnoughEnergyToRun) {
            if (this.shieldSize <= this.maxShieldSize) {
                this.shieldSize += 0.1F;
                if (this.shieldChargeCooldown > 0) {
                    this.shieldChargeCooldown--;
                }
                if (this.shieldChargeCooldown == 0 && this.ticks % 2 == 0) {
                    this.shieldCapacity += 100;
                    this.needCharged = false;
                }
            }
        } else {
            this.shieldSize -= 0.1F;
        }
        if (this.shieldSize <= this.maxShieldSize) {
            this.shieldSize = Math.min(Math.max(this.shieldSize, 0.0F), this.maxShieldSize);
        } else {
            this.shieldSize -= 0.1F;
        }
        this.shieldCapacity = Math.min(Math.max(this.shieldCapacity, 0), this.maxShieldCapacity);
    }
    float range = this.shieldSize;
    for (Entity entity : this.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.pos.getX() - range, this.pos.getY() - range, this.pos.getZ() - range, this.pos.getX() + range, this.pos.getY() + range, this.pos.getZ() + range))) {
        if (!this.disabled && this.enableShield && this.shieldCapacity > 0) {
            if (entity instanceof EntityArrow && !(((EntityArrow) entity).shootingEntity instanceof EntityPlayer) && !((EntityArrow) entity).inGround || entity instanceof EntityPotion && !(((EntityPotion) entity).getThrower() instanceof EntityPlayer) || entity instanceof EntityFireball || entity instanceof EntityShulkerBullet) {
                if (this.world instanceof WorldServer) {
                    ((WorldServer) this.world).spawnParticle(EnumParticleTypes.CRIT_MAGIC, entity.posX, entity.posY, entity.posZ, 20, 0.0D, 0.5D, 0.0D, 1.0D);
                }
                float motion = MathHelper.sqrt(entity.motionX * entity.motionX + entity.motionZ * entity.motionZ);
                this.shieldCapacity -= motion * 2;
                entity.setDead();
            }
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) EntityArrow(net.minecraft.entity.projectile.EntityArrow) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityPotion(net.minecraft.entity.projectile.EntityPotion) WorldServer(net.minecraft.world.WorldServer) EntityFireball(net.minecraft.entity.projectile.EntityFireball)

Example 3 with EntityShulkerBullet

use of net.minecraft.entity.projectile.EntityShulkerBullet in project takumicraft by TNTModders.

the class EntityShulkerCreeper method superJump.

protected void superJump() {
    this.motionY = 75d;
    if (this.isPotionActive(MobEffects.JUMP_BOOST)) {
        this.motionY += (this.getActivePotionEffect(MobEffects.JUMP_BOOST).getAmplifier() + 1) * 0.1F;
    }
    if (this.isSprinting()) {
        float f = this.rotationYaw * 0.017453292F;
        this.motionX -= MathHelper.sin(f) * 0.2F;
        this.motionZ += MathHelper.cos(f) * 0.2F;
    }
    this.move(MoverType.SELF, motionX, motionY, motionZ);
    this.isAirBorne = true;
    ForgeHooks.onLivingJump(this);
    for (int t = 0; t < 100 * (this.getPowered() ? 2 : 1); t++) {
        Random rand = new Random();
        double x = this.posX + this.rand.nextInt(20) - 10;
        double y = this.posY + this.rand.nextInt(20) - 10;
        double z = this.posZ + this.rand.nextInt(20) - 10;
        EntityShulkerBullet shulkerBullet = new EntityShulkerBullet(this.world, this, this.getAttackTarget(), Axis.Y);
        shulkerBullet.setPosition(x, y, z);
        if (!this.world.isRemote) {
            this.world.spawnEntity(shulkerBullet);
        }
    }
}
Also used : EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) Random(java.util.Random)

Aggregations

EntityShulkerBullet (net.minecraft.entity.projectile.EntityShulkerBullet)3 EntityArrow (net.minecraft.entity.projectile.EntityArrow)2 RenderAttackBlock (com.tntmodders.takumi.client.render.RenderAttackBlock)1 RenderDarkVillager (com.tntmodders.takumi.client.render.RenderDarkVillager)1 RenderLlamaCreeperSpit (com.tntmodders.takumi.client.render.RenderLlamaCreeperSpit)1 RenderTakumiTNTPrimed (com.tntmodders.takumi.client.render.RenderTakumiTNTPrimed)1 Random (java.util.Random)1 RenderShulkerBullet (net.minecraft.client.renderer.entity.RenderShulkerBullet)1 Entity (net.minecraft.entity.Entity)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 EntityFireball (net.minecraft.entity.projectile.EntityFireball)1 EntityPotion (net.minecraft.entity.projectile.EntityPotion)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)1 WorldServer (net.minecraft.world.WorldServer)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1