Search in sources :

Example 6 with TileAlchemyArray

use of WayofTime.bloodmagic.tile.TileAlchemyArray in project BloodMagic by WayofTime.

the class StaticAlchemyCircleRenderer method renderAt.

@Override
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) {
    if (!(tile instanceof TileAlchemyArray)) {
        return;
    }
    TileAlchemyArray tileArray = (TileAlchemyArray) tile;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder wr = tessellator.getBuffer();
    GlStateManager.pushMatrix();
    float rot = getRotation(craftTime);
    float size = 1.0F * getSizeModifier(craftTime);
    // Bind the texture to the circle
    Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
    GlStateManager.disableCull();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 1);
    GlStateManager.translate(x, y, z);
    // Specify which face this "circle" is located on
    EnumFacing sideHit = EnumFacing.UP;
    EnumFacing rotation = tileArray.getRotation();
    GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
    switch(sideHit) {
        case DOWN:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(-90.0f, 1, 0, 0);
            break;
        case EAST:
            GlStateManager.rotate(-90.0f, 0, 1, 0);
            GlStateManager.translate(0, 0, -1);
            break;
        case NORTH:
            break;
        case SOUTH:
            GlStateManager.rotate(180.0f, 0, 1, 0);
            GlStateManager.translate(-1, 0, -1);
            break;
        case UP:
            GlStateManager.translate(0, 1, 0);
            GlStateManager.rotate(90.0f, 1, 0, 0);
            break;
        case WEST:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(90.0f, 0, 1, 0);
            break;
    }
    GlStateManager.pushMatrix();
    GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
    GlStateManager.rotate(rotation.getHorizontalAngle() + 180, 0, 0, 1);
    GlStateManager.pushMatrix();
    GlStateManager.rotate(rot, 0, 1, 0);
    double var31 = 0.0D;
    double var33 = 1.0D;
    double var35 = 0;
    double var37 = 1;
    GlStateManager.color(1f, 1f, 1f, 1f);
    wr.begin(7, DefaultVertexFormats.POSITION_TEX);
    // wr.setBrightness(200);
    wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
    wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
    wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
    wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
    tessellator.draw();
    GlStateManager.popMatrix();
    // GlStateManager.depthMask(true);
    GlStateManager.disableBlend();
    GlStateManager.enableCull();
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) EnumFacing(net.minecraft.util.EnumFacing) TileAlchemyArray(WayofTime.bloodmagic.tile.TileAlchemyArray)

Example 7 with TileAlchemyArray

use of WayofTime.bloodmagic.tile.TileAlchemyArray in project BloodMagic by WayofTime.

the class TurretAlchemyCircleRenderer method renderAt.

