當前位置: 首頁>>代碼示例>>Java>>正文


Java BlockRendererDispatcher.getModelForState方法代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.BlockRendererDispatcher.getModelForState方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockRendererDispatcher.getModelForState方法的具體用法?Java BlockRendererDispatcher.getModelForState怎麽用?Java BlockRendererDispatcher.getModelForState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.renderer.BlockRendererDispatcher的用法示例。


在下文中一共展示了BlockRendererDispatcher.getModelForState方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildCoverQuads

import net.minecraft.client.renderer.BlockRendererDispatcher; //導入方法依賴的package包/類
public static List<CustomBakedQuad> buildCoverQuads(IBlockAccess world, BlockPos pos, IBlockState state, int side, AxisAlignedBB bounds, final CoverCutter.ITransformer[] cutType){
	final EnumFacing face = EnumFacing.getFront(side);
       final IBlockAccess coverAccess = new PipeBlockAccessWrapper(world, pos, face);
       final BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
       try {
           state = state.getActualState(coverAccess, pos);
       }
       catch (Exception ex) {}
       final IBakedModel model = dispatcher.getModelForState(state);
       try {
           state = state.getBlock().getExtendedState(state, coverAccess, pos);
       }
       catch (Exception ex2) {}
       final List<BakedQuad> bakedQuads = new LinkedList<BakedQuad>();
       final long posRand = MathHelper.getPositionRandom(pos);
       bakedQuads.addAll(model.getQuads(state, (EnumFacing)null, posRand));
       for (final EnumFacing face2 : EnumFacing.VALUES) {
           bakedQuads.addAll(model.getQuads(state, face2, posRand));
       }
       List<CustomBakedQuad> quads = CustomBakedQuad.fromArray(bakedQuads);
       if (cutType != null) {
           quads = CoverCutter.cut(quads, side, cutType);
       }
       quads = sliceQuads(quads, side, bounds);
       return quads;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:27,代碼來源:CoverRender.java

示例2: renderBlock

import net.minecraft.client.renderer.BlockRendererDispatcher; //導入方法依賴的package包/類
public void renderBlock(@Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull IBlockAccess blockAccess, @Nonnull VertexBuffer 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
    }
  }
 
開發者ID:SleepyTrousers,項目名稱:EnderIO,代碼行數:20,代碼來源:IoConfigRenderer.java

示例3: renderBakedCoverQuads

