use of net.minecraft.client.renderer.BlockRendererDispatcher in project BluePower by Qmunity.
the class BPMultipartModel method getQuads.
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) {
BlockRendererDispatcher brd = Minecraft.getInstance().getBlockRenderer();
Map<BlockState, IModelData> stateInfo = extraData.getData(TileBPMultipart.STATE_INFO);
if (stateInfo != null) {
return stateInfo.keySet().stream().flatMap(i -> brd.getBlockModel(i).getQuads(i, side, rand, stateInfo.get(i)).stream().map(q -> stateInfo.get(i).hasProperty(TileWire.COLOR_INFO) ? transform(q, stateInfo.get(i).getData(TileWire.COLOR_INFO), stateInfo.get(i).hasProperty(TileWire.LIGHT_INFO) ? stateInfo.get(i).getData(TileWire.LIGHT_INFO) : false) : q)).collect(Collectors.toList());
} else {
return Collections.emptyList();
}
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project MorePlanets by SteveKunG.
the class RenderFallingKoentusMeteor method doRender.
@Override
public void doRender(EntityFallingKoentusMeteor entity, double x, double y, double z, float entityYaw, float partialTicks) {
IBlockState state = MPBlocks.FALLEN_KOENTUS_METEOR.getDefaultState();
if (state.getRenderType() == EnumBlockRenderType.MODEL) {
World world = entity.getWorldObj();
if (state != world.getBlockState(new BlockPos(entity)) && state.getRenderType() != EnumBlockRenderType.INVISIBLE) {
this.bindEntityTexture(entity);
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder vertexbuffer = tessellator.getBuffer();
if (this.renderOutlines) {
GlStateManager.enableColorMaterial();
GlStateManager.enableOutlineMode(this.getTeamColor(entity));
}
vertexbuffer.begin(GLConstants.QUADS, DefaultVertexFormats.BLOCK);
BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ);
GlStateManager.translate((float) (x - blockpos.getX() - 0.5D), (float) (y - blockpos.getY()), (float) (z - blockpos.getZ() - 0.5D));
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(state), state, blockpos, vertexbuffer, false, MathHelper.getPositionRandom(entity.getOrigin()));
tessellator.draw();
if (this.renderOutlines) {
GlStateManager.disableOutlineMode();
GlStateManager.disableColorMaterial();
}
GlStateManager.enableLighting();
GlStateManager.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
}
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project Immersive-Tech by FerroO2000.
the class TileRenderSteamTurbine method render.
@Override
public void render(TileEntitySteamTurbine te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
if (!te.formed || te.isDummy() || !te.getWorld().isBlockLoaded(te.getPos(), false)) {
return;
}
final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockPos blockPos = te.getPos();
IBlockState state = getWorld().getBlockState(blockPos);
if (state.getBlock() != ITContent.blockMetalMultiblock) {
return;
}
state = state.getBlock().getActualState(state, getWorld(), blockPos);
state = state.withProperty(IEProperties.DYNAMICRENDER, true);
IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(state);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder worldRenderer = tessellator.getBuffer();
ClientUtils.bindAtlas();
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
GlStateManager.translate(.5, .5, .5);
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc(770, 771);
GlStateManager.enableBlend();
GlStateManager.disableCull();
if (Minecraft.isAmbientOcclusionEnabled()) {
GlStateManager.shadeModel(7425);
} else {
GlStateManager.shadeModel(7424);
}
GlStateManager.rotate(te.getAnimation().getAnimationRotation() + (te.getAnimation().getAnimationStep() * partialTicks), te.facing.getFrontOffsetX(), 0, te.facing.getFrontOffsetZ());
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
worldRenderer.setTranslation(-.5 - blockPos.getX(), -.5 - blockPos.getY(), -.5 - blockPos.getZ());
worldRenderer.color(255, 255, 255, 255);
blockRenderer.getBlockModelRenderer().renderModel(te.getWorld(), model, state, blockPos, worldRenderer, true);
worldRenderer.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project Galacticraft by micdoodle8.
the class RenderSmallAsteroid method doRender.
@Override
public void doRender(EntitySmallAsteroid asteroid, double x, double y, double z, float f, float partialTickTime) {
BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + 0.5F, (float) z);
GL11.glRotatef(asteroid.rotationPitch, 1, 0, 0);
GL11.glRotatef(asteroid.rotationYaw, 0, 1, 0);
this.bindEntityTexture(asteroid);
dispatcher.renderBlockBrightness(AsteroidBlocks.blockBasic.getDefaultState().withProperty(BlockBasicAsteroids.BASIC_TYPE, ASTEROID_0), 1.0F);
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project Galacticraft by micdoodle8.
the class RenderWebShot method doRender.
@Override
public void doRender(EntityWebShot entity, double x, double y, double z, float par8, float partialTicks) {
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
RenderHelper.disableStandardItemLighting();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
this.bindEntityTexture(entity);
GlStateManager.rotate((entity.ticksExisted + partialTicks) * 50.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.translate(-0.5F, -1F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(Blocks.WEB.getDefaultState(), 1.0F);
GlStateManager.translate(0.0F, 0.0F, 1.0F);
GlStateManager.popMatrix();
RenderHelper.enableStandardItemLighting();
}
Aggregations