Jump to content

Gradle not building newly-added textures to .jar


Recommended Posts

Posted

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)
		.setHardness(0.5F).setStepSound(Block.soundTypeGravel)
		.setBlockName("genericDirt").setCreativeTab(CreativeTabs.tabBlock)
		.setBlockTextureName("genericmod:genericDirt");
public static final Block genericOre = new GenericOre(Material.rock)
		.setBlockTextureName("genericmod:genericOre");
public static final Block multiBlock = new MultiBlock("multiblock", Material.cloth)
		.setHardness(0.1F).setStepSound(Block.soundTypeCloth)
		.setBlockName("multiBlock").setCreativeTab(CreativeTabs.tabBlock)
		.setBlockTextureName("genericmod:multiBlock");

 

And in the preInit() method:

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

 

Posted

Are all of your resources in src/main/resources, with assets being in src/main/resources/assets/<modid>?

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

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!

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



×
×
  • Create New...

Important Information

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