import net.minecraft.client.renderer.BlockRendererDispatcher; //導入方法依賴的package包/類
public static boolean renderBakedCoverQuads(VertexBuffer buffer, IBlockAccess world, BlockPos pos, IBlockState state, int side, AxisAlignedBB bounds, final CoverCutter.ITransformer[] cutType){
	final EnumFacing face = EnumFacing.getFront(side);
       final IBlockAccess coverAccess = new PipeBlockAccessWrapper(world, pos, face);
       final BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
       try {
           state = state.getActualState(coverAccess, pos);
       }
       catch (Exception ex) {}
       final IBakedModel model = dispatcher.getModelForState(state);
       try {
           state = state.getBlock().getExtendedState(state, coverAccess, pos);
       }
       catch (Exception ex2) {}
       final List<BakedQuad> bakedQuads = new LinkedList<BakedQuad>();
       final long posRand = MathHelper.getPositionRandom(pos);
       bakedQuads.addAll(model.getQuads(state, (EnumFacing)null, posRand));
       for (final EnumFacing face2 : EnumFacing.VALUES) {
           bakedQuads.addAll(model.getQuads(state, face2, posRand));
       }
       List<CustomBakedQuad> quads = CustomBakedQuad.fromArray(bakedQuads);
       if (cutType != null) {
           quads = CoverCutter.cut(quads, side, cutType);
       }
       quads = sliceQuads(quads, side, bounds);
	if (!quads.isEmpty()) {
           final VertexLighterFlat lighter = setupLighter(buffer, state, coverAccess, pos, model);
           return renderBlockQuads(lighter, coverAccess, state, quads, pos);
       }
       return false;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:31,代碼來源:CoverRender.java

示例4: renderBlock

import net.minecraft.client.renderer.BlockRendererDispatcher; //導入方法依賴的package包/類
public static boolean renderBlock(BlockRendererDispatcher dispatcher, IBlockState state, BlockPos pos, IBlockAccess blockAccess, VertexBuffer worldRendererIn) {
	 try {
         EnumBlockRenderType enumblockrendertype = state.getRenderType();

         if (enumblockrendertype == EnumBlockRenderType.INVISIBLE) {
             return false;
         } else {
             if (blockAccess.getWorldType() != WorldType.DEBUG_WORLD) {
                 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);
     }
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:34,代碼來源:TileEntityElevatorRenderer.java

示例5: getChiselBodyModelRenderer

import net.minecraft.client.renderer.BlockRendererDispatcher; //導入方法依賴的package包/類
private ModelRenderer getChiselBodyModelRenderer(ICarvingVariation variation, PartDefinition partDefinition, World world, BlockPos position)
{
    final IBlockState blockState = variation.getBlockState();
    final BlockRendererDispatcher blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher();
    ChiselExtendedState chiselState = new ChiselExtendedState(blockState, world, position);
    final IBakedModel model = blockRenderer.getModelForState(blockState);


    return getModelRendererForBlockState(partDefinition, chiselState, model);
}
 
開發者ID:AtomicBlom,項目名稱:ShearMadness,代碼行數:11,代碼來源:DefaultChiselModelMaker.java

示例6: renderBlock

import net.minecraft.client.renderer.BlockRendererDispatcher; //導入方法依賴的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();
}
 
開發者ID:SleepyTrousers,項目名稱:EnderIO,代碼行數:37,代碼來源:TravelEntitySpecialRenderer.java

示例7: renderBlock

import net.minecraft.client.renderer.BlockRendererDispatcher; //導入方法依賴的package包/類
public void renderBlock(@Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull VertexBuffer worldRendererIn) {
  try {
    BlockRendererDispatcher blockrendererdispatcher = mc.getBlockRendererDispatcher();
    EnumBlockRenderType type = state.getRenderType();
    if (type != EnumBlockRenderType.MODEL) {
      blockrendererdispatcher.renderBlock(state, pos, Minecraft.getMinecraft().world, worldRendererIn);
      return;
    }
    IBakedModel ibakedmodel = blockrendererdispatcher.getModelForState(state);
    blockrendererdispatcher.getBlockModelRenderer().renderModel(Minecraft.getMinecraft().world, ibakedmodel, state, pos, worldRendererIn, false);
  } catch (Throwable throwable) {
    // Just bury a render issue here, it is only the IO screen
  }
}
 
開發者ID:SleepyTrousers,項目名稱:EnderIO,代碼行數:15,代碼來源:BlockSceneRenderer.java

示例8: renderEgg

import net.minecraft.client.renderer.BlockRendererDispatcher; //導入方法依賴的package包/類
protected void renderEgg(EntityTameableDragon dragon, double x, double y, double z, float pitch, float partialTicks) {
    // apply egg wiggle
    DragonLifeStageHelper lifeStage = dragon.getLifeStageHelper();
    float tickX = lifeStage.getEggWiggleX();
    float tickZ = lifeStage.getEggWiggleZ();

    float rotX = 0;
    float rotZ = 0;

    if (tickX > 0) {
        rotX = (float) Math.sin(tickX - partialTicks) * 8;
    }
    if (tickZ > 0) {
        rotZ = (float) Math.sin(tickZ - partialTicks) * 8;
    }

    // prepare GL states
    GlStateManager.pushMatrix();
    GlStateManager.pushAttrib();
    GlStateManager.translate(x, y, z);
    GlStateManager.rotate(rotX, 1, 0, 0);
    GlStateManager.rotate(rotZ, 0, 0, 1);
    GlStateManager.disableLighting();
    
    bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

    // prepare egg rendering
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vb = tessellator.getBuffer();
    vb.begin(GL_QUADS, DefaultVertexFormats.BLOCK);

    Block block = BlockDragonBreedEgg.INSTANCE;
    IBlockState iblockstate = block.getDefaultState().withProperty(
            BlockDragonBreedEgg.BREED, dragon.getBreedType());
    BlockPos blockpos = dragon.getPosition();
    
    double tx = -blockpos.getX() - 0.5;
    double ty = -blockpos.getY();
    double tz = -blockpos.getZ() - 0.5;
    vb.setTranslation(tx, ty, tz);
    
    BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
    IBakedModel bakedModel = brd.getModelForState(iblockstate);
    
    // render egg
    brd.getBlockModelRenderer().renderModel(dragon.worldObj, bakedModel,
            iblockstate, blockpos, vb, false);
    vb.setTranslation(0, 0, 0);
    
    tessellator.draw();
    
    // restore GL state
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
    GlStateManager.popAttrib();
}
 
開發者ID:ata4,項目名稱:dragon-mounts,代碼行數:57,代碼來源:DragonRenderer.java


注:本文中的net.minecraft.client.renderer.BlockRendererDispatcher.getModelForState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。