本文整理汇总了Java中net.minecraftforge.client.ForgeHooksClient.setRenderLayer方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeHooksClient.setRenderLayer方法的具体用法?Java ForgeHooksClient.setRenderLayer怎么用?Java ForgeHooksClient.setRenderLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.client.ForgeHooksClient
的用法示例。
在下文中一共展示了ForgeHooksClient.setRenderLayer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderBlockModel
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
public static void renderBlockModel(World world, BlockPos pos, IBlockState state) {
VertexBuffer wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
wr.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockModelShapes modelShapes = blockrendererdispatcher.getBlockModelShapes();
IBakedModel ibakedmodel = modelShapes.getModelForState(state);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
for(BlockRenderLayer layer : BlockRenderLayer.values()) {
if(state.getBlock().canRenderInLayer(state, layer)) {
ForgeHooksClient.setRenderLayer(layer);
blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, state, pos, wr, true);
}
}
ForgeHooksClient.setRenderLayer(null);
wr.setTranslation(0, 0, 0);
Tessellator.getInstance().draw();
}
示例2: getQuads
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
private void getQuads(ModelHolder holder, List<BakedQuad> quads)
{
if (holder.actualState.getRenderType() == EnumBlockRenderType.MODEL/* ||
holder.actualState.getRenderType() == EnumBlockRenderType.LIQUID*/)
{
BlockRenderLayer originalLayer = MinecraftForgeClient.getRenderLayer();
for (BlockRenderLayer layer : BlockRenderLayer.values())
{
if (holder.actualState.getBlock().canRenderInLayer(holder.actualState, layer))
{
ForgeHooksClient.setRenderLayer(layer);
for (final EnumFacing facing : EnumFacing.values())
{
quads.addAll(holder.model.getQuads(holder.extendedState, facing, 0));
}
quads.addAll(holder.model.getQuads(holder.extendedState, null, 0));
}
}
ForgeHooksClient.setRenderLayer(originalLayer);
}
}
示例3: renderMultiblock
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
public static final void renderMultiblock(final IBlockState state, final double x, final double y, final double z,
final BlockRendererDispatcher blockRender)
{
final Minecraft minecraft = Minecraft.getMinecraft();
minecraft.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
ForgeHooksClient.setRenderLayer(BlockRenderLayer.CUTOUT);
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
RenderHelper.disableStandardItemLighting();
GlStateManager.color(1f, 1f, 1f, 1f);
final int alpha = (int) (0.5 * 0xFF) << 24;
GlStateManager.enableBlend();
GlStateManager.enableTexture2D();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.colorMask(true, true, true, true);
GlStateManager.depthFunc(GL11.GL_LEQUAL);
RenderUtil.renderQuads(blockRender.getModelForState(state).getQuads(state, null, 0), alpha);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
示例4: renderBlock
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
protected void renderBlock(SuperTileEntity te, BufferBuilder buffer)
{
SuperBlock block = (SuperBlock) te.getBlockType();
if(block.blockRenderMode != BlockRenderMode.TESR) return;
if(MinecraftForgeClient.getRenderPass() == 0)
{
ForgeHooksClient.setRenderLayer(BlockRenderLayer.SOLID);
// FIXME: only do this when texture demands it and use FastTESR other times
GlStateManager.disableAlpha();
renderBlockInner(te, block, false, buffer);
GlStateManager.enableAlpha();
ForgeHooksClient.setRenderLayer(null);
}
else if(MinecraftForgeClient.getRenderPass() == 1)
{
ForgeHooksClient.setRenderLayer(BlockRenderLayer.TRANSLUCENT);
renderBlockInner(te, block, true, buffer);
ForgeHooksClient.setRenderLayer(null);
}
}
示例5: renderBlockModel
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
@SuppressWarnings("null")
public static void renderBlockModel(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, boolean translateToOrigin, boolean relight) {
VertexBuffer wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
if (translateToOrigin) {
wr.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
}
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockModelShapes modelShapes = blockrendererdispatcher.getBlockModelShapes();
IBakedModel ibakedmodel = modelShapes.getModelForState(state);
final IBlockAccess worldWrapper = relight ? new WorldWrapper(world, pos) : world;
for (BlockRenderLayer layer : BlockRenderLayer.values()) {
if (state.getBlock().canRenderInLayer(state, layer)) {
ForgeHooksClient.setRenderLayer(layer);
blockrendererdispatcher.getBlockModelRenderer().renderModel(worldWrapper, ibakedmodel, state, pos, wr, false);
}
}
ForgeHooksClient.setRenderLayer(null);
if (translateToOrigin) {
wr.setTranslation(0, 0, 0);
}
Tessellator.getInstance().draw();
}
示例6: addFriendlybakedModel
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
/**
* Adds a baked model that is expected to behave to the quad lists for the given block layer. The block layer will be set when the model is asked for its
* quads.
*/
public void addFriendlybakedModel(BlockRenderLayer pass, IBakedModel model, @Nullable IBlockState state, long rand) {
if (model != null) {
BlockRenderLayer oldRenderLayer = MinecraftForgeClient.getRenderLayer();
ForgeHooksClient.setRenderLayer(pass);
List<BakedQuad> generalQuads = model.getQuads(state, null, rand);
if (!generalQuads.isEmpty()) {
addQuads(null, pass, generalQuads);
}
for (EnumFacing face : EnumFacing.values()) {
List<BakedQuad> faceQuads = model.getQuads(state, face, rand);
if (!faceQuads.isEmpty()) {
addQuads(face, pass, faceQuads);
}
}
ForgeHooksClient.setRenderLayer(oldRenderLayer);
}
}
示例7: drawAll
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
private void drawAll(BlockPos playerPos, AbstractTankValve valve, World world) {
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.enableCull();
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
GlStateManager.enablePolygonOffset();
BlockPos valvePos = valve.getPos();
List<BlockPos> tankBlocks = FancyFluidStorage.tankManager.getFrameBlocksForValve(valve);
tankBlocks.add(valvePos);
Tessellator tess = Tessellator.getInstance();
VertexBuffer vb = tess.getBuffer();
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
vb.setTranslation(-playerX, -playerY, -playerZ);
for(BlockPos pos : tankBlocks) {
if(playerPos.distanceSq(pos) > 20)
continue;
IBlockState state = world.getBlockState(pos);
for(BlockRenderLayer layer : renderLayers) {
if(state.getBlock().canRenderInLayer(state, layer)) {
ForgeHooksClient.setRenderLayer(layer);
mc.getBlockRendererDispatcher().renderBlockDamage(state, pos, overlayTexture, world);
}
}
}
tess.draw();
vb.setTranslation(0, 0, 0);
GlStateManager.doPolygonOffset(0.0F, 0.0F);
GlStateManager.disablePolygonOffset();
GlStateManager.disableCull();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
示例8: renderGhostBlock
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
private void renderGhostBlock(final World fakeWorld, ModelHolder holder, final EntityPlayer player, final float partialTicks)
{
boolean existingModel = this.mc.world.isAirBlock(holder.pos) == false;
if (Configs.renderOverlapping == false && existingModel)
{
return;
}
IBlockState actualState = holder.actualState;
Block block = actualState.getBlock();
if (actualState.getRenderType() == EnumBlockRenderType.MODEL/* || actualState.getRenderType() == EnumBlockRenderType.LIQUID*/)
{
BlockRenderLayer originalLayer = MinecraftForgeClient.getRenderLayer();
for (BlockRenderLayer layer : BlockRenderLayer.values())
{
if (block.canRenderInLayer(actualState, layer))
{
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
ForgeHooksClient.setRenderLayer(layer);
this.renderGhostBlock(fakeWorld, holder, player, layer, existingModel, partialTicks);
}
}
ForgeHooksClient.setRenderLayer(originalLayer);
}
}
示例9: renderBlock
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
public void renderBlock(@Nonnull BlockPos pos, IBlockAccess blockAccess, double globalScale, boolean highlight) {
VertexBuffer tes = Tessellator.getInstance().getBuffer();
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
GlStateManager.pushMatrix();
GlStateManager.translate(0.5f, 0.5f, 0.5f);
GlStateManager.scale(globalScale, globalScale, globalScale);
GlStateManager.translate(-0.5f, -0.5f, -0.5f);
IBlockState state = blockAccess.getBlockState(pos).getActualState(blockAccess, pos);
IBakedModel ibakedmodel = blockrendererdispatcher.getModelForState(state);
state = state.getBlock().getExtendedState(state, blockAccess, pos);
tes.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
Vector4f color = highlight ? selectedBlockBlend : blockBlend;
GlStateManager.color(1, 1, 1, 1);
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_CONSTANT_COLOR, GlStateManager.SourceFactor.ONE.factor,
GlStateManager.DestFactor.ZERO.factor);
GL14.glBlendColor(color.x, color.y, color.z, color.w);
tes.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
for (BlockRenderLayer layer : BlockRenderLayer.values()) {
if (state.getBlock().canRenderInLayer(state, NullHelper.notnullJ(layer, "BlockRenderLayer value was null!"))) {
ForgeHooksClient.setRenderLayer(layer);
blockrendererdispatcher.getBlockModelRenderer().renderModel(blockAccess, ibakedmodel, state, pos, tes, false);
}
}
ForgeHooksClient.setRenderLayer(null);
Tessellator.getInstance().draw();
GL14.glBlendColor(1, 1, 1, 1);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
tes.setTranslation(0, 0, 0);
GlStateManager.popMatrix();
}
示例10: collectOverlayQuads
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
public static void collectOverlayQuads(@Nonnull ModelBakeEvent event) {
final Block block = ModObject.block_machine_io.getBlockNN();
Map<IBlockState, ModelResourceLocation> locations = event.getModelManager().getBlockModelShapes().getBlockStateMapper().getVariants(block);
NNIterator<IOMode> modes = crazypants.enderio.base.render.property.IOMode.MODES.iterator();
while (modes.hasNext()) {
IOMode mode = modes.next();
IBlockState state = block.getDefaultState().withProperty(IOMode.IO, mode);
ModelResourceLocation mrl = locations.get(state);
if (mrl == null) {
throw new RuntimeException("Model for state " + state + " failed to load from " + mrl + ". ");
}
IBakedModel model = event.getModelRegistry().getObject(mrl);
if (model == null) {
Log.warn("Model for state " + state + " failed to load from " + mrl + ".");
continue;
}
QuadCollector quads = new QuadCollector();
BlockRenderLayer oldRenderLayer = MinecraftForgeClient.getRenderLayer();
BlockRenderLayer layer = block.getBlockLayer();
ForgeHooksClient.setRenderLayer(layer);
List<BakedQuad> generalQuads = model.getQuads(state, null, 0);
if (!generalQuads.isEmpty()) {
quads.addQuads(null, layer, generalQuads);
}
for (EnumFacing face1 : EnumFacing.values()) {
List<BakedQuad> faceQuads = model.getQuads(state, mode.getDirection(), 0);
if (!faceQuads.isEmpty()) {
quads.addQuads(face1, layer, faceQuads);
}
}
ForgeHooksClient.setRenderLayer(oldRenderLayer);
data[mode.getDirection().ordinal()][mode.getIomode().ordinal()] = quads;
}
}
示例11: renderScene
import net.minecraftforge.client.ForgeHooksClient; //导入方法依赖的package包/类
private void renderScene() {
GlStateManager.enableCull();
GlStateManager.enableRescaleNormal();
RenderHelper.disableStandardItemLighting();
mc.entityRenderer.disableLightmap();
RenderUtil.bindBlockTexture();
GlStateManager.disableLighting();
GlStateManager.enableTexture2D();
GlStateManager.enableAlpha();
final Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z);
BlockRenderLayer oldRenderLayer = MinecraftForgeClient.getRenderLayer();
try {
NNList.of(BlockRenderLayer.class).apply(new Callback<BlockRenderLayer>() {
@Override
public void apply(@Nonnull BlockRenderLayer layer) {
ForgeHooksClient.setRenderLayer(layer);
setGlStateForPass(layer);
doWorldRenderPass(trans, configurables, layer);
}
});
} finally {
ForgeHooksClient.setRenderLayer(oldRenderLayer);
GlStateManager.depthMask(true);
}
}