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

com.magistuarmory.client.render.ModRender Maven / Gradle / Ivy

package com.magistuarmory.client.render;

import com.magistuarmory.EpicKnights;
import com.magistuarmory.api.item.ModItemsProvider;
import com.magistuarmory.block.ModBlockEntityTypes;
import com.magistuarmory.client.render.tileentity.HeraldryItemStackRenderer;
import com.magistuarmory.client.render.tileentity.PaviseBlockRenderer;
import com.magistuarmory.item.IHasModelProperty;
import com.magistuarmory.item.MedievalShieldItem;
import com.magistuarmory.item.ModItems;
import com.magistuarmory.item.armor.MedievalArmorItem;
import dev.architectury.injectables.annotations.ExpectPlatform;
import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry;
import dev.architectury.registry.client.rendering.ColorHandlerRegistry;
import dev.architectury.registry.registries.RegistrySupplier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.geom.EntityModelSet;
import net.minecraft.client.renderer.Sheets;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.DyeableLeatherItem;
import net.minecraft.world.item.Item;

import java.util.function.Consumer;
import java.util.function.Supplier;


@Environment(EnvType.CLIENT)
public class ModRender
{	
	public static void setup(ModItemsProvider content)
	{
		for (RegistrySupplier supplier : content.dyeableItems)
			ColorHandlerRegistry.registerItemColors((stack, i) -> i > 0 ? -1 : ((DyeableLeatherItem) stack.m_41720_()).m_41121_(stack), supplier.get());

		for (RegistrySupplier supplier : content.items)
			if (supplier.get() instanceof IHasModelProperty havingproperty)
				havingproperty.registerModelProperty();

		setupPlatform(content);
	}

	public static void stitch(TextureAtlas atlas, Consumer adder)
	{
		ModItems.HEATER_SHIELDS.stitch(atlas, adder);
		ModItems.RONDACHES.stitchWithoutPatterns(atlas, adder);
		ModItems.TARTSCHES.stitch(atlas, adder);
		ModItems.ELLIPTICAL_SHIELDS.stitch(atlas, adder);
		ModItems.ROUND_SHIELDS.stitch(atlas, adder);
		ModItems.PAVISES.stitch(atlas, adder);
		ModItems.KITE_SHIELDS.stitch(atlas, adder);
		ModItems.BUCKLERS.stitchWithoutPatterns(atlas, adder);
		ModItems.TARGETS.stitchWithoutPatterns(atlas, adder);
		if (atlas.m_118330_() == Sheets.f_110738_)
			adder.accept(new ResourceLocation(EpicKnights.ID, "entity/corruptedroundshield_nopattern"));
	}

	@ExpectPlatform
	public static void setupPlatform(ModItemsProvider content)
	{
		throw new AssertionError();
	}

	@ExpectPlatform
	public static void registerModelsLoadListener(ModItemsProvider content)
	{
		throw new AssertionError();
	}
	
	public static void registerRenderers()
	{
		BlockEntityRendererRegistry.register(ModBlockEntityTypes.PAVISE.get(), PaviseBlockRenderer::new);
	}

	public static void loadModels(ModItemsProvider content, EntityModelSet context)
	{
		for (Supplier supplier : content.shieldItems)
			supplier.get().loadModel(context);
		
		for (Supplier supplier : content.armorItems)
			supplier.get().loadModel(context);
	}

	@ExpectPlatform
	public static HeraldryItemStackRenderer createHeraldryItemStackRenderer(String id, ResourceLocation location)
	{
		throw new AssertionError();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy