use of crazypants.enderio.powertools.machine.capbank.render.FillGaugeBakery in project EnderIO by SleepyTrousers.
the class RenderMapperGauge method mapItemDynamicOverlayRender.
@Override
public ItemQuadCollector mapItemDynamicOverlayRender(@Nonnull Block block, @Nonnull ItemStack stack) {
double v = EnderIO.proxy.getTickCount() % 120;
if (v > 60) {
v = 120 - v;
}
double ratio = v / 60d;
FillGaugeBakery gauge = new FillGaugeBakery(BlockGauge.gaugeIcon.get(TextureAtlasSprite.class), ratio);
if (gauge.canRender()) {
ItemQuadCollector result = new ItemQuadCollector();
List<BakedQuad> quads = new ArrayList<BakedQuad>();
gauge.bake(quads);
result.addQuads(null, quads);
return result;
}
return null;
}
use of crazypants.enderio.powertools.machine.capbank.render.FillGaugeBakery in project EnderIO by SleepyTrousers.
the class TESRGauge method renderTileEntity.
@Override
protected void renderTileEntity(@Nonnull TileGauge te, @Nonnull IBlockState blockState, float partialTicks, int destroyStage) {
RenderHelper.enableStandardItemLighting();
World world = te.getWorld();
Map<EnumFacing, IPowerInterface> sides = BlockGauge.getDisplays(world, te.getPos());
if (!sides.isEmpty()) {
for (Entry<EnumFacing, IPowerInterface> side : sides.entrySet()) {
IPowerInterface eh = side.getValue();
EnumFacing face = side.getKey().getOpposite();
int energyStored = eh.getEnergyStored();
int maxEnergyStored = eh.getMaxEnergyStored();
float ratio = maxEnergyStored > 0 ? (float) energyStored / (float) maxEnergyStored : 0f;
FillGaugeBakery bakery = new FillGaugeBakery(world, te.getPos().offset(NullHelper.first(side.getKey(), EnumFacing.DOWN)), face, BlockGauge.gaugeIcon.get(TextureAtlasSprite.class), ratio);
if (bakery.canRender()) {
GL11.glPushMatrix();
GL11.glTranslated(-face.getFrontOffsetX(), -face.getFrontOffsetY(), -face.getFrontOffsetZ());
bakery.render();
GL11.glPopMatrix();
}
}
} else {
double v = EnderIO.proxy.getTickCount() % 100 + partialTicks;
if (v > 50) {
v = 100 - v;
}
double ratio = v / 50d;
for (EnumFacing face : EnumFacing.Plane.HORIZONTAL) {
FillGaugeBakery bakery = new FillGaugeBakery(world, te.getPos().offset(face.getOpposite()), face, BlockGauge.gaugeIcon.get(TextureAtlasSprite.class), ratio);
if (bakery.canRender()) {
// sic!
GL11.glPushMatrix();
GL11.glTranslated(-face.getFrontOffsetX(), -face.getFrontOffsetY(), -face.getFrontOffsetZ());
bakery.render();
GL11.glPopMatrix();
}
}
}
}
Aggregations