use of net.minecraft.client.renderer.BlockModelShapes in project EnderIO by SleepyTrousers.
the class ItemQuadCollector method addBlockState.
public void addBlockState(IBlockState state, @Nonnull ItemStack stack, boolean allFacesToGeneral) {
if (state != null) {
if (Prep.isInvalid(stack)) {
stack = new ItemStack(state.getBlock(), 1, state.getBlock().damageDropped(state));
}
BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
IBakedModel model = modelShapes.getModelForState(state);
addBakedModel(model, stack, allFacesToGeneral);
}
}
use of net.minecraft.client.renderer.BlockModelShapes in project EnderIO by SleepyTrousers.
the class SoulBinderTESR method renderBlockModel.
@SuppressWarnings("null")
public static void renderBlockModel(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, boolean translateToOrigin, boolean relight) {
BufferBuilder 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();
}
use of net.minecraft.client.renderer.BlockModelShapes in project EnderIO by SleepyTrousers.
the class EnchanterModelRenderer method renderBase.
private void renderBase() {
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockModelShapes modelShapes = blockrendererdispatcher.getBlockModelShapes();
IBakedModel bakedModel = modelShapes.getModelForState(MachineObject.block_enchanter.getBlockNN().getDefaultState().withProperty(EnumRenderMode.RENDER, EnumRenderMode.FRONT));
RenderUtil.bindBlockTexture();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.enableRescaleNormal();
GlStateManager.pushMatrix();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder vertexbuffer = tessellator.getBuffer();
vertexbuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
for (EnumFacing enumfacing : EnumFacing.values()) {
this.renderQuads(vertexbuffer, bakedModel.getQuads((IBlockState) null, enumfacing, 0L));
}
this.renderQuads(vertexbuffer, bakedModel.getQuads((IBlockState) null, (EnumFacing) null, 0L));
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
}
use of net.minecraft.client.renderer.BlockModelShapes in project HorsePower by GoryMoon.
the class ColorGetter method getTextureAtlasSprite.
@Nullable
private static TextureAtlasSprite getTextureAtlasSprite(IBlockState blockState) {
Minecraft minecraft = Minecraft.getMinecraft();
BlockRendererDispatcher blockRendererDispatcher = minecraft.getBlockRendererDispatcher();
BlockModelShapes blockModelShapes = blockRendererDispatcher.getBlockModelShapes();
TextureAtlasSprite textureAtlasSprite = blockModelShapes.getTexture(blockState);
if (textureAtlasSprite == minecraft.getTextureMapBlocks().getMissingSprite()) {
return null;
}
return textureAtlasSprite;
}
use of net.minecraft.client.renderer.BlockModelShapes in project EnderIO by SleepyTrousers.
the class ItemQuadCollector method addBlockStates.
public void addBlockStates(List<Pair<IBlockState, ItemStack>> states, @Nonnull ItemStack parent, Block parentBlock) {
if (states == null || states.isEmpty()) {
return;
}
BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
for (Pair<IBlockState, ItemStack> pair : states) {
IBlockState state = pair.getLeft();
if (state != null) {
ItemStack stack = pair.getRight();
if (stack == null || Prep.isInvalid(stack)) {
if (state.getBlock() == parentBlock) {
stack = parent;
} else {
stack = new ItemStack(state.getBlock(), 1, state.getBlock().damageDropped(state));
}
}
IBakedModel model = modelShapes.getModelForState(state);
addBakedModel(model, NullHelper.notnullJ(stack, "If you see this, the world will be ending yesterday half past yellow!"));
}
}
}
Aggregations