Jump to content

Texture Problem 1.15.2 Modding


Luzog78

Recommended Posts

Hi,

Im a french guy and i want to create mod for me and my friend,

So i try to create a very simple mod for testing.

I following a lot of modding tutorial in 1.15 in English and Spanish but i encountered the same problem every time and .... CA COMMENCE A ME SAOULER ? -> Sorry, a french  expression ?..

 

So, the problem is a texture problem :

When i start the game (with runClient in EclipseJava), the textures of new blocks ... there a not texture ?

 

 

The src code

 

Main class :

Quote

 


package fr.luzog78.tutorialmod;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import net.minecraft.block.Block;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

@Mod("tutorialmod")
public class Main {

	public static final String MOD_ID = "tutorialmod";
	public static Main instance;
	
	@SuppressWarnings("unused")
	private static final Logger LOGGER = LogManager.getLogger();

	public Main() {
		FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
		FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);

		instance = this;
		
		MinecraftForge.EVENT_BUS.register(this);
	}

	private void setup(final FMLCommonSetupEvent event) {

	}

	private void doClientStuff(final FMLClientSetupEvent event) {

	}

	@SubscribeEvent
	public void onServerStarting(FMLServerStartingEvent event) {

	}

	@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
	public static class RegistryEvents {

		@SubscribeEvent
		public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
			
		}

	}

}

 

BlockInit class :

Quote

package fr.luzog78.tutorialmod.init;

import fr.luzog78.tutorialmod.Main;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.registries.ObjectHolder;

@Mod.EventBusSubscriber(modid = Main.MOD_ID, bus = Bus.MOD)
@ObjectHolder(Main.MOD_ID)
public class BlockInit {

	public static final Block example_block = new Block(
			Block.Properties.create(Material.GLASS).hardnessAndResistance(0.5f, 15.0f).sound(SoundType.GLASS))
					.setRegistryName("example_block");

	@SubscribeEvent
	public static void registerBlocks(final RegistryEvent.Register<Block> e) {
		e.getRegistry().register(example_block);
	}

	@SubscribeEvent
	public static void registerBlockItems(final RegistryEvent.Register<Item> e) {
		e.getRegistry()
				.register(new BlockItem(example_block, new Item.Properties().maxStackSize(16).group(ItemGroup.REDSTONE))
						.setRegistryName(example_block.getRegistryName()));
	}

}

 

assets/tutorialmod/blockstates/example_block.json :

Quote

I try 3 differents code :


{
	"variants": {
		"normal": {
			"model": "tutorialmod:block/example_block"
		}
	}
}

{
	"default": {
		"model": "tutorialmod:block/example_block"
	}
}

{
	"": {
		"model": "tutorialmod:block/example_block"
	}
}

But doesn't work....

assets/tutorialmod/lang/en_us.json :

Quote

{
	"item.tutorialmod.example_item": "Example Item",
	"block.tutorialmod.example_block": "Example Block"
}

 

assets/tutorialmod/models/block/example_block.json :

Quote

{
	"parent": "block/cube_all",
	"textures": {
		"all": "tutorialmod:blocks/example_block"
	}
}

 

assets/tutorialmod/texture/blocks/example_block.png:

.... here, an 16x16 image

 

The Package Explorer :

Quote

image.png.586418f81e3cd5feedda59091495249d.png

 

When place the block, there are not texture but the ItemBlock has the good texture and the good name.... And there are not error in the console....

Its craaaazzzzyyyyyy.... I not understand anything....

 

Quote

image.png.9072ceb65c35e06bc369a0631a6ca7e0.png

(And, I create an item : Exemple Item and everything is working !)

 

I have been trying that for 2 months and 3 weeks.

I need your help pleaaase,  Im Going CRAZYY ?

Thanks

Edited by Luzog78
Link to comment
Share on other sites

Not sure if you already fix the problem or not, but there's always a "warning" when some error happened in the resources such as model/texture/blockstate not found... etc. I also don't think any of the blockstate file you've tried is with the correct format in 1.15. Try this:

 

{
    "variants": {
        "": { "model": "examplemod:block/example_block"}
    }
}

 

Link to comment
Share on other sites

I suppose that related to the 7016th line, but idk what and idk how to  fix this

 

7016th line :

[m[33m[17:17:54] [Server-Worker-2/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'tutorialmod:blockstates/example_block.json' missing model for variant: 'tutorialmod:example_block#'

 

Edited by Luzog78
Link to comment
Share on other sites

You mean like this bit?

Quote

[m[33m[17:17:54] [Server-Worker-2/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'tutorialmod:blockstates/example_block.json' missing model for variant: 'tutorialmod:example_block#'
[m[33m[17:17:54] [Server-Worker-2/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'tutorialmod:blockstates/example_block.json' in resourcepack: 'Mod Resources': com.google.gson.stream.MalformedJsonException: Expected ':' at line 4 column 50 path $.variants..model.tutorialmod:block/example_block

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Yes, there a a exception when loading blockstate definition (i think with the assets/tutorialmod/blockstates/example_block.json file), and idk how fix this exeption.... I suppose

Edited by Luzog78
Link to comment
Share on other sites

Write valid JSON?

Get a plugin for your IDE that does syntax checking on json files. I know both Eclipse and IntelliJ have them on their plugin marketplace.

 

But if you can't be bothered, use https://jsonlint.com/

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Sorry,

 

 

Okkkkkkkkk that great !!!

 

Thank you very much @poopoodice for your indications !

 

And Thanks a lot @Draco18s and @diesieben07 !

 

The final json file was not valid, the great is this :

Quote

{
	"variants": {
		"": {
			"model": "tutorialmod:block/example_block"
		}
	}
}

 

 

 

Thanks very much everyone for all ! ??

Edited by Luzog78
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.

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.