Jump to content

Recommended Posts

Posted

So, I'm following this book that's been helping me get the basics of Minecraft modding down. The problem is, sometimes I'll run into some outdated information, and I have no idea how to progress. Right now I'm having a problem with ModelBakery.addVariantName being deprecated, and I'm not really sure how the new parameters work (it's suggesting that I use ModelBakery.registerItemVariants instead, but I have no idea how that works), or even if this means that none of my code will work the way that the book teaches it. Can someone please look at my code and tell me how I can fix it efficiently? Just for extra clarity, I'm also adding the .json and .lang files so that if I've done anything wrong, someone could point it out to me! Thank you so much!!!

 

Main code file:

 

package com.aideux.rockmetadataexamples;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.Side;

@Mod(modid = RockMetadataExamples.MODID, version = RockMetadataExamples.VERSION)
public class RockMetadataExamples 
{
public static final String MODID = "aideux_rockmetadataexamples";
public static final String VERSION = "1.0";
public static Item rock;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	if(event.getSide() == Side.CLIENT)
	{
		ItemRock.registerVariants();
	}
}
@EventHandler
public void init(FMLInitializationEvent event)
{
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register
	(rock, 0, new ModelResourceLocation(MODID + ":" + ((ItemRock) rock).getNameFromDamage(0), "inventory"));
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register
	(rock, 1, new ModelResourceLocation(MODID + ":" + ((ItemRock) rock).getNameFromDamage(1), "inventory"));
}
}

 

ItemRock class file:

 

package com.aideux.rockmetadataexamples;

import java.util.List;

import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class ItemRock extends Item 
{
private static String name = "rock";
private static String[] metaNames = {"green", "black"};

public String getUnlocalizedName(ItemStack par1ItemStack)
{
	return super.getUnlocalizedName()+ "." + metaNames[par1ItemStack.getItemDamage()];
}

public static String getNameFromDamage(int damage)
{
	return name + metaNames[damage];
}

public static void registerVariants()
{
	String[] variantNames = new String[metaNames.length];
	for(int i = 0; i < metaNames.length; i++)
	{
		variantNames[i] = RockMetadataExamples.MODID + ":" + getNameFromDamage(i);
	}
	ModelBakery.addVariantName(RockMetadataExamples.rock, variantNames);
}

@SuppressWarnings({"unchecked", "rawtypes"})
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
	for(int x = 0; x < metaNames.length; x++)
	{
		par3List.add(new ItemStack(this, 1, x));
	}
}

public ItemRock()
{
	GameRegistry.registerItem(this, name);
	setCreativeTab(CreativeTabs.tabMisc);

	setHasSubtypes(true);
}

public String getName()
{
	return name;
}
}

 

.json for black variant:

 

{
    "parent": "builtin/generated",
    "textures": {
        "layer0": "aideux_seconditemexample:items/rockblack"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25],
            "translation": [ 0, 4, 2],
            "scale": [ 1.7, 1.7, 1.7]
        }
    }

 

.json for green variant:

 

