Search in sources :

Example 6 with MobEntity

use of net.minecraft.entity.mob.MobEntity in project Wurst7 by Wurst-Imperium.

the class ProphuntEspHack method onRender.

@Override
public void onRender(MatrixStack matrixStack, float partialTicks) {
    // GL settings
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    matrixStack.push();
    RenderUtils.applyRenderOffset(matrixStack);
    // set color
    float alpha = 0.5F + 0.25F * MathHelper.sin(System.currentTimeMillis() % 1000 / 500F * (float) Math.PI);
    RenderSystem.setShaderColor(1, 0, 0, alpha);
    // draw boxes
    for (Entity entity : MC.world.getEntities()) {
        if (!(entity instanceof MobEntity))
            continue;
        if (!entity.isInvisible())
            continue;
        if (MC.player.squaredDistanceTo(entity) < 0.25)
            continue;
        matrixStack.push();
        matrixStack.translate(entity.getX(), entity.getY(), entity.getZ());
        RenderUtils.drawOutlinedBox(FAKE_BLOCK_BOX, matrixStack);
        RenderUtils.drawSolidBox(FAKE_BLOCK_BOX, matrixStack);
        matrixStack.pop();
    }
    matrixStack.pop();
    // GL resets
    RenderSystem.setShaderColor(1, 1, 1, 1);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
Also used : Entity(net.minecraft.entity.Entity) MobEntity(net.minecraft.entity.mob.MobEntity) MobEntity(net.minecraft.entity.mob.MobEntity)

Example 7 with MobEntity

use of net.minecraft.entity.mob.MobEntity in project Wurst7 by Wurst-Imperium.

the class MobEspHack method renderBoxes.

private void renderBoxes(MatrixStack matrixStack, double partialTicks, int regionX, int regionZ) {
    float extraSize = boxSize.getSelected().extraSize;
    RenderSystem.setShader(GameRenderer::getPositionShader);
    for (MobEntity e : mobs) {
        matrixStack.push();
        matrixStack.translate(e.prevX + (e.getX() - e.prevX) * partialTicks - regionX, e.prevY + (e.getY() - e.prevY) * partialTicks, e.prevZ + (e.getZ() - e.prevZ) * partialTicks - regionZ);
        matrixStack.scale(e.getWidth() + extraSize, e.getHeight() + extraSize, e.getWidth() + extraSize);
        float f = MC.player.distanceTo(e) / 20F;
        RenderSystem.setShaderColor(2 - f, f, 0, 0.5F);
        Shader shader = RenderSystem.getShader();
        Matrix4f matrix4f = RenderSystem.getProjectionMatrix();
        mobBox.setShader(matrixStack.peek().getPositionMatrix(), matrix4f, shader);
        matrixStack.pop();
    }
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) GameRenderer(net.minecraft.client.render.GameRenderer) Shader(net.minecraft.client.render.Shader) MobEntity(net.minecraft.entity.mob.MobEntity)

Example 8 with MobEntity

use of net.minecraft.entity.mob.MobEntity in project Illager-Expansion by OhDricky.

the class HatchetAttackGoal method tick.

@Override
public void tick() {
    boolean bl3;
    boolean bl2;
    LivingEntity target = hostile.getTarget();
    if (target == null) {
        chargeTime = 0;
        if (hostile instanceof MarauderEntity) {
            ((MarauderEntity) hostile).setCharging(false);
        }
        return;
    }
    boolean canSeeTarget = hostile.getVisibilityCache().canSee(target);
    boolean bl = ((MobEntity) this.hostile).getVisibilityCache().canSee(target);
    this.hostile.getLookControl().lookAt(target, 30.0f, 30.0f);
    boolean bl4 = bl2 = this.seeingTargetTicker > 0;
    if (bl != bl2) {
        this.seeingTargetTicker = 0;
    }
    this.seeingTargetTicker = bl ? ++this.seeingTargetTicker : --this.seeingTargetTicker;
    double d = ((Entity) this.hostile).squaredDistanceTo(target);
    boolean bl5 = bl3 = (d > (double) this.squaredRange || this.seeingTargetTicker < 5);
    if (bl3) {
        --this.cooldown;
        if (this.cooldown <= 0) {
            this.hostile.getNavigation().startMovingTo(target, speed);
            this.cooldown = COOLDOWN_RANGE.get(this.hostile.getRandom());
        }
    } else {
        this.cooldown = 0;
        ((MobEntity) this.hostile).getNavigation().stop();
    }
    --chargeTime;
    if (hostile instanceof MarauderEntity) {
        if (chargeTime == -40) {
            ((MarauderEntity) hostile).setCharging(true);
        }
        if (chargeTime == -80) {
            ((MarauderEntity) hostile).attack(target, 1.0f);
            ((MarauderEntity) hostile).setCharging(false);
            chargeTime = 0;
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Entity(net.minecraft.entity.Entity) HostileEntity(net.minecraft.entity.mob.HostileEntity) LivingEntity(net.minecraft.entity.LivingEntity) MarauderEntity(me.sandbox.entity.MarauderEntity) MobEntity(net.minecraft.entity.mob.MobEntity) MarauderEntity(me.sandbox.entity.MarauderEntity)

Example 9 with MobEntity

use of net.minecraft.entity.mob.MobEntity in project Carrier by GabrielOlvH.

the class MixinMobEntity method carrier_interactMob.

@Inject(method = "interactMob", at = @At("HEAD"), cancellable = true)
private void carrier_interactMob(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
    MobEntity entity = (MobEntity) (Object) this;
    ActionResult actionResult = HolderInteractCallback.INSTANCE.interact(player, player.world, hand, entity);
    if (actionResult.isAccepted())
        cir.setReturnValue(actionResult);
}
Also used : ActionResult(net.minecraft.util.ActionResult) MobEntity(net.minecraft.entity.mob.MobEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 10 with MobEntity

use of net.minecraft.entity.mob.MobEntity in project Biome-Makeover by Lemonszz.

the class SummonPhase method spawnEntity.

protected void spawnEntity() {
    BlockPos spawnPos = spawnPositions[spawnIndex];
    if (world.getBlockState(spawnPos.down()).isAir())
        world.setBlockState(spawnPos.down(), Blocks.COBBLESTONE.getDefaultState());
    LivingEntity entity = entities[random.nextInt(entities.length)].create(world);
    if (entity instanceof MobEntity)
        ((MobEntity) entity).initialize((ServerWorldAccess) world, world.getLocalDifficulty(spawnPos), SpawnReason.EVENT, null, null);
    ((LootBlocker) entity).setLootBlocked(true);
    entity.refreshPositionAndAngles((double) spawnPos.getX() + 0.5D, (double) spawnPos.getY(), (double) spawnPos.getZ() + 0.5D, 0.0F, 0.0F);
    world.spawnEntity(entity);
    adjudicator.clearArea(entity);
    if (entity instanceof EvokerEntity) {
        GoalSelectorExtension.removeGoal((MobEntity) entity, EvokerEntity.SummonVexGoal.class);
    }
    world.playSound(null, spawnPos, SoundEvents.ENTITY_EVOKER_CAST_SPELL, SoundCategory.HOSTILE, 10F, 1F);
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) LootBlocker(party.lemons.biomemakeover.util.extensions.LootBlocker) ServerWorldAccess(net.minecraft.world.ServerWorldAccess) EvokerEntity(net.minecraft.entity.mob.EvokerEntity) BlockPos(net.minecraft.util.math.BlockPos) MobEntity(net.minecraft.entity.mob.MobEntity)

Aggregations

MobEntity (net.minecraft.entity.mob.MobEntity)20 Entity (net.minecraft.entity.Entity)10 PlayerEntity (net.minecraft.entity.player.PlayerEntity)7 LivingEntity (net.minecraft.entity.LivingEntity)5 StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)4 BlockEntity (net.minecraft.block.entity.BlockEntity)3 PersistentProjectileEntity (net.minecraft.entity.projectile.PersistentProjectileEntity)3 BlockPos (net.minecraft.util.math.BlockPos)3 NavigatingEntity (me.jellysquid.mods.lithium.common.entity.NavigatingEntity)2 ServerWorldExtended (me.jellysquid.mods.lithium.common.world.ServerWorldExtended)2 TickingLightEntity (mod.azure.hwg.entity.blockentity.TickingLightEntity)2 GameRenderer (net.minecraft.client.render.GameRenderer)2 EntityNavigation (net.minecraft.entity.ai.pathing.EntityNavigation)2 HostileEntity (net.minecraft.entity.mob.HostileEntity)2 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)2 Matrix4f (net.minecraft.util.math.Matrix4f)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2 Redirect (org.spongepowered.asm.mixin.injection.Redirect)2 AreaIsometricRenderScreen (com.glisco.isometricrenders.client.gui.AreaIsometricRenderScreen)1 IsometricRenderScreen (com.glisco.isometricrenders.client.gui.IsometricRenderScreen)1