@Override
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) {
    if (!(tile instanceof TileAlchemyArray)) {
        return;
    }
    // Not working
    float f = 0;
    TileAlchemyArray tileArray = (TileAlchemyArray) tile;
    AlchemyArrayEffect effect = tileArray.arrayEffect;
    double pitch = 0;
    double yaw = 0;
    int arrowTimer = -1;
    if (effect instanceof AlchemyArrayEffectArrowTurret) {
        AlchemyArrayEffectArrowTurret turretEffect = (AlchemyArrayEffectArrowTurret) effect;
        pitch = (turretEffect.getPitch() - turretEffect.getLastPitch()) * f + turretEffect.getLastPitch();
        yaw = (turretEffect.getYaw() - turretEffect.getLastYaw()) * f + turretEffect.getLastYaw();
        arrowTimer = turretEffect.arrowTimer;
    }
    double arrowAnimation = arrowTimer + f;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder wr = tessellator.getBuffer();
    GlStateManager.pushMatrix();
    float rot = getRotation(craftTime);
    float size = 1.0F * getSizeModifier(craftTime);
    // Bind the texture to the circle
    Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
    GlStateManager.disableCull();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 1);
    GlStateManager.translate(x, y, z);
    // Specify which face this "circle" is located on
    EnumFacing sideHit = EnumFacing.UP;
    EnumFacing rotation = tileArray.getRotation();
    GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
    switch(sideHit) {
        case DOWN:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(-90.0f, 1, 0, 0);
            break;
        case EAST:
            GlStateManager.rotate(-90.0f, 0, 1, 0);
            GlStateManager.translate(0, 0, -1);
            break;
        case NORTH:
            break;
        case SOUTH:
            GlStateManager.rotate(180.0f, 0, 1, 0);
            GlStateManager.translate(-1, 0, -1);
            break;
        case UP:
            GlStateManager.translate(0, 1, 0);
            GlStateManager.rotate(90.0f, 1, 0, 0);
            break;
        case WEST:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(90.0f, 0, 1, 0);
            break;
    }
    GlStateManager.pushMatrix();
    GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
    // GlStateManager.rotate(rotation.getHorizontalAngle() + 180, 0, 0, 1);
    GlStateManager.pushMatrix();
    double topHeightOffset = getTopHeightOffset(craftTime, arrowAnimation);
    double middleHeightOffset = getMiddleHeightOffset(craftTime, arrowAnimation);
    double bottomHeightOffset = getBottomHeightOffset(craftTime, arrowAnimation);
    BlockPos pos = tileArray.getPos();
    World world = tileArray.getWorld();
    GlStateManager.rotate((float) (yaw + 360 * getStartupPitchYawRatio(craftTime)), 0, 0, 1);
    GlStateManager.rotate((float) ((pitch + 90) * getStartupPitchYawRatio(craftTime)), 1, 0, 0);
    GlStateManager.pushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(bottomArrayResource);
    GlStateManager.rotate(-rot, 0, 0, 1);
    GlStateManager.translate(0, 0, -bottomHeightOffset);
    renderStandardCircle(tessellator, wr, size / 2);
    GlStateManager.popMatrix();
    GlStateManager.pushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(middleArrayResource);
    GlStateManager.rotate(0, 0, 0, 1);
    GlStateManager.translate(0, 0, -middleHeightOffset);
    renderStandardCircle(tessellator, wr, size);
    GlStateManager.popMatrix();
    GlStateManager.pushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
    GlStateManager.rotate(rot, 0, 0, 1);
    GlStateManager.translate(0, 0, -topHeightOffset);
    renderStandardCircle(tessellator, wr, size);
    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
    // GlStateManager.depthMask(true);
    GlStateManager.disableBlend();
    GlStateManager.enableCull();
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) EnumFacing(net.minecraft.util.EnumFacing) AlchemyArrayEffect(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect) BlockPos(net.minecraft.util.math.BlockPos) TileAlchemyArray(WayofTime.bloodmagic.tile.TileAlchemyArray) World(net.minecraft.world.World) AlchemyArrayEffectArrowTurret(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret)

Example 8 with TileAlchemyArray

use of WayofTime.bloodmagic.tile.TileAlchemyArray in project BloodMagic by WayofTime.

the class AttractorAlchemyCircleRenderer method renderAt.

