net.minecraft.client.renderer.block.model.BakedQuad Java Examples

The following examples show how to use net.minecraft.client.renderer.block.model.BakedQuad. 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: GTModelTestTube.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public IBakedModel bake(IModelState state, VertexFormat format,
		Function<ResourceLocation, TextureAtlasSprite> getter) {
	if (BAKED_BASE == null)
		BAKED_BASE = GTModelUtils.load(GTMod.MODID, "test_tube_model").bake(state, format, getter);
	if (BAKED_OVERLAY == null)
		BAKED_OVERLAY = GTModelUtils.load(GTMod.MODID, "test_tube_overlay_model").bake(state, format, getter);
	ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
	if (fluid != null) {
		TextureAtlasSprite sprite = getter.apply(fluid.getStill());
		if (sprite != null) {
			List<BakedQuad> quads = BAKED_OVERLAY.getQuads(null, null, 0);
			quads = GTModelUtils.texAndTint(quads, fluid.getColor(), sprite);
			builder.addAll(quads);
		}
	}
	builder.addAll(BAKED_BASE.getQuads(null, null, 0));
	return new GTBakedTestTube(builder.build(), this, getter.apply(BASE), format);
}
 
Example #2
Source File: FWSmartBlockModel.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
@SuppressWarnings("deprecation")
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
	final Block block;
	if (state != null) {
		FWBlock fwBlock = (FWBlock) state.getBlock();
		block = fwBlock.getBlockInstance(fwBlock.lastExtendedWorld, VectorConverter.instance().toNova(fwBlock.lastExtendedStatePos));
	} else {
		block = this.block;
	}

	BWModel model = new BWModel();
	model.matrix.translate(0.5, 0.5, 0.5);

	if (item.isPresent()) {
		if (item.get().components.has(Renderer.class)) {
			item.get().components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model));
		} else {
			block.components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model));
		}
	} else {
		block.components.getOp(StaticRenderer.class).ifPresent(r -> r.onRender.accept(model));
	}

	return modelToQuads(model, item.map(Item::colorMultiplier));
}
 
Example #3
Source File: BakedModelCamouflageBlock.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static ImmutableList<BakedQuad> buildItemModel(IBakedModel bakedBaseModel, @Nullable IBakedModel bakedOverlayModel)
{
    ImmutableList.Builder<BakedQuad> quads = ImmutableList.builder();

    for (EnumFacing side : EnumFacing.values())
    {
        quads.addAll(bakedBaseModel.getQuads(null, side, 0));

        if (bakedOverlayModel != null)
        {
            quads.addAll(bakedOverlayModel.getQuads(null, side, 0));
        }
    }

    quads.addAll(bakedBaseModel.getQuads(null, null, 0));

    if (bakedOverlayModel != null)
    {
        quads.addAll(bakedOverlayModel.getQuads(null, null, 0));
    }

    return quads.build();
}
 
Example #4
Source File: BakedModelBarrel.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
private List<BakedQuad> getQuadsForCamoModelSide(EnumFacing side, IBlockState state, IBakedModel bakedModel, long rand)
{
    EnumFacing relativeSide = PositionUtils.getRelativeFacing(state.getValue(BlockBarrel.FACING_H), side);

    switch (relativeSide)
    {
        case DOWN:
            return state.getValue(BlockBarrel.LABEL_DOWN)  ? bakedModel.getQuads(state, side, rand) : EMPTY_QUADS;
        case UP:
            return state.getValue(BlockBarrel.LABEL_UP)    ? bakedModel.getQuads(state, side, rand) : EMPTY_QUADS;
        case NORTH:
            return state.getValue(BlockBarrel.LABEL_FRONT) ? bakedModel.getQuads(state, side, rand) : EMPTY_QUADS;
        case SOUTH:
            return state.getValue(BlockBarrel.LABEL_BACK)  ? bakedModel.getQuads(state, side, rand) : EMPTY_QUADS;
        case WEST:
            return state.getValue(BlockBarrel.LABEL_RIGHT) ? bakedModel.getQuads(state, side, rand) : EMPTY_QUADS;
        case EAST:
            return state.getValue(BlockBarrel.LABEL_LEFT)  ? bakedModel.getQuads(state, side, rand) : EMPTY_QUADS;
        default:
    }

    return EMPTY_QUADS;
}
 
