All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.parzivail.p3d.P3dUnbakedBlockModel Maven / Gradle / Ivy

There is a newer version: 0.0.114+1.20.2
Show newest version
package com.parzivail.p3d;

import com.mojang.datafixers.util.Pair;
import com.parzivail.util.client.model.BaseUnbakedBlockModel;
import com.parzivail.util.client.model.ClonableUnbakedModel;
import java.util.Collection;
import java.util.HashMap;
import java.util.Set;
import java.util.function.Function;
import net.minecraft.class_1100;
import net.minecraft.class_1723;
import net.minecraft.class_2960;
import net.minecraft.class_4730;

public class P3dUnbakedBlockModel extends BaseUnbakedBlockModel
{
	private final HashMap additionalTextures = new HashMap<>();

	public P3dUnbakedBlockModel(class_2960 baseTexture, class_2960 particleTexture, BakerFunction, P3dBakedBlockModel> baker)
	{
		super(baseTexture, particleTexture, baker);
	}

	public P3dUnbakedBlockModel withTexture(String id, class_2960 texture)
	{
		this.additionalTextures.put(id, texture);
		return this;
	}

	public P3dUnbakedBlockModel withTextures(HashMap textures)
	{
		this.additionalTextures.putAll(textures);
		return this;
	}

	@Override
	public Collection getTextureDependencies(Function function, Set> errors)
	{
		var ids = super.getTextureDependencies(function, errors);

		for (var texture : additionalTextures.values())
			ids.add(new class_4730(class_1723.field_21668, texture));

		return ids;
	}

	@Override
	public ClonableUnbakedModel copy()
	{
		return new P3dUnbakedBlockModel(baseTexture, particleTexture, baker)
				.withTextures(additionalTextures);
	}

	public HashMap getAdditionalTextures()
	{
		return additionalTextures;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy