Search in sources :

Example 66 with EnumFacing

use of net.minecraft.util.EnumFacing in project AgriCraft by AgriCraft.

the class RenderChannel method renderWoodChannel.

protected void renderWoodChannel(ITessellator tessellator, IBlockState state, TextureAtlasSprite icon) {
    final AgriSideMetaMatrix connections = new AgriSideMetaMatrix();
    connections.readFromBlockState(state);
    this.renderBottom(tessellator, icon);
    for (EnumFacing side : EnumFacing.HORIZONTALS) {
        this.renderSide(tessellator, state, side, connections.get(side), icon);
    }
}
Also used : AgriSideMetaMatrix(com.infinityraider.agricraft.api.v1.util.AgriSideMetaMatrix) EnumFacing(net.minecraft.util.EnumFacing)

Example 67 with EnumFacing

use of net.minecraft.util.EnumFacing in project AgriCraft by AgriCraft.

the class RenderPeripheral method renderChasis.

private void renderChasis(ITessellator tessellator) {
    // Fetch Icons
    final TextureAtlasSprite iconTop = getIcon(TEXTURE_TOP);
    final TextureAtlasSprite iconSide = getIcon(TEXTURE_SIDE);
    final TextureAtlasSprite iconBottom = getIcon(TEXTURE_BOTTOM);
    final TextureAtlasSprite iconInside = getIcon(TEXTURE_INNER);
    // Render Top
    tessellator.drawScaledFace(0, 0, 16, 16, EnumFacing.UP, iconTop, 16);
    tessellator.drawScaledFace(0, 0, 16, 16, EnumFacing.DOWN, iconTop, 14);
    // Render Bottom
    tessellator.drawScaledFace(0, 0, 16, 16, EnumFacing.UP, iconInside, 2);
    tessellator.drawScaledFace(0, 0, 16, 16, EnumFacing.DOWN, iconBottom, 0);
    // Render Sides - Don't Ask Why This Works...
    for (EnumFacing side : EnumFacing.HORIZONTALS) {
        // Push Matrix
        tessellator.pushMatrix();
        // Rotate The Block
        rotateBlock(tessellator, side);
        // Render Outer Face
        tessellator.drawScaledFace(0, 0, 16, 16, EnumFacing.NORTH, iconSide, 0);
        // Render Inner Face
        tessellator.drawScaledFaceDouble(0, 0, 16, 16, EnumFacing.NORTH, iconInside, 4);
        // Pop Matrix
        tessellator.popMatrix();
    }
}
Also used : TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing)

Example 68 with EnumFacing

use of net.minecraft.util.EnumFacing in project AgriCraft by AgriCraft.

the class RenderPeripheral method renderProbe.

private void renderProbe(ITessellator tessellator) {
    // Create Quads, If Needed
    if (probeQuads == null) {
        probeQuads = MODEL_PERIPHERAL.getBakedQuads(tessellator.getVertexFormat(), getIcon(TEXTURE_PROBE));
    }
    // Add Probe Quads
    for (EnumFacing side : EnumFacing.HORIZONTALS) {
        // Push Matrix
        tessellator.pushMatrix();
        // Rotate The Block
        rotateBlock(tessellator, side);
        // Add probe for the side.
        tessellator.addQuads(probeQuads);
        // Pop Matrix
        tessellator.popMatrix();
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing)

Example 69 with EnumFacing

use of net.minecraft.util.EnumFacing in project AgriCraft by AgriCraft.

the class RenderWaterPad method renderWorldBlockStatic.

@Override
public void renderWorldBlockStatic(ITessellator tessellator, IBlockState state, BlockWaterPad block, EnumFacing side) {
    // Icon
    final TextureAtlasSprite matIcon = BaseIcons.DIRT.getIcon();
    final TextureAtlasSprite waterIcon = BaseIcons.WATER_STILL.getIcon();
    // Draw Base
    renderBase(tessellator, matIcon);
    // Get Connections.
    final AgriSideMetaMatrix connections = new AgriSideMetaMatrix();
    connections.readFromBlockState(state);
    // Render Sides
    for (EnumFacing dir : EnumFacing.HORIZONTALS) {
        if (connections.get(dir) < 1) {
            renderSide(tessellator, dir, matIcon);
        }
    }
    // Render Water
    if (AgriProperties.POWERED.getValue(state)) {
        renderWater(tessellator, waterIcon);
    }
}
Also used : AgriSideMetaMatrix(com.infinityraider.agricraft.api.v1.util.AgriSideMetaMatrix) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing)

Example 70 with EnumFacing

use of net.minecraft.util.EnumFacing in project AgriCraft by AgriCraft.

the class TileEntityPeripheral method update.

@Override
public void update() {
    if (mayAnalyze) {
        if (this.hasSpecimen() && !isSpecimenAnalyzed()) {
            super.update();
        } else {
            reset();
        }
    }
    if (this.getWorld().isRemote) {
        if (updateCheck == 0) {
            checkSides();
        }
        for (EnumFacing dir : VALID_DIRECTIONS) {
            int timer = timers.get(dir);
            timer = timer + (isSideActive(dir) ? 1 : -1);
            timer = timer < 0 ? 0 : timer;
            timer = timer > MAX ? MAX : timer;
            timers.put(dir, timer);
        }
        updateCheck = (updateCheck + 1) % 1200;
    }
}
Also used : EnumFacing(net.minecraft.util.EnumFacing)

Aggregations

EnumFacing (net.minecraft.util.EnumFacing)1673 BlockPos (net.minecraft.util.math.BlockPos)491 IBlockState (net.minecraft.block.state.IBlockState)403 TileEntity (net.minecraft.tileentity.TileEntity)392 ItemStack (net.minecraft.item.ItemStack)192 Block (net.minecraft.block.Block)158 ArrayList (java.util.ArrayList)121 World (net.minecraft.world.World)114 Vec3d (net.minecraft.util.math.Vec3d)104 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)98 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)88 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)73 EntityPlayer (net.minecraft.entity.player.EntityPlayer)65 FluidStack (net.minecraftforge.fluids.FluidStack)65 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)63 Nullable (javax.annotation.Nullable)51 List (java.util.List)48 Nonnull (javax.annotation.Nonnull)47 HashSet (java.util.HashSet)43 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)43