{
    "parent": "builtin/generated",
    "textures": {
        "layer0": "aideux_seconditemexample:items/rockgreen"
    },
    "display": {
        "thirdperson": {
            "rotation": [ -90, 0, 0],
            "translation": [ 0, 1, -3 ],
            "scale": [ 0.55, 0.55, 0.55]
        },
        "firstperson": {
            "rotation": [ 0, -135, 25],
            "translation": [ 0, 4, 2],
            "scale": [ 1.7, 1.7, 1.7]
        }
    }

 

and my .lang file:

 

item.aideux_rockmetadataexamples_rockGreen.name=Green Rock

item.aideux_rockmetadataexamples_rockBlack.name=Black Rock

 

Thank you so much again for all your help!!!

Posted

Well, for starters, things like the mesher (pertaining to rendering) exist only on the client side, so you need to learn about proxies. Even worse for the mesher is that it is fragile. Common wisdom now is that you should be calling some custom model loader in (client proxy's) preinit.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted
  On 3/8/2016 at 2:21 AM, jeffryfisher said:

Well, for starters, things like the mesher (pertaining to rendering) exist only on the client side, so you need to learn about proxies. Even worse for the mesher is that it is fragile. Common wisdom now is that you should be calling some custom model loader in (client proxy's) preinit.

Could you maybe give me an example or edit my code so that I could understand from a more visual standpoint? Thank you!

Posted

Use

ModelLoader.setCustomModelResourceLocation

or

ModelLoader.setCustomMeshDefinition

in preInit instead of

ItemModelMesher#register

in init.

 

ModelBakery.registerVariantNames

takes arguments in the same format as

ModelBakery.addVariantName

(

"modid:modelName"

), but expects either

ResourceLocation

s or

ModelResourceLocation

s instead of

String

s.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
  On 3/8/2016 at 2:42 AM, Choonster said:

Use

ModelLoader.setCustomModelResourceLocation

or

ModelLoader.setCustomMeshDefinition

in preInit instead of

ItemModelMesher#register

in init.

 

ModelBakery.registerVariantNames

takes arguments in the same format as

ModelBakery.addVariantName

(

"modid:modelName"

), but expects either

ResourceLocation

s or

ModelResourceLocation

s instead of

String

s.

 

So how are resource locations formatted? Is it similar to creating variables, or do I have to do something else? I'm sorry for not getting it, I'm really trying to. Again, I really appreciate all your guys' help!

Posted
  On 3/8/2016 at 2:55 AM, Aideux said:

So how are resource locations formatted? Is it similar to creating variables, or do I have to do something else? I'm sorry for not getting it, I'm really trying to. Again, I really appreciate all your guys' help!

 

Create a

ResourceLocation

or

ModelResourceLocation

with the

new

operator like you would any other object.

 

A

ResourceLocation

consists of a resource domain and a resource path. There are two public constructors:

  • One that takes a single string in the format
    "<domain>:<path>"


  • One that takes the domain and path as two separate strings

 

ModelResourceLocation

extends

ResourceLocation

and adds a variant. There are three public constructors:

  • One that takes a single string in the format
    "<domain>:<path>#<variant>"

    (the variant is optional and defaults to

    normal

    )

  • One that takes a
    ResourceLocation

    for the domain and path and a string for the variant

  • One that takes a string in the format
    "<domain>:<path>"

    for the domain and path and a string for the variant

 

The domain is the name of the assets folder to look in, usually your mod ID (i.e. the domain

minecraft

maps to assets/minecraft). If you don't specify a domain, it defaults to

minecraft

.

 

ModelBakery.registerVariantNames

tells Minecraft to load the specified models. It expects

<path>

to be the name of your model, which either maps to the item model assets/<domain>/models/item/<path>.json (this is the first priority) or the model specified by the variant with name

<variant>

in the blockstates file assets/<domain>/blockstates/<path>.json (this is added by Forge and only used when the item model wasn't found). If you provide a

ResourceLocation

, the variant will be

inventory

.

 

The model will be stored using the provided

ModelResourceLocation

as the key.

 

ModelLoader.setCustomModelResourceLocation

and

ModelLoader.setCustomMeshDefinition

tell Minecraft which model to use for the

Item

, using the provided

ModelResourceLocation

as the key.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Temu  bunch of Coupon Codes for Temu  to get FTemuREE GIFTS, DISCOUNTS, SAVINGS, and MORE. Check out below and download the Temu  app now !!! Temu  Coupon Code ( acy240173) 30% Off + 100€ OFF in Coupons + Free Shipping + More for Temu  NEW / EXISTING Users. Get 100€ OFF in Coupons + 30% OFF + More; Temu  promo code ( acy240173 ). Temu  Sitewide Sales up to 95% OFF sitewide. Temu  30% Off and 100€ Off in Coupons for NEW and EXISTING users. Use promo code ( acy240173) at checkout!!   Temu  coupon codes for New users 100€ Off - acy240173 Temu  discount code for New customers- acy240173 Temu  100€ coupon code- acy240173 what are Temu  codes - acy240173  does Temu  give you €300- acy240173 Yes Verified Temu  coupon code October2025- acy240173 Temu  New customer offer acy240173 Temu  discount code2025 acy240173 100 off coupon code Temu  acy240173 Temu  100 off any order acy240173 100 dollar off Temu  code acy240173 Temu  Coupon Code ( acy240173 ) 30% Off + 100€ OFF in Coupons + Free Shipping + More for Temu  NEW / EXISTING Users. Get 100€ OFF in Coupons + 30% OFF + More; Temu  promo code (acy240173 ) or ( acy240173 ). Temu  Sitewide Sales up to 95% OFF sitewide. Temu  30% Off and 100€ Off in Coupons for NEW and EXISTING users. Use promo code ( acy240173 ) at checkout!! Temu  coupon code for First Order - {acy240173} Temu  coupon code for New Users- {acy240173} Temu  coupon code for Existing Users- {acy240173} Temu  coupon code 100€ Off- {acy240173} Temu  coupon 30% Off code - {acy240173} - Temu  new user coupon code: acy240173 - Free gift on Temu : acy240173 - Temu  90% discount coupon code: acy240173 - Temu  100€ coupon code for first order: acy240173   Is the Temu  100€ Coupon Legit?  Yes, there are several legit Temu  coupon codes [ acy240173] available for 100€ off. Here are the options you can use: Code [acy240173]: This code provides a 100€ discount legit on your first order when you register and is reported to work effectively during checkout. Code [acy240173]: New users can also use this code to receive a 100€ discount on purchases over €249. Code [acy240173]: This code is available for both new and existing users, offering a 100€ discount on your order. Code [acy240173]: Another option for both new and existing users, this code allows you to save 100€ on your purchase.   Temu  Coupon code 100€ off for this month For October2025, several active Temu  coupon codes can help you save on your purchases: 40% Off Site-Wide: Use code "acy240173" to get 40% off everything. This code is widely used and verified for site-wide discounts on orders over €20. 40€ Off for New Customers: New customers can receive a €20 voucher by downloading the Temu  app and participating in an H5 page game. This voucher can be redeemed using a specific coupon “acy240173”. 40% Off Selected Items: There is also a 40% off coupon “acy240173” available for select items on the Temu  website. Remember to check the specific terms and conditions for each coupon, such as minimum purchase requirements and applicable product categories.   Temu  coupon code 100€ off for new and existing customer Temu  90% OFF promo code "acy240173 " will save you 100€ on your order. To get a discount, click on the item to purchase and enter the code. Yes, Temu  offers 100€ off coupon code [acy240173] Temu  Coupon code [acy240173 ] for existing users can get up to 50% discount on product during checkout. Temu  Coupon Codes for Existing Customers-[acy240173 ] Temu  values its loyal customers and offers various promo codes, including the Legit Temu  Coupon Code [acy240173 ] or [acy240173 ], which existing users can use. This ensures that repeat shoppers can also benefit from significant discounts on their purchases. Keep an eye out for special promotions and offers that are periodically available to enhance your shopping experience.   Temu  Coupon Code 100€ Off for all users  There are specific Temu  coupon codes [acy240173] mentioned for South Africa in the provided search results. The results focus on general Temu  coupon codes [acy240173] and discounts, as well as codes for other countries like the Germany, UK, Canada, Mexico, Kuwait, Austria, Italy, Australia, France , Switzerland, Poland, Saudi Arabia, Germany, Sweden, Portugal, New Zealand, UAE, Belgium, Germany, and France.   Temu  Coupon Code 30% Off: acy240173 Temu  Coupon Code 100€ Off: acy240173 Temu  Coupon Code 100€ Off United States : acy240173 Temu  Coupon Code 100€ Off Germany: acy240173 Temu  Coupon Code 100€ Off Sweden : acy240173 Temu  Coupon Code 100€ Off Finland : acy240173 Temu  Coupon Code 50% : acy240173 Temu  Coupon Code 100€ Off United Kingdom : acy240173 Temu  Coupon Code 100€ Off : acy240173 Temu  Coupon Code 100€ Off : acy240173 Temu  Coupon Code 100€ Off Italy : acy240173 Temu  Coupon Code  100€ Off : acy240173 Temu  Coupon Code 100€ Off Austria : acy240173 Temu  Coupon Code 100€ Off Belgium : acy240173 Temu  Coupon Code 100€ Off : acy240173 Temu  Coupon Code 100€ Off Canada : acy240173 Temu  Coupon Code 100€ Off : acy240173 Temu  Coupon Code 100€ Off Estonia : acy240173 Temu  Coupon Code 100€ Off Switzerland : acy240173 Temu  Coupon Code  100€ Off : acy240173 Temu  Coupon 30% Off + Free Shipping & More There are a bunch of Coupon Codes for Temu  to get FREE GIFTS, DISCOUNTS, SAVINGS, and MORE. Check out below and download the Temu  app now !!! Temu  Coupon Code ( acy240173) 30% Off + 100€ OFF in Coupons + Free Shipping + More for Temu  NEW / EXISTING Users. Get 100€ OFF in Coupons + 30% OFF + More; Temu  promo code (acy240173) \ Temu  Sitewide Sales up to 95% OFF sitewide. Temu  30% Off and 100€ Off in Coupons for NEW and EXISTING users. Use promo code ( acy240173) at checkout!!Temu  Coupon Code Mexico : acy240173 Temu  Coupon Code 100€ Off Ireland : acy240173 Temu  Coupon Code 100€ Off Norway: acy240173 Temu  Coupon Code 100€ Off New Zealand : acy240173 Temu  Coupon Code 100€ Off Poland : acy240173 Temu  Coupon Code 100€ Off Serbia : acy240173 Temu  Coupon Code 100€ Off Armenia : acy240173 Temu  Coupon Code 100€ Off Austria : acy240173 Temu  Coupon Code 100€ Off Greece : acy240173 Temu  Coupon Code 100€ Off Japan : acy240173 Temu  Coupon Code 100€ Off Iceland : acy240173 Temu  Coupon Code 100€ Off Bahrain : acy240173 Temu  Coupon Code 100€ Off Philippines : acy240173 Temu  Coupon Code 100€ Off Portugal : acy240173 Temu  Coupon Code 100€ Off Romania: acy240173 Temu  Coupon Code 100€ Off Slovakia : acy240173 Temu  Coupon Code 100€ Off Malta: acy240173 Temu  Coupon Code 100€ Off France  : acy240173 Temu  Coupon Code 100€ Off South Africa : acy240173 Temu  Coupon Code 100€ Off Hungary : acy240173 Temu  Coupon Code 100€ Off Brazil : acy240173 Temu  Coupon Code 100€ Off Finland : acy240173 Temu  Coupon Code 100€ Off Morocco : acy240173 Temu  Coupon Code 100€ Off Kazakhstan : acy240173 Temu  Coupon Code 100€ Off Colombia : acy240173 Temu  Coupon Code 100€ Off Chile : acy240173 Temu  Coupon Code 100€ Off Israel : acy240173 Temu  Coupon Code 100€ Off Qatar: acy240173 Temu  Coupon Code 100€ Off Slovenia : acy240173 Temu  Coupon Code 100€ Off Uruguay : acy240173 Temu  Coupon Code 100€ Off Latvia: acy240173 Temu  Coupon Code 100€ Off Jordan : acy240173 Temu  Coupon Code 100€ Off Ukraine : acy240173 Temu  Coupon Code 100€ Off Moldova : acy240173 Temu  Coupon Code 100€ Off Oman: acy240173 Temu  Coupon Code 100€ Off Mauritius : acy240173 Temu  Coupon Code 100€ Off Republic of Korea : acy240173 Temu  Coupon Code 100€ Off Dominican Republic: acy240173 Temu  Coupon Code 100€ Off Czech Republic : acy240173 Temu  Coupon Code 100€ Off United Arab Emirates : acy240173 Temu  Coupon Code 100€ Off Peru : acy240173 Temu  Coupon Code 100€ Off Azerbaijan : acy240173 Temu  Coupon Code 100€ Off Saudi Arabia : acy240173 Temu  Coupon Code 100€ Off Croatia : acy240173   Conclusion The Temu  Coupon Code 100€ Off "acy240173" provides a significant discount of 100€ for users in Bahrain. This offer is available for both new and existing customers, allowing them to save substantially on their purchases.In addition to the 100€ discount, customers can also enjoy a 50% off on their orders. To redeem this coupon, simply sign up for a Temu  account, add items worth 100€ or more to your cart, and enter the code during checkout to apply the discounts automatically.   FAQs about the 100€ Off Coupon Code Q1: Who can use the 100€ off coupon? A: The coupon is available for both new and existing users, although different codes may apply to each group. Q2: Can multiple coupon codes be used at once? A: Generally, only one coupon code can be applied per transaction. However, some codes may offer bundled benefits. Q3: Do these coupons expire? A: Many Temu  coupons do not have an expiration date, making them convenient for users to redeem at their leisure. Q4: Are there specific conditions for using these coupons? A: Yes, some coupons may require a minimum purchase amount or specific item categories to be eligible for the discount. Q5: How can I find the latest Temu  Coupon Code 100€ Off 100€ Offs? A: Users can check within their account under "Coupons & offers" or look for updates on promotional websites and forums.
    • You could try this script: https://inconnu-plugins.de/tutorial/server-auto-restart
    • I have already tried other versions of MCP, from 2841 to 2860.
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • The official documentation says next to nothing and I have had no success finding reference snippets (e.g. minimap mods and other stuff that involves directly drawing to the screen). Google searches and GPT outputs reference deprecated and/or removed content from older versions. Legends speak of a layered rendering system that also has next to no documentation. Any help is appreciated. Even drawing just a single pixel is enough.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.