Example #5
Source File: ModelNullifierBaked.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void addQuadsForSide(EnumFacing side, ModelNullifierBaked nullifierModel, IBakedModel itemModel, IBakedModel textModel, boolean locked)
{
    ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();

    builder.addAll(nullifierModel.modelBase.getQuads(null, side, 0));

    if (locked)
    {
        builder.addAll(nullifierModel.modelLocked.getQuads(null, side, 0));
    }

    if (itemModel != null)
    {
        builder.addAll(itemModel.getQuads(null, side, 0));
    }

    this.quads.put(side, builder.build());
}
 
Example #6
Source File: RenderUtils.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Reimplement vanilla item so we can draw pearl stacks with opacity support.
 * + FIX THE OPACITY RENDERING.
 */
private static void renderQuads(BufferBuilder renderer, List<BakedQuad> quads, int color, ItemStack stack) {
	color &= 0xFF000000;
	boolean flag = !stack.isEmpty();
	int i = 0;

	for (int j = quads.size(); i < j; ++i) {
		BakedQuad bakedquad = quads.get(i);
		int k = color | 0xFFFFFF;

		if (flag && bakedquad.hasTintIndex()) {
			k = Minecraft.getMinecraft().getItemColors().colorMultiplier(stack, bakedquad.getTintIndex());

			if (EntityRenderer.anaglyphEnable) {
				k = TextureUtil.anaglyphColor(k);
			}

			k &= 0xFFFFFF;
			k |= color;
		}

		LightUtil.renderQuadColor(renderer, bakedquad, k);
	}
}
 
Example #7
Source File: FWSmartBlockModel.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public List<BakedQuad> getGeneralQuads() {
	BWModel model = new BWModel();
	model.matrix.translate(0.5, 0.5, 0.5);

	if (item.isPresent()) {
		if (item.get().components.has(Renderer.class)) {
			item.get().components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model));
		} else {
			block.components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model));
		}
	} else {
		block.components.get(StaticRenderer.class).onRender.accept(model);
	}

	return modelToQuads(model);
}
 
Example #8
Source File: MultiLayerModel.java    From OpenModsLib with MIT License 6 votes vote down vote up
public MultiLayerBakedModel(Map<BlockRenderLayer, IBakedModel> models, IBakedModel base, IBakedModel missing, ImmutableMap<TransformType, TRSRTransformation> cameraTransforms) {
	super(base, cameraTransforms);
	this.models = ImmutableMap.copyOf(models);
	this.missing = missing;

	final List<BakedQuad> quads = Lists.newArrayList();

	for (BlockRenderLayer layer : BlockRenderLayer.values()) {
		final IBakedModel model = models.get(layer);
		if (model != null) {
			buildQuadsForLayer(quads, model);
		}
	}

	this.quads = ImmutableList.copyOf(quads);
}
 
Example #9
Source File: GTModelWire.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
private List<BakedQuad> generateQuadsForSide(GTBlockBaseConnect wire, EnumFacing facing, int min, int max) {
	List<BakedQuad> quads = new ArrayList();
	Pair<Vector3f, Vector3f> position = this.getPosForSide(facing, min, max);
	EnumFacing[] var7 = EnumFacing.VALUES;
	int var8 = var7.length;
	for (int var9 = 0; var9 < var8; ++var9) {
		EnumFacing side = var7[var9];
		if (side.getOpposite() != facing) {
			BlockPartFace face = null;
			if (side == facing) {
				face = new BlockPartFace((EnumFacing) null, 0, "", new BlockFaceUV(new float[] { (float) min,
						(float) min, (float) max, (float) max }, 0));
			} else if (facing.getAxis() == Axis.Z && side.getAxis() == Axis.X) {
				face = new BlockPartFace((EnumFacing) null, 0, "", new BlockFaceUV(new float[] { (float) max,
						(float) min, 16.0F, (float) max }, 0));
			} else {
				face = this.getFace(facing, min, max);
			}
			// If you would like a different texture for connected sides, change the sprite
			// var to what you want
			quads.add(this.getBakery().makeBakedQuad((Vector3f) position.getKey(), (Vector3f) position.getValue(), face, wire.getTextureFromState(this.state, side), side, ModelRotation.X0_Y0, (BlockPartRotation) null, true, true));
		}
	}
	return quads;
}
 
