net.minecraft.client.renderer.RenderType Java Examples
The following examples show how to use
net.minecraft.client.renderer.RenderType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RenderCustomEndPortal.java From EnderStorage with MIT License | 6 votes |
public void render(Matrix4 mat, IRenderTypeBuffer getter, double yToCamera) { Vec3d projectedView = TileEntityRendererDispatcher.instance.renderInfo.getProjectedView(); mat = mat.copy();//Defensive copy, prevent external modifications. randy.setSeed(31100L); for (int i = 0; i < 16; i++) { RenderType.State state = RENDER_STATES.get(i); EndPortalRenderType renderType = new EndPortalRenderType(i, yToCamera, projectedView, mat, state); IVertexBuilder builder = getter.getBuffer(renderType); float r = (randy.nextFloat() * 0.5F + 0.1F) * renderType.f7; float g = (randy.nextFloat() * 0.5F + 0.4F) * renderType.f7; float b = (randy.nextFloat() * 0.5F + 0.5F) * renderType.f7; if (i == 0) { r = g = b = 1.0F * renderType.f7; } builder.pos(surfaceX1, surfaceY, surfaceZ1).color(r, g, b, 1.0F).endVertex(); builder.pos(surfaceX1, surfaceY, surfaceZ2).color(r, g, b, 1.0F).endVertex(); builder.pos(surfaceX2, surfaceY, surfaceZ2).color(r, g, b, 1.0F).endVertex(); builder.pos(surfaceX2, surfaceY, surfaceZ1).color(r, g, b, 1.0F).endVertex(); } }
Example #2
Source File: RenderUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 6 votes |
public static void renderFluidCuboid(CCRenderState ccrs, Matrix4 mat, RenderType renderType, IRenderTypeBuffer getter, FluidStack stack, Cuboid6 bound, double capacity, double res) { if (stack.isEmpty()) { return; } int alpha = 255; FluidAttributes attributes = stack.getFluid().getAttributes(); if (attributes.isGaseous(stack)) { alpha = (int) (Math.pow(capacity, 0.4) * 255); } else { bound.max.y = bound.min.y + (bound.max.y - bound.min.y) * capacity; } Material material = ForgeHooksClient.getBlockMaterial(attributes.getStillTexture(stack)); ccrs.bind(renderType, getter); ccrs.baseColour = attributes.getColor(stack) << 8 | alpha; makeFluidModel(bound, material.getSprite(), res).render(ccrs, mat); }
Example #3
Source File: RenderCustomEndPortal.java From EnderStorage with MIT License | 5 votes |
public EndPortalRenderType(int idx, double posY, Vec3d projectedView, Matrix4 mat, RenderType.State state) { super("enderstorage:end_portal", DefaultVertexFormats.POSITION_COLOR, GL11.GL_QUADS, 256, false, true, null, null); this.idx = idx; this.projectedView = projectedView; this.mat = mat; this.state = state; f5 = idx == 0 ? 65F : 16 - idx; f6 = idx == 0 ? 0.125F : (idx == 1 ? 0.5F : 0.0625F); f7 = idx == 0 ? 0.1F : 1.0F / (16 - idx + 1.0F); f8 = (float) (-(posY + surfaceY)); f9 = (float) (f8 + projectedView.y); f10 = (float) (f8 + f5 + projectedView.y); f11 = (float) (posY + surfaceY) + (f9 / f10); }
Example #4
Source File: AbstractPerspectiveLayeredModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override protected List<BakedQuad> getAllQuads(BlockState state, IModelData data) { List<BakedQuad> allQuads = new ArrayList<>(); for (RenderType layer : RenderType.getBlockRenderTypes()) { allQuads.addAll(getLayerQuads(state, null, layer, new Random(0), data)); for (Direction face : Direction.BY_INDEX) { allQuads.addAll(getLayerQuads(state, face, layer, new Random(0), data)); } } return allQuads; }
Example #5
Source File: CCModelLibrary.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public static RenderType.State makeIcosState(ResourceLocation texture, boolean lighting) { return RenderType.State.getBuilder()// .texture(new RenderState.TextureState(texture, false, false))// .texturing(new RenderState.TexturingState("icosahedron", () -> { if (!lighting) { RenderSystem.disableLighting(); } }, () -> { }))// .transparency(NO_TRANSPARENCY)// .diffuseLighting(DIFFUSE_LIGHTING_ENABLED)// .lightmap(LIGHTMAP_ENABLED)// .build(false); }
Example #6
Source File: AbstractPerspectiveLayeredModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public List<BakedQuad> getQuads(BlockState state, Direction side, Random rand, IModelData data) { RenderType layer = MinecraftForgeClient.getRenderLayer(); if (layer == null) { layer = generalLayer; } return getLayerQuads(state, side, layer, rand, data); }
Example #7
Source File: RenderUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public static RenderType getFluidRenderType() { return RenderType.makeType("ccl:fluid_render", DefaultVertexFormats.POSITION_COLOR_TEX, GL11.GL_QUADS, 256, RenderType.State.getBuilder()// .texture(RenderType.BLOCK_SHEET)// .transparency(RenderType.TRANSLUCENT_TRANSPARENCY)// .texturing(new RenderState.TexturingState("disable_lighting", RenderSystem::disableLighting, SneakyUtils::none))// .build(false)// ); }
Example #8
Source File: PerspectiveAwareLayeredModelWrapper.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public List<BakedQuad> getLayerQuads(BlockState state, Direction side, RenderType layer, Random rand, IModelData data) { if (layerModelMap.containsKey(layer)) { return layerModelMap.get(layer).getQuads(state, side, rand); } return Collections.emptyList(); }
Example #9
Source File: PerspectiveAwareLayeredModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
@Override public List<BakedQuad> getLayerQuads(BlockState state, Direction side, RenderType layer, Random rand, IModelData data) { if (side == null) { if (layerGeneralQuads.containsKey(layer)) { return layerGeneralQuads.get(layer); } } else if (layerFaceQuadMap.containsKey(layer)) { Map<Direction, List<BakedQuad>> faceQuadMap = layerFaceQuadMap.get(layer); if (faceQuadMap.containsKey(side)) { return faceQuadMap.get(side); } } return Collections.emptyList(); }
Example #10
Source File: DryingRackBakedModel.java From Survivalist with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Nonnull @Override public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) { List<BakedQuad> quads = Lists.newArrayList(); RenderType renderLayer = MinecraftForgeClient.getRenderLayer(); if (renderLayer == RenderType.getSolid()) { quads.addAll(rackBakedModel.getQuads(state, side, rand)); } else if (renderLayer == RenderType.getCutout() && side == null) { ItemRenderer renderItem = Minecraft.getInstance().getItemRenderer(); World world = Minecraft.getInstance().world; DryingRackItemsStateData items = extraData.getData(DryingRackTileEntity.CONTAINED_ITEMS_DATA); for (int i = 0; i < 4; i++) { ItemStack stack = items.stacks[i]; if (stack.isEmpty()) continue; MatrixStack matrixStack = new MatrixStack(); matrixStack.push(); // pushMatrix TransformationMatrix ct = itemTransforms[i]; matrixStack.getLast().getMatrix().mul(ct.getMatrix()); // current().getPositionMatrix().multiply(getPositionMatrix) matrixStack.getLast().getNormal().mul(ct.getNormalMatrix()); // current().getNormalMatrix().multiply IBakedModel model = renderItem.getItemModelWithOverrides(stack, world, null); if (stack.getItem() == Items.TRIDENT) { model = Minecraft.getInstance().getItemRenderer().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation("minecraft:trident#inventory")); } model = model.handlePerspective(ItemCameraTransforms.TransformType.FIXED, matrixStack); if (!model.isBuiltInRenderer()) { @SuppressWarnings("unchecked") Map<Pair<IBakedModel, TransformationMatrix>, List<BakedQuad>> cache = caches.get(i); Matrix4f positionTransform = matrixStack.getLast().getMatrix(); // current() // getPositionMatrix TransformationMatrix transformMatrix = new TransformationMatrix(positionTransform); Pair<IBakedModel, TransformationMatrix> pair = Pair.of(model, transformMatrix); List<BakedQuad> cachedQuads = cache.get(pair); if (cachedQuads == null) { cachedQuads = Lists.newArrayList(); for (Direction face : faces) { List<BakedQuad> inQuads = model.getQuads(null, face, rand); List<BakedQuad> outQuads = new QuadTransformer(transformMatrix).processMany(inQuads); cachedQuads.addAll(outQuads); } cache.put(pair, cachedQuads); } quads.addAll(cachedQuads); } } } return quads; }
Example #11
Source File: AbstractPerspectiveLayeredModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public AbstractPerspectiveLayeredModel(ModelProperties properties, RenderType generalLayer) { super(properties); this.generalLayer = generalLayer; }
Example #12
Source File: AbstractPerspectiveLayeredModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public AbstractPerspectiveLayeredModel(ModelProperties properties) { this(properties, RenderType.getSolid()); }
Example #13
Source File: PerspectiveAwareLayeredModelWrapper.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public PerspectiveAwareLayeredModelWrapper(Map<RenderType, IBakedModel> layerModelMap, PerspectiveProperties properties) { super(properties); this.layerModelMap = ImmutableMap.copyOf(layerModelMap); }
Example #14
Source File: PerspectiveAwareLayeredModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public PerspectiveAwareLayeredModel(Map<RenderType, Map<Direction, List<BakedQuad>>> layerFaceQuadMap, Map<RenderType, List<BakedQuad>> layerGeneralQuads, PerspectiveProperties properties, RenderType generallayer) { super(properties, generallayer); this.layerFaceQuadMap = ImmutableMap.copyOf(layerFaceQuadMap); this.layerGeneralQuads = ImmutableMap.copyOf(layerGeneralQuads); }
Example #15
Source File: PerspectiveAwareLayeredModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public PerspectiveAwareLayeredModel(Map<RenderType, Map<Direction, List<BakedQuad>>> layerFaceQuadMap, PerspectiveProperties properties) { this(layerFaceQuadMap, ImmutableMap.of(), properties, RenderType.getSolid()); }
Example #16
Source File: DelegateRenderType.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public DelegateRenderType(RenderType parent, VertexFormat format) { super(parent.name, format, parent.getDrawMode(), parent.getBufferSize(), parent.isUseDelegate(), parent.needsSorting, null, null); this.parent = parent; }
Example #17
Source File: DelegateRenderType.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public DelegateRenderType(RenderType parent) { this(parent, parent.getVertexFormat()); }
Example #18
Source File: RenderUtils.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public static void bufferHitBox(Matrix4 mat, IRenderTypeBuffer getter, Cuboid6 cuboid) { IVertexBuilder builder = new TransformingVertexBuilder(getter.getBuffer(RenderType.getLines()), mat); bufferCuboidOutline(builder, cuboid.copy().expand(0.0020000000949949026D), 0.0F, 0.0F, 0.0F, 0.4F); }
Example #19
Source File: ShaderRenderType.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public ShaderRenderType(RenderType parent, ShaderProgram program, UniformCache uniforms) { super(parent.name, parent.getVertexFormat(), parent.getDrawMode(), parent.getBufferSize(), parent.isUseDelegate(), parent.needsSorting, null, null); this.parent = parent; this.program = program; this.uniforms = uniforms; }
Example #20
Source File: CCModelLibrary.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public static RenderType getIcos7RenderType(ResourceLocation texture, boolean lighting) { return RenderType.makeType("icosahedron7", DefaultVertexFormats.BLOCK, GL11.GL_QUADS, 256, makeIcosState(texture, lighting)); }
Example #21
Source File: CCModelLibrary.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 4 votes |
public static RenderType getIcos4RenderType(ResourceLocation texture, boolean lighting) { return RenderType.makeType("icosahedron4", DefaultVertexFormats.BLOCK, GL11.GL_TRIANGLES, 256, makeIcosState(texture, lighting)); }
Example #22
Source File: ILayeredBlockBakery.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 2 votes |
/** * Used to actually generate quads for your block based on the face and layer being requested. * Use {@link Block#canRenderInLayer(IBlockState, BlockRenderLayer)} to cull layers from this. * You will ONLY be requested for quads if canRenderInLayer returns true for the specific layer. * <p> * Face may be null!! * Treat a null face as "general" quads, Quads that will NOT be culled by neighboring blocks. * <p> * Each layer you agree to with canRenderInLayer will be requested for "general" AND face quads. * * @param face The face quads are requested for. * @param layer The layer quads are requested for. * @param state The IExtendedBlockState of your block. {@link IBlockBakery#handleState(IExtendedBlockState, IBlockAccess, BlockPos)} has already been called. * @return The quads for the layer, May be an empty list. Never null. */ @Nonnull @OnlyIn (Dist.CLIENT) List<BakedQuad> bakeLayerFace(@Nullable Direction face, RenderType layer, BlockState state, IModelData data);
Example #23
Source File: VBORenderType.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 2 votes |
/** * Create a new VBORenderType, delegates render state setup * to the provided parent, Uses the specified VertexFormat. * * @param parent The parent, for state setup. * @param bufferFormat The VertexFormat to use. * @param factory The Factory used to fill the BufferBuilder with data. */ public VBORenderType(RenderType parent, VertexFormat bufferFormat, BiConsumer<VertexFormat, BufferBuilder> factory) { super(parent, bufferFormat); this.factory = factory; }
Example #24
Source File: VBORenderType.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 2 votes |
/** * Create a new VBORenderType, delegates render state setup * to the provided parent, also uses the parents VertexFormat. * * @param parent The parent, for state setup and buffer VertexFormat. * @param factory The Factory used to fill the BufferBuilder with data. */ public VBORenderType(RenderType parent, BiConsumer<VertexFormat, BufferBuilder> factory) { this(parent, parent.getVertexFormat(), factory); }
Example #25
Source File: AbstractPerspectiveLayeredModel.java From CodeChickenLib with GNU Lesser General Public License v2.1 | votes |
public abstract List<BakedQuad> getLayerQuads(BlockState state, Direction side, RenderType layer, Random rand, IModelData data);