Jump to content

Recommended Posts

Posted

Hello, I have tried my best do do a Forgemod for the MC 1.15.2. (Forgeversion: 31.2), but I keep getting this error:

Quote

[m[1;31m[20:32:46] [modloading-worker-1/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Failed to register automatic subscribers. ModID: vanillaedits, class xtay2.vanillaedits.VanillaEdits
java.lang.NoSuchFieldError: field_151576_e
    at xtay2.vanillaedits.init.BlocksInit.<clinit>(BlocksInit.java:21) ~[?:1.0] {re:classloading}

My whole log https://pastebin.com/D3109NaF

The "error" is displayed to be in the class BlocksInit:

package xtay2.vanillaedits.init;

import xtay2.vanillaedits.VanillaEdits;
import net.minecraft.block.Block;
import net.minecraft.block.Block.Properties;
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.common.ToolType;
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.IForgeRegistry;

@Mod.EventBusSubscriber(modid = VanillaEdits.MODID, bus = Bus.MOD)
public class BlocksInit 
{
	public static final Block ep_ore = new Block(Properties.create(Material.ROCK).harvestLevel(2).hardnessAndResistance(3.0F).harvestTool(ToolType.PICKAXE).sound(SoundType.STONE).lightValue(1)).setRegistryName("ep_ore");

	public static final Item ep_ore_item = new BlockItem(ep_ore, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS).maxStackSize(64)).setRegistryName("ep_ore");    

	
	@SubscribeEvent    
	public static void registerBlocks(final RegistryEvent.Register<Block> event) {
		final IForgeRegistry<Block> registry = event.getRegistry();
		registry.register(ep_ore);
	}    
	@SubscribeEvent
	public static void registerItems(final RegistryEvent.Register<Item> event) {
		final IForgeRegistry<Item> registry = event.getRegistry();
		registry.register(ep_ore_item);
	}   	
}

When I load the mod.jar in normal MC and not Eclipse/Forge the Textures of my added block "ep_ore" wont load at all and I get the purple/black unassigned texture.

 

I hope you can help me, have a wonderful day!

Posted

You should not be creating your blocks and items with static initializers.

You should user DeferredRegister.

The class is documented in the sources and here: https://mcforge.readthedocs.io/en/latest/concepts/registries/

 

As a side note, you should create a github repository for your project, then share the link here when you need help. It makes it easier for people to help you when they can see all your code, it gives the big picture. :) 

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.