Jump to content

Gradle not building newly-added textures to .jar


Recommended Posts

So I'm pretty new to modding. I'm currently finishing up a generic, wool-like block with metadata that I've cobbled together based on several different tutorials. My code is apparently solid; the game loads fine and the three different subblocks are present. The problem comes in with the textures.


For some reason, when I build the .jar to test my mod (I could never get gradlew runClient working), the textures for a couple of other blocks (genericDirt and genericOre) are successfully loaded into it. These two blocks are the first things I created, and once I figured out where the textures went, they worked perfectly and still do. However, the three textures for multiBlock - multiBlock_x.png - are always missing from the jar file, as are the textures for all my items. Adding them in manually fixes the issue, but I'd rather not have to do that every time. Is there something I didn't do in the code for multiBlock that I did for the others?


Code to register each block or item:


	//Register items
	GameRegistry.registerItem(genericItem, "genericItem");
	GameRegistry.registerItem(genericIngot, "genericIngot");

	//Register blocks
	GameRegistry.registerBlock(genericDirt, "genericDirt");
	GameRegistry.registerBlock(genericOre, "genericOre");
	GameRegistry.registerBlock(multiBlock, ItemBlockMultiBlock.class, "metablock");



Code to initialize blocks/items:


//Item list
public static Item genericItem;
public static Item genericIngot;

//Block list
public static final Block genericDirt = new GenericBlock(Material.ground, "shovel", 0, 0)
public static final Block genericOre = new GenericOre(Material.rock)
public static final Block multiBlock = new MultiBlock("multiblock", Material.cloth)


And in the preInit() method:

//Define items
	genericItem = new GenericItem().setTextureName("genericmod:genericItem");
	genericIngot = new GenericItem().setMaxStackSize(16)


Link to comment
Share on other sites

Probably should have included that - the textures are in forge_1710_src/src/assets/genericmod/textures/<blocks or items>, and the code is in forge_1710_src/src/main/java/tutorial/generic. (For whatever reason, forge_1710_src/src/Minecraft/src, the folder Havvy's tutorial on the wiki told me to put .java files in, didn't exist and is not on the build path. I don't know what happened when I set up the environment, but either I did something wrong or that page of the tutorial isn't updated quite right.)


EDIT: Placing the files in src/main/resources/assets/genericmod/textures cuased it to compile properly. I still don't understand why the two blocks orked right, because that folder was empty before, but it works now. Thank you!

Link to comment
Share on other sites

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.

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.

  • Create New...

Important Information

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