use of net.minecraft.client.renderer.BlockRendererDispatcher in project LogisticsPipes by RS485.
the class SideConfigDisplay method renderBlock.
public void renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder worldRendererIn) {
try {
BlockRendererDispatcher blockrendererdispatcher = mc.getBlockRendererDispatcher();
EnumBlockRenderType type = state.getRenderType();
if (type != EnumBlockRenderType.MODEL) {
blockrendererdispatcher.renderBlock(state, pos, blockAccess, worldRendererIn);
return;
}
IBakedModel ibakedmodel = blockrendererdispatcher.getModelForState(state);
state = state.getBlock().getExtendedState(state, world, pos);
blockrendererdispatcher.getBlockModelRenderer().renderModel(blockAccess, ibakedmodel, state, pos, worldRendererIn, false);
} catch (Throwable ignored) {
}
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project TechReborn by TechReborn.
the class RenderNukePrimed method doRender.
@Override
public void doRender(EntityNukePrimed entity, double x, double y, double z, float entityYaw, float partialTicks) {
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
if ((float) entity.fuse - partialTicks + 1.0F < 10.0F) {
float f = 1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 10.0F;
f = MathHelper.clamp_float(f, 0.0F, 1.0F);
f = f * f;
f = f * f;
float f1 = 1.0F + f * 0.3F;
GlStateManager.scale(f1, f1, f1);
}
float f2 = (1.0F - ((float) entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
this.bindEntityTexture(entity);
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(ModBlocks.nuke.getDefaultState(), entity.getBrightness(partialTicks));
GlStateManager.translate(0.0F, 0.0F, 1.0F);
if (entity.fuse / 5 % 2 == 0) {
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 772);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1F);
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
GlStateManager.enablePolygonOffset();
blockrendererdispatcher.renderBlockBrightness(ModBlocks.nuke.getDefaultState().withProperty(BlockNuke.OVERLAY, true), 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.popMatrix();
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project Galacticraft by micdoodle8.
the class RenderProjectileTNT method doRender.
@Override
public void doRender(EntityProjectileTNT entity, double x, double y, double z, float par8, float partialTicks) {
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + 0.5F, (float) z);
float f2 = (1.0F - ((float) entity.ticksExisted - partialTicks + 1.0F) / 100.0F) * 0.1F;
this.bindEntityTexture(entity);
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), entity.getBrightness());
GlStateManager.translate(0.0F, 0.0F, 1.0F);
if (entity.ticksExisted % 2 == 0) {
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 772);
GlStateManager.color(1.0F, 1.0F, 1.0F, f2);
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
GlStateManager.enablePolygonOffset();
blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), 0.2F);
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();
super.doRender(entity, x, y, z, par8, partialTicks);
}
use of net.minecraft.client.renderer.BlockRendererDispatcher in project Wizardry by TeamWizardry.
the class StructureManager method bake.
/**
* Called automatically in bake event. If baking again is required, you can use this.
*/
@SideOnly(Side.CLIENT)
public void bake(ResourceLocation resourceLocation) {
Wizardry.LOGGER.info("Attempting to bake structure \"" + resourceLocation.toString() + "\"");
WizardryStructure structure = structures.get(resourceLocation);
if (structure == null) {
Wizardry.LOGGER.error("Could not bake structure \"" + resourceLocation.toString() + "\". Does not seem to exist?");
return;
}
HashMultimap<Integer, Template.BlockInfo> blocks = HashMultimap.create();
for (Template.BlockInfo info : structure.blockInfos()) {
if (info.blockState.getMaterial() == Material.AIR)
continue;
if (info.blockState.getRenderType() == EnumBlockRenderType.INVISIBLE)
continue;
blocks.put(info.blockState.getBlock().getRenderLayer().ordinal(), info);
}
BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
// noinspection ConstantConditions
if (dispatcher == null) {
Wizardry.LOGGER.error("Could not bake structure \"" + resourceLocation.toString() + "\". Dispatcher is null. Don't call bake so early?");
return;
}
Tessellator tes = Tessellator.getInstance();
BufferBuilder bb = tes.getBuffer();
HashMap<Integer, int[]> cache = new HashMap<>();
for (int layerID : blocks.keySet()) {
bb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
for (Template.BlockInfo info : blocks.get(layerID)) {
if (info.blockState == null)
continue;
if (info.blockState.getMaterial() == Material.AIR)
continue;
if (info.blockState.getRenderType() == EnumBlockRenderType.INVISIBLE)
continue;
bb.setTranslation(info.pos.getX() - structure.getOrigin().getX(), info.pos.getY() - structure.getOrigin().getY(), info.pos.getZ() - structure.getOrigin().getZ());
dispatcher.renderBlock(info.blockState, BlockPos.ORIGIN, structure.getWizardryAccess(), bb);
bb.setTranslation(0, 0, 0);
}
cache.put(layerID, ClientUtilMethods.createCacheArrayAndReset(bb));
bb.reset();
}
vboCache.put(resourceLocation, cache);
Wizardry.LOGGER.info("Baking for structure \"" + resourceLocation.toString() + "\" completed.");
}
Aggregations