Example #10
Source File: RenderCrop.java    From AgriCraft with MIT License 6 votes vote down vote up
private void renderBaseQuads(ITessellator tessellator, EnumFacing side, TextureAtlasSprite sprite) {
    int index = side == null ? EnumFacing.values().length : side.ordinal();
    boolean createQuads = false;
    if (!cropQuads.containsKey(tessellator.getVertexFormat())) {
        List<BakedQuad>[] lists = new List[EnumFacing.values().length + 1];
        cropQuads.put(tessellator.getVertexFormat(), lists);
        createQuads = true;
    } else if (cropQuads.get(tessellator.getVertexFormat())[index] == null) {
        createQuads = true;
    }
    if (createQuads) {
        tessellator.translate(0, -3 * Constants.UNIT, 0);
        tessellator.drawScaledPrism(2, 0, 2, 3, 16, 3, sprite);
        tessellator.drawScaledPrism(13, 0, 2, 14, 16, 3, sprite);
        tessellator.drawScaledPrism(13, 0, 13, 14, 16, 14, sprite);
        tessellator.drawScaledPrism(2, 0, 13, 3, 16, 14, sprite);
        tessellator.translate(0, 3 * Constants.UNIT, 0);
    } else {
        tessellator.addQuads(cropQuads.get(tessellator.getVertexFormat())[index]);
    }
}
 
Example #11
Source File: RenderUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void renderModelQuadOutlines(BlockPos pos, BufferBuilder buffer, Color4f color, List<BakedQuad> quads)
{
    final int size = quads.size();

    for (int i = 0; i < size; i++)
    {
        renderQuadOutlinesBatched(pos, buffer, color, quads.get(i).getVertexData());
    }
}
 
Example #12
Source File: BakedModelBarrel.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> getQuadsForState(
        IBakedModel bakedModel, IExtendedBlockState extendedState, long rand, boolean validCamo)
{
    ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> mapBuilder = ImmutableMap.builder();

    for (EnumFacing side : EnumFacing.values())
    {
        ImmutableList.Builder<BakedQuad> quads = ImmutableList.builder();

        // Camo model, only add the quads if there is a label on this side
        if (validCamo)
        {
            quads.addAll(this.getQuadsForCamoModelSide(side, extendedState, bakedModel, rand));
        }
        // Not a camo model, always return the quads of the normal model
        else
        {
            quads.addAll(bakedModel.getQuads(extendedState, side, rand));
        }

        mapBuilder.put(Optional.ofNullable(side), quads.build());
    }

    mapBuilder.put(Optional.ofNullable(null), ImmutableList.copyOf(bakedModel.getQuads(extendedState, null, rand)));

    return mapBuilder.build();
}
 
Example #13
Source File: VariantModel.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
	final VariantModelState modelState = getModelSelectors(state);

	final List<BakedQuad> result = Lists.newArrayList(base.getQuads(state, side, rand));

	for (ResourceLocation subModel : modelData.getModels(modelState.getSelectors())) {
		final IBakedModel bakedSubModel = bakedSubModels.get(subModel);
		result.addAll(bakedSubModel.getQuads(state, side, rand));
	}

	return result;
}
 
Example #14
Source File: GTBakedTestTube.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public GTBakedTestTube(List<BakedQuad> quads, GTModelTestTube parent, TextureAtlasSprite particle,
		VertexFormat format) {
	this.quads = quads;
	this.parent = parent;
	this.particle = particle;
	this.format = format;
}
 
Example #15
Source File: GTBakedQuadTinted.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public GTBakedQuadTinted(BakedQuad quad, int rgb) {
	super(quad.getVertexData(), quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat());
	this.vertexData = quad.getVertexData();
	for (int i = 0; i < 4; i++) {
		vertexData[(format.getColorOffset() / 4) + format.getIntegerSize() * i] = GTModelUtils.rgbToABGR(rgb);
	}
}
 
Example #16
Source File: GTModelUtils.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static List<BakedQuad> texAndTint(List<BakedQuad> quads, int rgb, TextureAtlasSprite sprite) {
	List<BakedQuad> quadsTemp = new LinkedList<>();
	int size = quads.size();
	for (int i = 0; i < size; i++) {
		BakedQuad quad = new BakedQuadRetextured(quads.get(i), sprite);
		quadsTemp.add(new GTBakedQuadTinted(quad, rgb));
	}
	return quadsTemp;
}
 
Example #17
Source File: ModelEnderTools.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public BakedEnderTool(ModelEnderTools parent, ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, VertexFormat format,
        ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms, Map<String, IBakedModel> cache)
{
    this.quads = quads;
    this.particle = particle;
    this.format = format;
    this.parent = parent;
    this.transforms = transforms;
    this.cache = cache;
}
 
