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);
}
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();
}
}
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;
}
}
}
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);
}
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);
}
Aggregations