use of mekanism.generators.common.content.turbine.TurbineMultiblockData in project Mekanism by mekanism.
the class RenderIndustrialTurbine method render.
@Override
protected void render(TileEntityTurbineCasing tile, float partialTick, MatrixStack matrix, IRenderTypeBuffer renderer, int light, int overlayLight, IProfiler profiler) {
if (tile.isMaster()) {
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed() && multiblock.complex != null && multiblock.renderLocation != null) {
BlockPos pos = tile.getBlockPos();
BlockPos complexPos = multiblock.complex;
IVertexBuilder buffer = RenderTurbineRotor.INSTANCE.model.getBuffer(renderer);
profiler.push(GeneratorsProfilerConstants.TURBINE_ROTOR);
while (true) {
complexPos = complexPos.below();
TileEntityTurbineRotor rotor = WorldUtils.getTileEntity(TileEntityTurbineRotor.class, tile.getLevel(), complexPos);
if (rotor == null) {
break;
}
matrix.pushPose();
matrix.translate(complexPos.getX() - pos.getX(), complexPos.getY() - pos.getY(), complexPos.getZ() - pos.getZ());
RenderTurbineRotor.INSTANCE.render(rotor, matrix, buffer, MekanismRenderer.FULL_SKY_LIGHT, overlayLight);
matrix.popPose();
}
profiler.pop();
if (!multiblock.gasTank.isEmpty() && multiblock.length() > 0) {
int height = multiblock.lowerVolume / (multiblock.length() * multiblock.width());
if (height >= 1) {
GasRenderData data = new GasRenderData(multiblock.gasTank.getStack());
data.location = multiblock.renderLocation;
data.height = height;
data.length = multiblock.length();
data.width = multiblock.width();
int glow = data.calculateGlowLight(MekanismRenderer.FULL_SKY_LIGHT);
matrix.pushPose();
matrix.translate(data.location.getX() - pos.getX(), data.location.getY() - pos.getY(), data.location.getZ() - pos.getZ());
Model3D gasModel = ModelRenderer.getModel(data, 1);
MekanismRenderer.renderObject(gasModel, matrix, renderer.getBuffer(Atlases.translucentCullBlockSheet()), data.getColorARGB(multiblock.prevSteamScale), glow, overlayLight, getFaceDisplay(data, gasModel));
matrix.popPose();
}
}
}
}
}
use of mekanism.generators.common.content.turbine.TurbineMultiblockData in project Mekanism by mekanism.
the class GuiIndustrialTurbine method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiInnerScreen(this, 50, 18, 112, 50, () -> {
List<ITextComponent> list = new ArrayList<>();
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
list.add(GeneratorsLang.TURBINE_PRODUCTION_AMOUNT.translate(EnergyDisplay.of(multiblock.getProductionRate())));
list.add(GeneratorsLang.TURBINE_FLOW_RATE.translate(TextUtils.format(multiblock.clientFlow)));
list.add(GeneratorsLang.TURBINE_CAPACITY.translate(TextUtils.format(multiblock.getSteamCapacity())));
list.add(GeneratorsLang.TURBINE_MAX_FLOW.translate(TextUtils.format(multiblock.getMaxFlowRate())));
}
return list;
}));
addButton(new GuiTurbineTab(this, tile, TurbineTab.STAT));
addButton(new GuiVerticalPowerBar(this, new IBarInfoHandler() {
@Override
public ITextComponent getTooltip() {
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
return EnergyDisplay.of(multiblock.energyContainer).getTextComponent();
}
return EnergyDisplay.ZERO.getTextComponent();
}
@Override
public double getLevel() {
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
return multiblock.energyContainer.getEnergy().divideToLevel(multiblock.energyContainer.getMaxEnergy());
}
return 1;
}
}, 164, 16));
addButton(new GuiVerticalRateBar(this, new IBarInfoHandler() {
@Override
public ITextComponent getTooltip() {
return GeneratorsLang.TURBINE_STEAM_INPUT_RATE.translate(TextUtils.format(tile.getMultiblock().lastSteamInput));
}
@Override
public double getLevel() {
TurbineMultiblockData multiblock = tile.getMultiblock();
if (!multiblock.isFormed()) {
return 0;
}
double rate = Math.min(multiblock.lowerVolume * multiblock.getDispersers() * MekanismGeneratorsConfig.generators.turbineDisperserGasFlow.get(), multiblock.vents * MekanismGeneratorsConfig.generators.turbineVentGasFlow.get());
if (rate == 0) {
return 0;
}
return Math.min(1, multiblock.lastSteamInput / rate);
}
}, 40, 13));
addButton(new GuiGasGauge(() -> tile.getMultiblock().gasTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.MEDIUM, this, 6, 13));
addButton(new GuiEnergyTab(this, () -> {
EnergyDisplay storing;
EnergyDisplay producing;
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
storing = EnergyDisplay.of(multiblock.energyContainer);
producing = EnergyDisplay.of(MekanismConfig.general.maxEnergyPerSteam.get().divide(TurbineValidator.MAX_BLADES).multiply(multiblock.clientFlow * Math.min(multiblock.blades, multiblock.coils * MekanismGeneratorsConfig.generators.turbineBladesPerCoil.get())));
} else {
storing = EnergyDisplay.ZERO;
producing = EnergyDisplay.ZERO;
}
return Arrays.asList(MekanismLang.STORING.translate(storing), GeneratorsLang.PRODUCING_AMOUNT.translate(producing));
}));
addButton(new GuiGasMode(this, 159, 72, true, () -> tile.getMultiblock().dumpMode, tile.getBlockPos(), 0));
}
use of mekanism.generators.common.content.turbine.TurbineMultiblockData in project Mekanism by mekanism.
the class GuiTurbineStats method drawForegroundText.
@Override
protected void drawForegroundText(@Nonnull MatrixStack matrix, int mouseX, int mouseY) {
drawTitleText(matrix, GeneratorsLang.TURBINE_STATS.translate(), titleLabelY);
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
ITextComponent limiting = GeneratorsLang.IS_LIMITING.translateColored(EnumColor.DARK_RED);
int lowerVolume = multiblock.lowerVolume;
int dispersers = multiblock.getDispersers();
int vents = multiblock.vents;
drawString(matrix, GeneratorsLang.TURBINE_TANK_VOLUME.translate(lowerVolume), 8, 26, titleTextColor());
boolean dispersersLimiting = lowerVolume * dispersers * MekanismGeneratorsConfig.generators.turbineDisperserGasFlow.get() < vents * MekanismGeneratorsConfig.generators.turbineVentGasFlow.get();
boolean ventsLimiting = lowerVolume * dispersers * MekanismGeneratorsConfig.generators.turbineDisperserGasFlow.get() > vents * MekanismGeneratorsConfig.generators.turbineVentGasFlow.get();
drawString(matrix, GeneratorsLang.TURBINE_STEAM_FLOW.translate(), 8, 40, subheadingTextColor());
drawString(matrix, GeneratorsLang.TURBINE_DISPERSERS.translate(dispersers, dispersersLimiting ? limiting : ""), 14, 49, titleTextColor());
drawString(matrix, GeneratorsLang.TURBINE_VENTS.translate(vents, ventsLimiting ? limiting : ""), 14, 58, titleTextColor());
int coils = multiblock.coils;
int blades = multiblock.blades;
drawString(matrix, GeneratorsLang.TURBINE_PRODUCTION.translate(), 8, 72, subheadingTextColor());
drawString(matrix, GeneratorsLang.TURBINE_BLADES.translate(blades, coils * 4 > blades ? limiting : ""), 14, 81, titleTextColor());
drawString(matrix, GeneratorsLang.TURBINE_COILS.translate(coils, coils * 4 < blades ? limiting : ""), 14, 90, titleTextColor());
drawTextScaledBound(matrix, GeneratorsLang.TURBINE_MAX_PRODUCTION.translate(EnergyDisplay.of(multiblock.getMaxProduction())), 8, 104, titleTextColor(), 164);
drawTextScaledBound(matrix, GeneratorsLang.TURBINE_MAX_WATER_OUTPUT.translate(TextUtils.format(multiblock.getMaxWaterOutput())), 8, 113, titleTextColor(), 164);
}
super.drawForegroundText(matrix, mouseX, mouseY);
}
use of mekanism.generators.common.content.turbine.TurbineMultiblockData in project Mekanism by mekanism.
the class GuiTurbineStats method addGuiElements.
@Override
protected void addGuiElements() {
super.addGuiElements();
addButton(new GuiTurbineTab(this, tile, TurbineTab.MAIN));
addButton(new GuiEnergyTab(this, () -> {
EnergyDisplay storing;
EnergyDisplay producing;
TurbineMultiblockData multiblock = tile.getMultiblock();
if (multiblock.isFormed()) {
storing = EnergyDisplay.of(multiblock.energyContainer);
producing = EnergyDisplay.of(MekanismConfig.general.maxEnergyPerSteam.get().divide(TurbineValidator.MAX_BLADES).multiply(multiblock.clientFlow * Math.min(multiblock.blades, multiblock.coils * MekanismGeneratorsConfig.generators.turbineBladesPerCoil.get())));
} else {
storing = EnergyDisplay.ZERO;
producing = EnergyDisplay.ZERO;
}
return Arrays.asList(MekanismLang.STORING.translate(storing), GeneratorsLang.PRODUCING_AMOUNT.translate(producing));
}));
}
use of mekanism.generators.common.content.turbine.TurbineMultiblockData in project Mekanism by mekanism.
the class TileEntityTurbineCasing method nextMode.
@Override
public void nextMode(int tank) {
if (tank == 0) {
TurbineMultiblockData multiblock = getMultiblock();
multiblock.setDumpMode(multiblock.dumpMode.getNext());
}
}
Aggregations