Example #18
Source File: BakedEvalModel.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {

	if (state instanceof IExtendedBlockState) {
		final IExtendedBlockState extState = (IExtendedBlockState)state;

		final EvalModelState args = extState.getValue(EvalModelState.PROPERTY);
		if (args != null) { return (args.isShortLived()? shortTermCache : longTermCache).getUnchecked(args.getArgs()).getQuads(state, side, rand); }
	}

	return super.getQuads(state, side, rand);
}
 
Example #19
Source File: MultiLayerModel.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Nonnull
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
	final BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer();
	if (layer == null) { return side == null? quads : ImmutableList.<BakedQuad> of(); }

	final IBakedModel model = models.get(layer);
	return MoreObjects.firstNonNull(model, missing).getQuads(state, side, rand);
}
 
Example #20
Source File: FWSmartItemModel.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@SuppressWarnings("deprecation")
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
	BWModel model = new BWModel();
	model.matrix.translate(0.5, 0.5, 0.5);
	item.components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model));
	return modelToQuads(model, item.colorMultiplier());
}
 
Example #21
Source File: RenderUtils.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Reimplement vanilla item so we can draw pearl stacks with opacity support.
 */
private static void drawSegment(int baseColor, ItemStack stack, List<BakedQuad> segment, int bl, int sl, int tintColor, boolean updateLighting, boolean updateColor) {
	BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();
	bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);

	float lastBl = OpenGlHelper.lastBrightnessX;
	float lastSl = OpenGlHelper.lastBrightnessY;

	if (updateLighting || updateColor) {
		float emissive = Math.max(bl, sl) / 240f;

		float r = (tintColor >>> 16 & 0xff) / 255f;
		float g = (tintColor >>> 8 & 0xff) / 255f;
		float b = (tintColor & 0xff) / 255f;

		GL11.glMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_EMISSION, RenderHelper.setColorBuffer(emissive * r, emissive * g, emissive * b, 1));

		if (updateLighting) {
			OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, Math.max(bl, lastBl), Math.max(sl, lastSl));
		}
	}

	renderQuads(bufferbuilder, segment, baseColor, stack);
	Tessellator.getInstance().draw();

	// Preserve this as it represents the "world" lighting
	OpenGlHelper.lastBrightnessX = lastBl;
	OpenGlHelper.lastBrightnessY = lastSl;

	segment.clear();
}
 
Example #22
Source File: FWSmartModel.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected List<BakedQuad> modelToQuads(Model modelIn, Optional<Color> colorMultiplier) {
	return modelIn
		.flatten()
		.stream()
		.flatMap(
			model -> {
				if (model instanceof MeshModel) {
					MeshModel meshModel = (MeshModel) model;
					return meshModel.faces
						.stream()
						.filter(f -> f.vertices.size() > 2)
						.map(
							face -> {
								TextureAtlasSprite texture = face.texture.map(RenderUtility.instance::getTexture)
									.orElseGet(Minecraft.getMinecraft().getTextureMapBlocks()::getMissingSprite);
								List<int[]> vertexData = face.vertices
									.stream()
									.map(v -> {
										colorMultiplier.ifPresent(c -> v.color = v.color.multiply(c));
										return v;
									})
									.map(v -> vertexToInts(v, texture, face.normal))
									.collect(Collectors.toList());

								if (vertexData.size() < 4)
									vertexData.add(vertexData.get(vertexData.size() - 1));

								int[] data = Ints.concat(vertexData.toArray(new int[][] {}));
								//TODO: The facing might be wrong
								return new BakedQuad(Arrays.copyOf(data, MathUtil.min(data.length, format.getNextOffset())), -1,
									DirectionConverter.instance().toNative(Direction.fromVector(face.normal)), texture, true, getFormat());
							}
						);
				}
				//TODO: Handle BW Rendering
				return Stream.empty();
			}
		)
		.collect(Collectors.toList());
}
 
Example #23
Source File: FWSmartItemModel.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public List<BakedQuad> getGeneralQuads() {
	BWModel model = new BWModel();
	model.matrix.translate(0.5, 0.5, 0.5);
	item.components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model));
	return modelToQuads(model);
}
 
