Search in sources :

Example 1 with TileEntityPneumaticBase

use of me.desht.pneumaticcraft.common.tileentity.TileEntityPneumaticBase in project pnc-repressurized by TeamPneumatic.

the class ModuleRegulatorTube method renderPreview.

@SideOnly(Side.CLIENT)
private void renderPreview() {
    if (!hasTicked) {
        TileEntityPneumaticBase tile = (TileEntityPneumaticBase) getTube();
        NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(tile.getPos()));
        TileEntity neighbor = tile.getWorld().getTileEntity(tile.getPos().offset(dir));
        inLine = neighbor instanceof IPneumaticMachine;
        if (inLine) {
            IAirHandler neighborHandler = ((IPneumaticMachine) neighbor).getAirHandler(dir);
            inverted = neighborHandler != null && neighborHandler.getPressure() > tile.getAirHandler(null).getPressure();
            NetworkHandler.sendToServer(new PacketDescriptionPacketRequest(neighbor.getPos()));
        }
        hasTicked = true;
    }
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    if (inLine && !inverted) {
        GL11.glColor4d(0, 1, 0, 0.3);
    } else {
        GL11.glColor4d(1, 0, 0, 0.3);
    }
    GL11.glPushMatrix();
    GL11.glTranslated(0, 1, 0.2 + ClientTickHandler.TICKS % 20 * 0.015);
    GL11.glRotated(90, 1, 0, 0);
    RenderUtils.render3DArrow();
    // 0.5 because we're rendering a preview
    GL11.glColor4d(1, 1, 1, 0.5);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_BLEND);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IAirHandler(me.desht.pneumaticcraft.api.tileentity.IAirHandler) PacketDescriptionPacketRequest(me.desht.pneumaticcraft.common.network.PacketDescriptionPacketRequest) IPneumaticMachine(me.desht.pneumaticcraft.api.tileentity.IPneumaticMachine) TileEntityPneumaticBase(me.desht.pneumaticcraft.common.tileentity.TileEntityPneumaticBase) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with TileEntityPneumaticBase

use of me.desht.pneumaticcraft.common.tileentity.TileEntityPneumaticBase in project pnc-repressurized by TeamPneumatic.

the class ModelGauge method renderDynamic.

@Override
protected void renderDynamic(float scale, float partialTicks) {
    shape1.render(scale);
    shape2.render(scale);
    float pressure = 0f;
    float dangerPressure = 5f;
    float critPressure = 7f;
    if (gaugeModule != null && gaugeModule.getTube() instanceof TileEntityPneumaticBase) {
        TileEntityPneumaticBase base = (TileEntityPneumaticBase) gaugeModule.getTube();
        pressure = base.getPressure();
        critPressure = base.criticalPressure;
        dangerPressure = base.dangerPressure;
    }
    GL11.glTranslated(0, 1, 0.378);
    double widgetScale = 0.007D;
    GL11.glScaled(widgetScale, widgetScale, widgetScale);
    GL11.glRotated(180, 0, 1, 0);
    GL11.glDisable(GL11.GL_LIGHTING);
    GuiUtils.drawPressureGauge(FMLClientHandler.instance().getClient().fontRenderer, -1, critPressure, dangerPressure, -1, pressure, 0, 0, 0);
    GL11.glEnable(GL11.GL_LIGHTING);
}
Also used : TileEntityPneumaticBase(me.desht.pneumaticcraft.common.tileentity.TileEntityPneumaticBase)

Aggregations

TileEntityPneumaticBase (me.desht.pneumaticcraft.common.tileentity.TileEntityPneumaticBase)2 IAirHandler (me.desht.pneumaticcraft.api.tileentity.IAirHandler)1 IPneumaticMachine (me.desht.pneumaticcraft.api.tileentity.IPneumaticMachine)1 PacketDescriptionPacketRequest (me.desht.pneumaticcraft.common.network.PacketDescriptionPacketRequest)1 TileEntity (net.minecraft.tileentity.TileEntity)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1