Jump to content

Block texture not loading when placed


bigbadboybob

Recommended Posts

I'm new to modding and just tried to create my first block. The block showed up successfully in my inventory as an item but when I placed the block it shows up as the black and magenta missing texture:

 

 I don't understand how this is possible because my models/item/tutorial_block.json file just redirects to the models/block/tutorial_block.json file like this:

{
    "parent": "bigbadboybob1:block/tutorial_block"
}

Here is my models/block/tutorial_block.json file:

{
    "parent": "block/cube_all",
    "textures": {
        "all": "bigbadboybob1:block/tutorial_block"
    }
}

Here is my main java file for reference:

package lucas.tutorialmod;

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

import lucas.tutorialmod.lists.BlockList;
import lucas.tutorialmod.lists.ItemList;
import lucas.tutorialmod.lists.ToolMaterialList;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.AxeItem;
import net.minecraft.item.BlockItem;
import net.minecraft.item.HoeItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.SwordItem;
import net.minecraft.util.ResourceLocation;
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.javafmlmod.FMLJavaModLoadingContext;

@Mod("bigbadboybob1")
public class TutorialMod {
	
	public static TutorialMod instance;
	public static final String modid = "bigbadboybob1";
	private static final Logger logger = LogManager.getLogger(modid);
	
	public static final ItemGroup tutorial = new TutorialItemGroup();
	
	public TutorialMod() {
		
		instance = this;
		
		FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
		FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries);

		MinecraftForge.EVENT_BUS.register(this);
	}
	
	private void setup(final FMLCommonSetupEvent event) {
		
		logger.info("Setup method registered.");
	}
	
	private void clientRegistries(final FMLClientSetupEvent event) {
		
		logger.info("Client method registered.");

	}
	
	@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
	public static class RegistryEvents{
		
		@SubscribeEvent
		public static void registerItems(final RegistryEvent.Register<Item> event) {
			

			event.getRegistry().registerAll (
					
			ItemList.tutorial_item = new Item(new Item.Properties().group(tutorial)).setRegistryName(Location("tutorial_item")),
			
			ItemList.tutorial_block = new BlockItem(BlockList.tutorial_block, new Item.Properties().group(tutorial)).setRegistryName(BlockList.tutorial_block.getRegistryName())
			/*
			ItemList.tutorial_axe = new AxeItem(ToolMaterialList.tutorial, -10.0f, 2.0f, new Item.Properties().group(tutorial)).setRegistryName(Location("tutorial_axe")),
			ItemList.tutorial_hoe = new HoeItem(ToolMaterialList.tutorial, -40.0f, new Item.Properties().group(tutorial)).setRegistryName(Location("tutorial_hoe")),
			ItemList.tutorial_pickaxe = new PickaxeItem(ToolMaterialList.tutorial, -40, 2.0f, new Item.Properties().group(tutorial)).setRegistryName(Location("tutorial_pickaxe")),
			ItemList.tutorial_shovel = new ShovelItem(ToolMaterialList.tutorial, -40.0f, 2.0f, new Item.Properties().group(tutorial)).setRegistryName(Location("tutorial_axe")),
			ItemList.tutorial_sword = new SwordItem(ToolMaterialList.tutorial, 0, 2.0f, new Item.Properties().group(tutorial)).setRegistryName(Location("tutorial_axe"))
			*/
			);

			logger.info("Items registered");
		}
		
		@SubscribeEvent
		public static void registerBlocks(final RegistryEvent.Register<Block> event) {
			

			event.getRegistry().registerAll (
					
					BlockList.tutorial_block = new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(2.0f, 3.0f).lightValue(5).sound(SoundType.SNOW)).setRegistryName(Location("tutorial_block"))
			);

			logger.info("Items registered");
		}
		
		private static ResourceLocation Location(String name) {
			return new ResourceLocation(modid, name);
		}
	}
}

 

Screenshot (69).png

 

EDIT:

Got this in the console when launching the mod:

[m[33m[14:25:09] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: bigbadboybob1:blockstates/tutorial_block.json: java.io.FileNotFoundException: bigbadboybob1:blockstates/tutorial_block.json
[m[33m[14:25:09] [Server-Worker-3/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'bigbadboybob1:blockstates/tutorial_block.json' missing model for variant: 'bigbadboybob1:tutorial_block#'

This is my blockstates file:

{
    "variants": {
        "": { "model": "bigbadboybob1:block/tutorial_block" }
    }
}

 

Edited by bigbadboybob
Link to comment
Share on other sites

24 minutes ago, bigbadboybob said:

Thanks everyone for replying I have looked over my directories multiple times and didn't see anything wrong but in case there is anything I'm missing, here is a screenshot of my directory:

 

Screenshot (76).png

Do you have a block item setup? If so is the texture applying to that?

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.