Example #24
Source File: BakedModelBarrel.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
synchronized public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand)
{
    // Item model
    if (state == null)
    {
        return this.itemQuads;
    }

    IExtendedBlockState extendedState = (IExtendedBlockState) state;
    IBlockState actualState = extendedState.getClean();
    IBlockState camoState = extendedState.getValue(BlockEnderUtilitiesTileEntity.CAMOBLOCKSTATE);
    boolean validCamo = camoState != null && camoState.getBlock() != Blocks.AIR;

    Optional<IBlockState> key = Optional.of(actualState);
    Map<Optional<IBlockState>, ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>>> cache = validCamo ? QUAD_CACHE_CAMO : QUAD_CACHE_NORMAL;
    ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>> map = cache.get(key);

    if (map == null)
    {
        IBakedModel bakedModel = validCamo ? this.getBakedOverlayModel(actualState) : this.getBakedBaseModel(actualState);
        map = this.getQuadsForState(bakedModel, extendedState, rand, validCamo);
        cache.put(key, map);
    }

    return map.get(Optional.ofNullable(side));
}
 
Example #25
Source File: ModelCamouflageBlock.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onResourceManagerReload(IResourceManager resourceManager)
{
    for (Map.Entry<BlockRenderLayer, Map<ImmutablePair<IBlockState, IBlockState>, ImmutableMap<Optional<EnumFacing>, ImmutableList<BakedQuad>>>> entry : BakedModelCamouflageBlock.QUAD_CACHE.entrySet())
    {
        entry.getValue().clear();
    }
}
 
Example #26
Source File: ModelEnderBucket.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public BakedEnderBucket(ModelEnderBucket parent, ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, VertexFormat format,
        ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms, Map<String, IBakedModel> cache)
{
    this.quads = quads;
    this.particle = particle;
    this.format = format;
    this.parent = parent;
    this.transforms = transforms;
    this.cache = cache;
}
 
Example #27
Source File: BuildersWandRenderer.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void renderQuads(final IBlockState state, final BlockPos pos, final BufferBuilder buffer, final List<BakedQuad> quads, final int alpha)
{
    final int size = quads.size();

    for (int i = 0; i < size; i++)
    {
        final BakedQuad quad = quads.get(i);
        final int color = quad.getTintIndex() == -1 ? alpha | 0xffffff : this.getTint(state, pos, alpha, quad.getTintIndex());
        LightUtil.renderQuadColor(buffer, quad, color);
    }
}
 
Example #28
Source File: FWSmartModel.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected List<BakedQuad> modelToQuads(Model modelIn) {
	return modelIn
		.flatten()
		.stream()
		.flatMap(
			model -> {
				if (model instanceof MeshModel) {
					MeshModel meshModel = (MeshModel) model;
					return meshModel.faces
						.stream()
						.filter(f -> f.vertices.size() >= 3) // Only render faces with at least 3 vertices
						.map(
							face -> {
								TextureAtlasSprite texture = face.texture.map(RenderUtility.instance::getTexture)
									.orElseGet(Minecraft.getMinecraft().getTextureMapBlocks()::getMissingSprite);
								List<int[]> vertexData = face.vertices
									.stream()
									.map(v -> vertexToInts(v, texture, face.normal))
									.collect(Collectors.toList());

								if (vertexData.size() < 4)
									// Do what Minecraft Forge does when rendering Wavefront OBJ models with triangles
									vertexData.add(vertexData.get(vertexData.size() - 1));

								int[] data = Ints.concat(vertexData.toArray(new int[][] {}));
								//TODO: The facing might be wrong        // format.getNextOffset() is in byte count per vertex, and we are deling with ints, so we don't need to multiply by 4
								return new BakedQuad(Arrays.copyOf(data, MathUtil.min(data.length, format.getNextOffset())),
									-1, DirectionConverter.instance().toNative(Direction.fromVector(face.normal)));
							}
						);
				}
				//TODO: Handle BW Rendering
				return Stream.empty();
			}
		)
		.collect(Collectors.toList());
}
 
Example #29
Source File: JsonPlant.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public List<BakedQuad> getPlantQuads(IExtendedBlockState state, int growthStage, EnumFacing direction, Function<ResourceLocation, TextureAtlasSprite> textureToIcon) {
    //The quads returned from this method are added to the tessellator,
    // however the plant renderer directly adds them to the tessellator, so an empty list is returned
    if (textureToIcon instanceof ITessellator) {
        PlantRenderer.renderPlant((ITessellator) textureToIcon, this, growthStage);
    }
    return Collections.emptyList();
}
 
Example #30
Source File: BakedCompositeModel.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public BakedCompositeModel build(IBakedModel parent) {
	ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> map = ImmutableMap.builder();

	map.put(Optional.<EnumFacing>absent(), builders[6].build());
	for(EnumFacing side : EnumFacing.values()) {
		map.put(Optional.of(side), builders[side.getIndex()].build());
	}

	return new BakedCompositeModel(parent, map.build());
}