use of net.minecraft.client.renderer.block.model.IBakedModel in project Binnie by ForestryMC.
the class ModelManager method registerCustomModels.
public static void registerCustomModels(ModelBakeEvent event) {
IRegistry<ModelResourceLocation, IBakedModel> registry = event.getModelRegistry();
for (final BlockModelEntry entry : customBlockModels) {
registry.putObject(entry.blockModelLocation, entry.model);
if (entry.itemModelLocation != null) {
registry.putObject(entry.itemModelLocation, entry.model);
}
}
IModelState defaultBlockState = ModelUtil.loadModelState(new ResourceLocation("minecraft:models/block/block"));
IModelState defaultFenceState = ModelUtil.loadModelState(new ResourceLocation("minecraft:models/block/fence_inventory"));
ModelManager.defaultFenceState = mergeStates(defaultBlockState, defaultFenceState);
}
use of net.minecraft.client.renderer.block.model.IBakedModel in project Binnie by ForestryMC.
the class ControlLumbermillProgress method getWoodSprite.
@SideOnly(Side.CLIENT)
private TextureAtlasSprite getWoodSprite(ItemStack stack) {
Minecraft mc = Minecraft.getMinecraft();
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
ItemModelMesher modelMesher = renderItem.getItemModelMesher();
IBakedModel model = modelMesher.getItemModel(stack);
TextureAtlasSprite sprite = model.getParticleTexture();
if (sprite == mc.getTextureMapBlocks().getMissingSprite()) {
return getWoodSprite(new ItemStack(Blocks.LOG));
}
return sprite;
}
use of net.minecraft.client.renderer.block.model.IBakedModel in project Random-Things by lumien231.
the class ModelFluidDisplay method getQuads.
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
if (state == null) {
return defaultModel.getQuads(state, side, rand);
}
IExtendedBlockState extendedState = (IExtendedBlockState) state;
IBakedModel model = defaultModel;
FluidStack fluidStack = extendedState.getValue(BlockFluidDisplay.FLUID);
if (fluidStack != null) {
boolean flowing = extendedState.getValue(BlockFluidDisplay.FLOWING);
Rotation rotation = extendedState.getValue(BlockFluidDisplay.ROTATION);
CacheEntry entry = new CacheEntry(fluidStack, rotation);
HashMap<CacheEntry, ModelCubeAll> cache = flowing ? modelCacheFlowing : modelCache;
if (cache.containsKey(entry)) {
model = cache.get(entry);
} else {
Fluid fluid = fluidStack.getFluid();
if (fluid != null) {
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
cache.put(new CacheEntry(fluidStack, rotation), new ModelCubeAll(flowing ? textureMap.getAtlasSprite(fluid.getFlowing().toString()) : textureMap.getAtlasSprite(fluid.getStill().toString()), true, rotation));
model = cache.get(entry);
}
}
}
return model.getQuads(extendedState, side, rand);
}
use of net.minecraft.client.renderer.block.model.IBakedModel in project takumicraft by TNTModders.
the class RenderTakumiCreepered method draw.
private void draw(T te, double x, double y, double z, IBlockState state, BlockPos pos, BufferBuilder buffer, Tessellator tessellator) {
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc(770, 771);
GlStateManager.enableBlend();
GlStateManager.disableCull();
if (Minecraft.isAmbientOcclusionEnabled()) {
GlStateManager.shadeModel(7425);
} else {
GlStateManager.shadeModel(7424);
}
buffer.begin(7, DefaultVertexFormats.BLOCK);
buffer.setTranslation((float) x - pos.getX(), (float) y - pos.getY(), (float) z - pos.getZ());
World world = this.getWorld();
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
state = state.getBlock().getExtendedState(state, world, pos);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModel(world, model, state, pos, buffer, true);
buffer.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
}
use of net.minecraft.client.renderer.block.model.IBakedModel in project takumicraft by TNTModders.
the class RenderTakumiBlock method draw.
private void draw(T te, double x, double y, double z, IBlockState state, BlockPos pos, BufferBuilder buffer, Tessellator tessellator) {
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc(770, 771);
GlStateManager.enableBlend();
GlStateManager.disableCull();
if (Minecraft.isAmbientOcclusionEnabled()) {
GlStateManager.shadeModel(7425);
} else {
GlStateManager.shadeModel(7424);
}
buffer.begin(7, DefaultVertexFormats.BLOCK);
buffer.setTranslation((float) x - pos.getX(), (float) y - pos.getY(), (float) z - pos.getZ());
World world = this.getWorld();
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
state = state.getBlock().getExtendedState(state, world, pos);
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModel(world, model, state, pos, buffer, true);
buffer.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
}
Aggregations