Search in sources :

Example 1 with TankMultiblockData

use of mekanism.common.content.tank.TankMultiblockData in project Mekanism by mekanism.

the class RenderDynamicTank method render.

@Override
protected void render(TileEntityDynamicTank tile, float partialTick, MatrixStack matrix, IRenderTypeBuffer renderer, int light, int overlayLight, IProfiler profiler) {
    if (tile.isMaster()) {
        TankMultiblockData multiblock = tile.getMultiblock();
        if (multiblock.isFormed() && multiblock.renderLocation != null) {
            RenderData data = getRenderData(multiblock);
            if (data != null) {
                data.location = multiblock.renderLocation;
                data.height = multiblock.height() - 2;
                data.length = multiblock.length();
                data.width = multiblock.width();
                matrix.pushPose();
                IVertexBuilder buffer = renderer.getBuffer(Atlases.translucentCullBlockSheet());
                BlockPos pos = tile.getBlockPos();
                matrix.translate(data.location.getX() - pos.getX(), data.location.getY() - pos.getY(), data.location.getZ() - pos.getZ());
                int glow = data.calculateGlowLight(MekanismRenderer.FULL_SKY_LIGHT);
                Model3D model = ModelRenderer.getModel(data, multiblock.prevScale);
                MekanismRenderer.renderObject(model, matrix, buffer, data.getColorARGB(multiblock.prevScale), glow, overlayLight, getFaceDisplay(data, model));
                matrix.popPose();
                if (data instanceof FluidRenderData) {
                    MekanismRenderer.renderValves(matrix, buffer, multiblock.valves, (FluidRenderData) data, pos, glow, overlayLight, isInsideMultiblock(data));
                }
            }
        }
    }
}
Also used : Model3D(mekanism.client.render.MekanismRenderer.Model3D) FluidRenderData(mekanism.client.render.data.FluidRenderData) FluidRenderData(mekanism.client.render.data.FluidRenderData) SlurryRenderData(mekanism.client.render.data.ChemicalRenderData.SlurryRenderData) PigmentRenderData(mekanism.client.render.data.ChemicalRenderData.PigmentRenderData) InfusionRenderData(mekanism.client.render.data.ChemicalRenderData.InfusionRenderData) GasRenderData(mekanism.client.render.data.ChemicalRenderData.GasRenderData) RenderData(mekanism.client.render.data.RenderData) TankMultiblockData(mekanism.common.content.tank.TankMultiblockData) BlockPos(net.minecraft.util.math.BlockPos) IVertexBuilder(com.mojang.blaze3d.vertex.IVertexBuilder)

Example 2 with TankMultiblockData

use of mekanism.common.content.tank.TankMultiblockData in project Mekanism by mekanism.

the class GuiDynamicTank method addGuiElements.

@Override
protected void addGuiElements() {
    // Add the side holder before the slots, as it holds a couple of the slots
    addButton(GuiSideHolder.armorHolder(this));
    addButton(new GuiElementHolder(this, 141, 16, 26, 56));
    super.addGuiElements();
    addButton(new GuiSlot(SlotType.INNER_HOLDER_SLOT, this, 145, 20));
    addButton(new GuiSlot(SlotType.INNER_HOLDER_SLOT, this, 145, 50));
    addButton(new GuiInnerScreen(this, 49, 21, 84, 46, () -> {
        List<ITextComponent> ret = new ArrayList<>();
        TankMultiblockData multiblock = tile.getMultiblock();
        long capacity = multiblock.getChemicalTankCapacity();
        switch(multiblock.mergedTank.getCurrentType()) {
            case EMPTY:
                ret.add(MekanismLang.EMPTY.translate());
                break;
            case FLUID:
                addStored(ret, multiblock.getFluidTank().getFluid(), FluidStack::getAmount);
                capacity = multiblock.getTankCapacity();
                break;
            case GAS:
                addStored(ret, multiblock.getGasTank());
                break;
            case INFUSION:
                addStored(ret, multiblock.getInfusionTank());
                break;
            case PIGMENT:
                addStored(ret, multiblock.getPigmentTank());
                break;
            case SLURRY:
                addStored(ret, multiblock.getSlurryTank());
                break;
        }
        ret.add(MekanismLang.CAPACITY.translate(""));
        ret.add(MekanismLang.GENERIC_MB.translate(TextUtils.format(capacity)));
        return ret;
    }).spacing(2));
    addButton(new GuiDownArrow(this, 150, 39));
    addButton(new GuiContainerEditModeTab<>(this, tile));
    addButton(new GuiMergedTankGauge<>(() -> tile.getMultiblock().mergedTank, tile::getMultiblock, GaugeType.MEDIUM, this, 7, 16, 34, 56));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiDownArrow(mekanism.client.gui.element.GuiDownArrow) FluidStack(net.minecraftforge.fluids.FluidStack) GuiElementHolder(mekanism.client.gui.element.GuiElementHolder) ITextComponent(net.minecraft.util.text.ITextComponent) ArrayList(java.util.ArrayList) TankMultiblockData(mekanism.common.content.tank.TankMultiblockData) GuiSlot(mekanism.client.gui.element.slot.GuiSlot)

Example 3 with TankMultiblockData

use of mekanism.common.content.tank.TankMultiblockData in project Mekanism by mekanism.

the class TileEntityDynamicTank method nextMode.

@Override
public void nextMode() {
    TankMultiblockData multiblock = getMultiblock();
    multiblock.setContainerEditMode(multiblock.editMode.getNext());
}
Also used : TankMultiblockData(mekanism.common.content.tank.TankMultiblockData)

Aggregations

TankMultiblockData (mekanism.common.content.tank.TankMultiblockData)3 IVertexBuilder (com.mojang.blaze3d.vertex.IVertexBuilder)1 ArrayList (java.util.ArrayList)1 GuiDownArrow (mekanism.client.gui.element.GuiDownArrow)1 GuiElementHolder (mekanism.client.gui.element.GuiElementHolder)1 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)1 GuiSlot (mekanism.client.gui.element.slot.GuiSlot)1 Model3D (mekanism.client.render.MekanismRenderer.Model3D)1 GasRenderData (mekanism.client.render.data.ChemicalRenderData.GasRenderData)1 InfusionRenderData (mekanism.client.render.data.ChemicalRenderData.InfusionRenderData)1 PigmentRenderData (mekanism.client.render.data.ChemicalRenderData.PigmentRenderData)1 SlurryRenderData (mekanism.client.render.data.ChemicalRenderData.SlurryRenderData)1 FluidRenderData (mekanism.client.render.data.FluidRenderData)1 RenderData (mekanism.client.render.data.RenderData)1 BlockPos (net.minecraft.util.math.BlockPos)1 ITextComponent (net.minecraft.util.text.ITextComponent)1 FluidStack (net.minecraftforge.fluids.FluidStack)1