use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle in project Wizardry by TeamWizardry.
the class ModuleShapeSelf method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
Entity caster = spell.getCaster();
if (caster == null)
return;
ParticleBuilder glitter = new ParticleBuilder(1);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
ParticleSpawner.spawn(glitter, spell.world, new InterpCircle(caster.getPositionVector().addVector(0, caster.height / 2.0, 0), new Vec3d(0, 1, 0), 1, 10), 50, RandUtil.nextInt(10, 15), (aFloat, particleBuilder) -> {
if (RandUtil.nextBoolean()) {
glitter.setColor(getPrimaryColor());
glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(0.01, 0.1), 0));
} else {
glitter.setColor(getSecondaryColor());
glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(-0.1, -0.01), 0));
}
glitter.setLifetime(RandUtil.nextInt(20, 30));
glitter.setScale((float) RandUtil.nextDouble(0.3, 1));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, (float) RandUtil.nextDouble(0.6, 1)));
glitter.setLifetime(RandUtil.nextInt(10, 20));
glitter.setScaleFunction(new InterpScale(1, 0));
});
}
use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle in project Wizardry by TeamWizardry.
the class ModuleShapeTouch method render.
@Override
@SideOnly(Side.CLIENT)
public void render(@Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
Entity targetEntity = spell.getVictim();
if (targetEntity == null)
return;
ParticleBuilder glitter = new ParticleBuilder(1);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
ParticleSpawner.spawn(glitter, spell.world, new InterpCircle(targetEntity.getPositionVector().addVector(0, targetEntity.height / 2.0, 0), new Vec3d(0, 1, 0), 1, 10), 50, RandUtil.nextInt(10, 15), (aFloat, particleBuilder) -> {
if (RandUtil.nextBoolean()) {
glitter.setColor(getPrimaryColor());
glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(0.01, 0.1), 0));
} else {
glitter.setColor(getSecondaryColor());
glitter.setMotion(new Vec3d(0, RandUtil.nextDouble(-0.1, -0.01), 0));
}
glitter.setLifetime(RandUtil.nextInt(20, 30));
glitter.setScale((float) RandUtil.nextDouble(0.3, 1));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, (float) RandUtil.nextDouble(0.6, 1)));
glitter.setLifetime(RandUtil.nextInt(10, 20));
glitter.setScaleFunction(new InterpScale(1, 0));
});
}
use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle in project Wizardry by TeamWizardry.
the class Arena method tick.
public void tick(long timeMillis) {
if (timeMillis % 500 == 0)
ClientRunnable.run(new ClientRunnable() {
@Override
@SideOnly(Side.CLIENT)
public void runIfClient() {
ParticleBuilder glitter = new ParticleBuilder(10);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(0.3f, 0.3f));
glitter.setCollision(true);
glitter.enableMotionCalculation();
ParticleSpawner.spawn(glitter, getWorld(), new InterpCircle(new Vec3d(getCenter()).addVector(0.5, getHeight(), 0.5), new Vec3d(0, 1, 0), (float) getRadius(), 1, RandUtil.nextFloat()), 10, RandUtil.nextInt(10), (aFloat, particleBuilder) -> {
particleBuilder.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(100, 255)));
particleBuilder.setScale(RandUtil.nextFloat(0.5f, 1));
particleBuilder.addMotion(new Vec3d(RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(-0.01, 0.01)));
particleBuilder.setLifetime(RandUtil.nextInt(30, 60));
});
glitter.disableMotionCalculation();
ParticleSpawner.spawn(glitter, getWorld(), new InterpCircle(new Vec3d(getCenter()).addVector(0.5, 0, 0.5), new Vec3d(0, 1, 0), (float) getRadius(), 1, RandUtil.nextFloat()), 10, RandUtil.nextInt(10), (aFloat, particleBuilder) -> {
particleBuilder.setColor(ColorUtils.changeColorAlpha(new Color(0x0097FF), RandUtil.nextInt(100, 255)));
particleBuilder.setScale(RandUtil.nextFloat(0.5f, 1));
particleBuilder.addMotion(new Vec3d(RandUtil.nextDouble(-0.01, 0.01), RandUtil.nextDouble(0.01, 0.02), RandUtil.nextDouble(-0.01, 0.01)));
particleBuilder.setLifetime(RandUtil.nextInt(30, 60));
});
}
});
}
use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle in project Wizardry by TeamWizardry.
the class TileManaBatteryRenderer method render.
@Override
public void render(float partialTicks, int destroyStage, float alpha) {
super.render(partialTicks, destroyStage, alpha);
if (!getBakedModels())
return;
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
TextureManager texturemanager = Minecraft.getMinecraft().renderEngine;
if (texturemanager != null) {
texturemanager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
}
if (Minecraft.isAmbientOcclusionEnabled())
GlStateManager.shadeModel(GL11.GL_SMOOTH);
else
GlStateManager.shadeModel(GL11.GL_FLAT);
CapManager manager = new CapManager(tile.getWizardryCap());
float fill = (float) (manager.getMana() / manager.getMaxMana()) / 50.0f;
GlStateManager.translate(0, 0.5, 0);
GlStateManager.disableRescaleNormal();
{
double x = RandUtil.nextDouble(-fill, fill), y = RandUtil.nextDouble(-fill, fill), z = RandUtil.nextDouble(-fill, fill);
GlStateManager.translate(0, Math.sin((tile.getWorld().getTotalWorldTime() + ClientTickHandler.getPartialTicks()) / 40) / 8, 0);
GlStateManager.translate(x, y, z);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(modelCrystal, 1.0F, 1, 1, 1);
GlStateManager.translate(-x, -y, -z);
}
GlStateManager.translate(0.5, 0, 0.5);
GlStateManager.rotate(tile.getWorld().getTotalWorldTime() + ClientTickHandler.getPartialTicks(), 0, 1, 0);
GlStateManager.translate(-0.5, 0, -0.5);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(modelRing, 1.0F, 1, 1, 1);
GlStateManager.translate(0.5, 0, 0.5);
GlStateManager.rotate(tile.getWorld().getTotalWorldTime() + ClientTickHandler.getPartialTicks(), 0, -1, 0);
GlStateManager.rotate(tile.getWorld().getTotalWorldTime() + ClientTickHandler.getPartialTicks(), 0, -1, 0);
GlStateManager.translate(-0.5, 0, -0.5);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightnessColor(modelRingOuter, 1.0F, 1, 1, 1);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
HashSet<BlockPos> errors = ((IStructure) tile.getBlockType()).getErroredBlocks(tile.getWorld(), tile.getPos());
if (tile.revealStructure && tile.getBlockType() instanceof IStructure && !errors.isEmpty()) {
IStructure structure = ((IStructure) tile.getBlockType());
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.enablePolygonOffset();
GlStateManager.doPolygonOffset(1f, -0.05f);
GlStateManager.translate(-structure.offsetToCenter().getX(), -structure.offsetToCenter().getY(), -structure.offsetToCenter().getZ());
Minecraft mc = Minecraft.getMinecraft();
Tessellator tes = Tessellator.getInstance();
BufferBuilder buffer = tes.getBuffer();
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
for (BlockRenderLayer layer : cachedStructure.blocks.keySet()) {
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
buffer.addVertexData(cachedStructure.vboCaches.get(layer));
for (int i = 0; i < buffer.getVertexCount(); i++) {
int idx = buffer.getColorIndex(i + 1);
buffer.putColorRGBA(idx, 255, 255, 255, 200);
}
tes.draw();
}
GlStateManager.disablePolygonOffset();
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.enableDepth();
GlStateManager.popMatrix();
} else if (!tile.revealStructure && !errors.isEmpty()) {
for (BlockPos error : errors) StructureErrorRenderer.INSTANCE.addError(error);
}
if (tile.getBlockType() == ModBlocks.CREATIVE_MANA_BATTERY) {
double angle = tile.getWorld().getTotalWorldTime() / 10.0;
double x1 = Math.cos((float) angle);
double y1 = Math.sin((float) angle);
ParticleBuilder builder = new ParticleBuilder(10);
builder.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
builder.setCollision(true);
builder.disableRandom();
builder.disableMotionCalculation();
ParticleSpawner.spawn(builder, tile.getWorld(), new InterpCircle(new Vec3d(tile.getPos()).addVector(0.5, 0.5, 0.5), new Vec3d(x1, x1, y1), 1.5f), 20, 0, (aFloat, particleBuilder) -> {
particleBuilder.setScale(0.5f);
particleBuilder.setColor(new Color(0xd600d2));
particleBuilder.setAlphaFunction(new InterpFadeInOut(1, 1));
particleBuilder.setLifetime(RandUtil.nextInt(5, 10));
});
}
}
use of com.teamwizardry.librarianlib.features.math.interpolate.position.InterpCircle in project Wizardry by TeamWizardry.
the class RenderHaloEntity method doRenderLayer.
@Override
public void doRenderLayer(@Nonnull EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (BaublesSupport.getItem(entitylivingbaseIn, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO).isEmpty())
return;
ItemStack halo = BaublesSupport.getItem(entitylivingbaseIn, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO);
// TODO: Remove these once we have a cosmetics system
if (halo.getItem() == ModItems.FAKE_HALO && !ConfigValues.renderCrudeHalo)
return;
if (halo.getItem() == ModItems.REAL_HALO && !ConfigValues.renderRealHalo)
return;
if (halo.getItem() == ModItems.CREATIVE_HALO && !ConfigValues.renderCreativeHalo)
return;
if (halo.getItem() == ModItems.FAKE_HALO) {
GlStateManager.pushMatrix();
if (entitylivingbaseIn.isSneaking())
GlStateManager.translate(0.0f, 0.2f, 0.0f);
boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombieVillager;
if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager)) {
GlStateManager.translate(0.0f, 0.5f * scale, 0.0f);
GlStateManager.scale(0.7f, 0.7f, 0.7f);
GlStateManager.translate(0.0f, 16.0f * scale, 0.0f);
}
if (flag)
GlStateManager.translate(0.0f, 0.1875f, 0.0f);
this.modelRenderer.postRender(0.0625f);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.translate(0.0f, -0.25f, 0.0f);
GlStateManager.rotate(180.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.scale(0.625f, -0.625f, -0.625f);
Minecraft.getMinecraft().getItemRenderer().renderItem(entitylivingbaseIn, halo, ItemCameraTransforms.TransformType.HEAD);
GlStateManager.popMatrix();
} else {
ParticleBuilder glitter = new ParticleBuilder(3);
glitter.setRender(new ResourceLocation(Wizardry.MODID, Constants.MISC.SPARKLE_BLURRED));
glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
glitter.disableMotionCalculation();
glitter.disableRandom();
ParticleSpawner.spawn(glitter, entitylivingbaseIn.world, new InterpCircle(entitylivingbaseIn.getPositionVector().addVector(0, entitylivingbaseIn.height + (entitylivingbaseIn.isSneaking() ? 0.2 : 0.4), 0), new Vec3d(0, 1, 0), 0.3f, RandUtil.nextFloat(), RandUtil.nextFloat()), 10, 0, (aFloat, particleBuilder) -> {
if (RandUtil.nextInt(10) != 0)
if (halo.getItem() == ModItems.CREATIVE_HALO)
glitter.setColor(ColorUtils.changeColorAlpha(new Color(0xd600d2), RandUtil.nextInt(60, 100)));
else
glitter.setColor(ColorUtils.changeColorAlpha(Color.YELLOW, RandUtil.nextInt(60, 100)));
else
glitter.setColor(ColorUtils.changeColorAlpha(Color.WHITE, RandUtil.nextInt(60, 100)));
glitter.setAlphaFunction(new InterpFadeInOut(1f, 1f));
glitter.setLifetime(10);
glitter.setScaleFunction(new InterpFadeInOut(0.5f, 0.5f));
glitter.setMotion(new Vec3d(entitylivingbaseIn.motionX / 2.0, (entitylivingbaseIn.motionY + 0.0784) / 2.0, entitylivingbaseIn.motionZ / 2.0));
});
}
}
Aggregations