use of net.minecraft.util.EnumBlockRenderType in project MC-Prefab by Brian-Wuest.
the class StructureRenderHandler method renderBlockBrightness.
public static void renderBlockBrightness(IBlockState state, float brightness) {
BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
EnumBlockRenderType enumblockrendertype = state.getRenderType();
if (enumblockrendertype != EnumBlockRenderType.INVISIBLE) {
switch(enumblockrendertype) {
case MODEL:
case ENTITYBLOCK_ANIMATED:
{
// Only use the chest renderer if this is actually an instance of a chest.
if (enumblockrendertype == EnumBlockRenderType.ENTITYBLOCK_ANIMATED && state.getBlock() instanceof BlockChest) {
StructureRenderHandler.chestRenderer.renderChestBrightness(state.getBlock(), brightness);
break;
}
IBakedModel ibakedmodel = brd.getModelForState(state);
BlockModelRenderer renderer = brd.getBlockModelRenderer();
try {
renderer.renderModelBrightness(ibakedmodel, state, brightness, true);
} catch (Exception ex) {
// Don't do anything if a mod broke this vanilla block rendering. It just won't show up during the preview then.
int test = 1;
test = 2;
}
break;
}
default:
{
break;
}
}
}
}
use of net.minecraft.util.EnumBlockRenderType in project RFTools by McJty.
the class ElevatorTESR method renderBlock.
private static boolean renderBlock(BlockRendererDispatcher dispatcher, IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder worldRendererIn) {
try {
EnumBlockRenderType enumblockrendertype = state.getRenderType();
if (enumblockrendertype == EnumBlockRenderType.INVISIBLE) {
return false;
} else {
if (blockAccess.getWorldType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
try {
state = state.getActualState(blockAccess, pos);
} catch (Exception var8) {
}
}
switch(enumblockrendertype) {
case MODEL:
IBakedModel model = dispatcher.getModelForState(state);
state = state.getBlock().getExtendedState(state, blockAccess, pos);
return dispatcher.getBlockModelRenderer().renderModel(blockAccess, model, state, pos, worldRendererIn, false);
case ENTITYBLOCK_ANIMATED:
return false;
default:
return false;
}
}
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated");
CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state));
throw new ReportedException(crashreport);
}
}
use of net.minecraft.util.EnumBlockRenderType in project EnderIO by SleepyTrousers.
the class IoConfigRenderer method renderBlock.
public void renderBlock(@Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull IBlockAccess blockAccess, @Nonnull BufferBuilder worldRendererIn) {
try {
BlockRendererDispatcher blockrendererdispatcher = mc.getBlockRendererDispatcher();
EnumBlockRenderType type = state.getRenderType();
if (type != EnumBlockRenderType.MODEL) {
blockrendererdispatcher.renderBlock(state, pos, blockAccess, worldRendererIn);
return;
}
// We only want to change one param here, the check sides
IBakedModel ibakedmodel = blockrendererdispatcher.getModelForState(state);
state = state.getBlock().getExtendedState(state, world, pos);
blockrendererdispatcher.getBlockModelRenderer().renderModel(blockAccess, ibakedmodel, state, pos, worldRendererIn, false);
} catch (Throwable throwable) {
// Just bury a render issue here, it is only the IO screen
}
}
use of net.minecraft.util.EnumBlockRenderType in project Random-Things by lumien231.
the class AsmHandler method renderBlock.
@SideOnly(Side.CLIENT)
public static int renderBlock(BlockRendererDispatcher dispatcher, IBlockState state, BlockPos pos, IBlockAccess blockAccess, BufferBuilder worldRendererIn) {
synchronized (TileEntityLightRedirector.redirectorSet) {
if (!TileEntityLightRedirector.redirectorSet.isEmpty()) {
blockAccess = Minecraft.getMinecraft().world;
BlockPos changedPos = getSwitchedPosition(blockAccess, pos);
posSet.clear();
if (!changedPos.equals(pos)) {
state = blockAccess.getBlockState(changedPos);
try {
EnumBlockRenderType enumblockrendertype = state.getRenderType();
if (enumblockrendertype == EnumBlockRenderType.INVISIBLE) {
} else {
if (blockAccess.getWorldType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
try {
state = state.getActualState(blockAccess, changedPos);
} catch (Exception var8) {
;
}
}
switch(enumblockrendertype) {
case MODEL:
IBakedModel model = dispatcher.getModelForState(state);
state = state.getBlock().getExtendedState(state, blockAccess, changedPos);
return dispatcher.getBlockModelRenderer().renderModel(blockAccess, model, state, pos, worldRendererIn, true) ? 1 : 0;
case ENTITYBLOCK_ANIMATED:
return 0;
case LIQUID:
return 2;
default:
return 0;
}
}
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated");
CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state));
throw new ReportedException(crashreport);
}
return 0;
}
}
return 2;
}
}
Aggregations