use of net.minecraft.client.renderer.RenderItem in project Skree by Skelril.
the class CustomItemSystem method render.
// Invoked via reflection
@SuppressWarnings("unused")
private void render(Object item) {
if (item instanceof Item && item instanceof ICustomItem) {
if (Sponge.getPlatform().getExecutionType().isClient()) {
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
ItemModelMesher mesher = renderItem.getItemModelMesher();
Optional<ItemMeshDefinition> optMeshDefinition = ((ICustomItem) item).__getCustomMeshDefinition();
if (optMeshDefinition.isPresent()) {
mesher.register((Item) item, optMeshDefinition.get());
}
List<String> variants = ((ICustomItem) item).__getMeshDefinitions();
List<ResourceLocation> modelResources = new ArrayList<>();
for (int i = 0; i < variants.size(); ++i) {
ModelResourceLocation resourceLocation = new ModelResourceLocation("skree:" + variants.get(i), "inventory");
if (!optMeshDefinition.isPresent()) {
mesher.register((Item) item, i, resourceLocation);
}
modelResources.add(resourceLocation);
}
ModelBakery.registerItemVariants((Item) item, modelResources.toArray(new ResourceLocation[modelResources.size()]));
}
} else {
throw new IllegalArgumentException("Invalid custom item!");
}
}
use of net.minecraft.client.renderer.RenderItem in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ClientProxyCombat method registerItemModel.
private void registerItemModel(Item toRegister) {
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
renderItem.getItemModelMesher().register(toRegister, 0, new ModelResourceLocation(ValkyrienWarfareCombatMod.MODID + ":" + toRegister.getUnlocalizedName().substring(5), "inventory"));
;
}
use of net.minecraft.client.renderer.RenderItem in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ClientProxyWorld method registerItemModel.
private void registerItemModel(Item toRegister) {
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
renderItem.getItemModelMesher().register(toRegister, 0, new ModelResourceLocation(ValkyrienWarfareWorldMod.MODID + ":" + toRegister.getUnlocalizedName().substring(5), "inventory"));
}
use of net.minecraft.client.renderer.RenderItem in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ClientProxyControl method registerItemModel.
private void registerItemModel(Item toRegister) {
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
renderItem.getItemModelMesher().register(toRegister, 0, new ModelResourceLocation(ValkyrienWarfareControlMod.MODID + ":" + toRegister.getUnlocalizedName().substring(5), "inventory"));
}
Aggregations