@Override
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) {
    if (!(tile instanceof TileAlchemyArray)) {
        return;
    }
    TileAlchemyArray tileArray = (TileAlchemyArray) tile;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder wr = tessellator.getBuffer();
    GlStateManager.pushMatrix();
    float rot = getRotation(craftTime);
    float secondaryRot = getSecondaryRotation(craftTime);
    float size = 1.0F * getSizeModifier(craftTime);
    // Bind the texture to the circle
    Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
    GlStateManager.disableCull();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 1);
    GlStateManager.translate(x, y, z);
    // Specify which face this "circle" is located on
    EnumFacing sideHit = EnumFacing.UP;
    EnumFacing rotation = tileArray.getRotation();
    GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
    switch(sideHit) {
        case DOWN:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(-90.0f, 1, 0, 0);
            break;
        case EAST:
            GlStateManager.rotate(-90.0f, 0, 1, 0);
            GlStateManager.translate(0, 0, -1);
            break;
        case NORTH:
            break;
        case SOUTH:
            GlStateManager.rotate(180.0f, 0, 1, 0);
            GlStateManager.translate(-1, 0, -1);
            break;
        case UP:
            GlStateManager.translate(0, 1, 0);
            GlStateManager.rotate(90.0f, 1, 0, 0);
            break;
        case WEST:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(90.0f, 0, 1, 0);
            break;
    }
    GlStateManager.pushMatrix();
    GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
    GlStateManager.rotate(rotation.getHorizontalAngle() + 180, 0, 0, 1);
    GlStateManager.pushMatrix();
    GlStateManager.rotate(rot, 0, 0, 1);
    GlStateManager.rotate(secondaryRot, 1, 0, 0);
    double var31 = 0.0D;
    double var33 = 1.0D;
    double var35 = 0;
    double var37 = 1;
    GlStateManager.color(1f, 1f, 1f, 1f);
    wr.begin(7, DefaultVertexFormats.POSITION_TEX);
    // wr.setBrightness(200);
    wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
    wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
    wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
    wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
    tessellator.draw();
    GlStateManager.popMatrix();
    // GlStateManager.depthMask(true);
    GlStateManager.disableBlend();
    GlStateManager.enableCull();
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) EnumFacing(net.minecraft.util.EnumFacing) TileAlchemyArray(WayofTime.bloodmagic.tile.TileAlchemyArray)

Example 9 with TileAlchemyArray

use of WayofTime.bloodmagic.tile.TileAlchemyArray in project BloodMagic by WayofTime.

the class DualAlchemyCircleRenderer method renderAt.

@Override
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) {
    if (!(tile instanceof TileAlchemyArray)) {
        return;
    }
    TileAlchemyArray tileArray = (TileAlchemyArray) tile;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder wr = tessellator.getBuffer();
    GlStateManager.pushMatrix();
    // float rot = (float)(this.worldObj.provider.getWorldTime() % (360 /
    // this.rotationspeed) * this.rotationspeed) + this.rotationspeed * f;
    float rot = getRotation(craftTime);
    float size = 1.0F * getSizeModifier(craftTime);
    GlStateManager.disableCull();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 1);
    GlStateManager.translate(x, y, z);
    // Specify which face this "circle" is located on
    EnumFacing sideHit = EnumFacing.UP;
    EnumFacing rotation = tileArray.getRotation();
    GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
    switch(sideHit) {
        case DOWN:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(-90.0f, 1, 0, 0);
            break;
        case EAST:
            GlStateManager.rotate(-90.0f, 0, 1, 0);
            GlStateManager.translate(0, 0, -1);
            break;
        case NORTH:
            break;
        case SOUTH:
            GlStateManager.rotate(180.0f, 0, 1, 0);
            GlStateManager.translate(-1, 0, -1);
            break;
        case UP:
            GlStateManager.translate(0, 1, 0);
            GlStateManager.rotate(90.0f, 1, 0, 0);
            break;
        case WEST:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(90.0f, 0, 1, 0);
            break;
    }
    GlStateManager.pushMatrix();
    GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
    GlStateManager.rotate(rotation.getHorizontalAngle() + 180, 0, 0, 1);
    // Bind the texture to the circle
    Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
    GlStateManager.pushMatrix();
    GlStateManager.rotate(rot, 0, 0, 1);
    double var31 = 0.0D;
    double var33 = 1.0D;
    double var35 = 0;
    double var37 = 1;
    GlStateManager.color(1f, 1f, 1f, 1f);
    wr.begin(7, DefaultVertexFormats.POSITION_TEX);
    // wr.setBrightness(200);
    wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
    wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
    wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
    wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
    tessellator.draw();
    GlStateManager.popMatrix();
    // Bind the second texture to the circle
    Minecraft.getMinecraft().renderEngine.bindTexture(secondaryArrayResource);
    GlStateManager.pushMatrix();
    GlStateManager.rotate(-rot, 0, 0, 1);
    GlStateManager.color(1f, 1f, 1f, 1f);
    wr.begin(7, DefaultVertexFormats.POSITION_TEX);
    // wr.setBrightness(200);
    wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
    wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
    wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
    wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
    tessellator.draw();
    GlStateManager.popMatrix();
    // GlStateManager.depthMask(true);
    GlStateManager.disableBlend();
    GlStateManager.enableCull();
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) EnumFacing(net.minecraft.util.EnumFacing) TileAlchemyArray(WayofTime.bloodmagic.tile.TileAlchemyArray)

Example 10 with TileAlchemyArray

use of WayofTime.bloodmagic.tile.TileAlchemyArray in project BloodMagic by WayofTime.

the class SingleAlchemyCircleRenderer method renderAt.

@Override
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) {
    if (!(tile instanceof TileAlchemyArray)) {
        return;
    }
    TileAlchemyArray tileArray = (TileAlchemyArray) tile;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder wr = tessellator.getBuffer();
    GlStateManager.pushMatrix();
    // float rot = (float)(this.worldObj.provider.getWorldTime() % (360 /
    // this.rotationspeed) * this.rotationspeed) + this.rotationspeed * f;
    float rot = getRotation(craftTime);
    float size = 1.0F * getSizeModifier(craftTime);
    GlStateManager.disableCull();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 1);
    GlStateManager.translate(x, y, z);
    // Specify which face this "circle" is located on
    EnumFacing sideHit = EnumFacing.UP;
    EnumFacing rotation = tileArray.getRotation();
    GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
    switch(sideHit) {
        case DOWN:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(-90.0f, 1, 0, 0);
            break;
        case EAST:
            GlStateManager.rotate(-90.0f, 0, 1, 0);
            GlStateManager.translate(0, 0, -1);
            break;
        case NORTH:
            break;
        case SOUTH:
            GlStateManager.rotate(180.0f, 0, 1, 0);
            GlStateManager.translate(-1, 0, -1);
            break;
        case UP:
            GlStateManager.translate(0, 1, 0);
            GlStateManager.rotate(90.0f, 1, 0, 0);
            break;
        case WEST:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(90.0f, 0, 1, 0);
            break;
    }
    GlStateManager.pushMatrix();
    GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
    GlStateManager.rotate(rotation.getHorizontalAngle() + 180, 0, 0, 1);
    // Bind the texture to the circle
    Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
    GlStateManager.pushMatrix();
    GlStateManager.rotate(rot, 0, 0, 1);
    double var31 = 0.0D;
    double var33 = 1.0D;
    double var35 = 0;
    double var37 = 1;
    GlStateManager.color(1f, 1f, 1f, 1f);
    wr.begin(7, DefaultVertexFormats.POSITION_TEX);
    // wr.setBrightness(200);
    wr.pos(size / 2f, size / 2f, 0.0D).tex(var33, var37).endVertex();
    wr.pos(size / 2f, -size / 2f, 0.0D).tex(var33, var35).endVertex();
    wr.pos(-size / 2f, -size / 2f, 0.0D).tex(var31, var35).endVertex();
    wr.pos(-size / 2f, size / 2f, 0.0D).tex(var31, var37).endVertex();
    tessellator.draw();
    GlStateManager.popMatrix();
    // GlStateManager.depthMask(true);
    GlStateManager.disableBlend();
    GlStateManager.enableCull();
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) EnumFacing(net.minecraft.util.EnumFacing) TileAlchemyArray(WayofTime.bloodmagic.tile.TileAlchemyArray)

Aggregations

TileAlchemyArray (WayofTime.bloodmagic.tile.TileAlchemyArray)11 EnumFacing (net.minecraft.util.EnumFacing)7 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)6 Tessellator (net.minecraft.client.renderer.Tessellator)6 BlockPos (net.minecraft.util.math.BlockPos)4 World (net.minecraft.world.World)3 ItemStack (net.minecraft.item.ItemStack)2 TileEntity (net.minecraft.tileentity.TileEntity)2 AlchemyArrayEffect (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect)1 AlchemyArrayEffectArrowTurret (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret)1 TeleposeEvent (WayofTime.bloodmagic.event.TeleposeEvent)1 Block (net.minecraft.block.Block)1