use of net.minecraft.client.renderer.BlockRendererDispatcher in project GregTech by GregTechCE.
the class FacadeRenderer method renderBlockCover.
public static boolean renderBlockCover(CCRenderState ccrs, Matrix4 translation, IBlockAccess world, BlockPos pos, int side, IBlockState state, Cuboid6 bounds) {
EnumFacing face = EnumFacing.VALUES[side];
IBlockAccess coverAccess = new FacadeBlockAccess(world, pos, face, state);
BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
try {
state = state.getActualState(coverAccess, pos);
} catch (Exception ignored) {
}
IBakedModel model = dispatcher.getModelForState(state);
try {
state = state.getBlock().getExtendedState(state, coverAccess, pos);
} catch (Exception ignored) {
}
long posRand = net.minecraft.util.math.MathHelper.getPositionRandom(pos);
List<BakedQuad> bakedQuads = new LinkedList<>(model.getQuads(state, null, posRand));
for (EnumFacing face2 : EnumFacing.VALUES) {
bakedQuads.addAll(model.getQuads(state, face2, posRand));
}
List<CCQuad> quads = CCQuad.fromArray(bakedQuads);
quads = sliceQuads(quads, side, bounds);
if (!quads.isEmpty()) {
VertexLighterFlat lighter = setupLighter(ccrs, translation, state, coverAccess, pos, model);
return renderBlockQuads(lighter, coverAccess, state, quads, pos);
}
return false;
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project ICBM-Classic by BuiltBrokenModding.
the class RenderExBlock method renderBlock.
public void renderBlock(EntityExplosive entity, double x, double y, double z, float entityYaw, float partialTicks) {
final IBlockState blockState = BlockReg.blockExplosive.getDefaultState().withProperty(BlockICBM.ROTATION_PROP, // TODO get direction from rotation
EnumFacing.UP).withProperty(BlockExplosive.EX_PROP, entity.getExplosiveData());
final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
// expansion shortly before explosion
if ((float) entity.fuse - partialTicks + 1.0F < 10.0F) {
float f = 1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 10.0F;
f = MathHelper.clamp(f, 0.0F, 1.0F);
float f1 = 1.0F + f * f * f * 0.3F;
GlStateManager.scale(f1, f1, f1);
}
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(blockState, entity.getBrightness());
GlStateManager.translate(0.0F, 0.0F, 1.0F);
// white flashing
if (entity.fuse / 5 % 2 == 0) {
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA);
GlStateManager.color(1.0F, 1.0F, 1.0F, (1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F);
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
GlStateManager.enablePolygonOffset();
blockrendererdispatcher.renderBlockBrightness(BlockReg.blockExplosive.getDefaultState(), 1.0F);
GlStateManager.doPolygonOffset(0.0F, 0.0F);
GlStateManager.disablePolygonOffset();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.enableTexture2D();
}
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project ICBM-Classic by BuiltBrokenModding.
the class RenderEntityBlock method doRender.
@Override
public void doRender(EntityFlyingBlock entity, double x, double y, double z, float entityYaw, float partialTicks) {
super.doRender(entity, x, y, z, entityYaw, partialTicks);
final IBlockState blockState = entity.getBlockState();
final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(blockState, entity.getBrightness());
GlStateManager.translate(0.0F, 0.0F, 1.0F);
GlStateManager.popMatrix();
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project MorePlanets by SteveKunG.
the class RenderAntiGravFallingBlock method doRender.
@Override
public void doRender(EntityAntiGravFallingBlock entity, double x, double y, double z, float entityYaw, float partialTicks) {
if (entity.getBlockState() != null) {
IBlockState state = entity.getBlockState();
if (state.getRenderType() == EnumBlockRenderType.MODEL) {
World world = entity.world;
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 BetterWithAddons by DaedalusGame.
the class RenderArtifactFrame method renderModel.
private void renderModel(EntityArtifactFrame entity) {
BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
ModelManager modelmanager = blockrendererdispatcher.getBlockModelShapes().getModelManager();
IBakedModel ibakedmodel;
if (!entity.getDisplayedItem().isEmpty() && entity.getDisplayedItem().getItem() == Items.FILLED_MAP) {
// ModelResourceLocation mapModel = new ModelResourceLocation(new ResourceLocation("betterwithaddons",this.mapModel.getResourcePath()),this.mapModel.getVariant());
ibakedmodel = modelmanager.getModel(mapModel);
} else {
// ModelResourceLocation itemFrameModel = new ModelResourceLocation(new ResourceLocation("betterwithaddons",this.itemFrameModel.getResourcePath()),this.itemFrameModel.getVariant());
ibakedmodel = modelmanager.getModel(itemFrameModel);
}
// GlStateManager.pushMatrix();
// GlStateManager.translate(-0.5F, -0.5F, -0.5F);
blockrendererdispatcher.getBlockModelRenderer().renderModelBrightnessColor(ibakedmodel, 1.0F, 1.0F, 1.0F, 1.0F);
}
Aggregations