Jump to content

[Semi-Solved/workaround] 1.11.2 Difference in wooden_door (Blocks.OAK_DOOR) and other doors?


Recommended Posts

I am replacing all the vanilla doors with a custom behavior (BlockDoubleDoor extends BlockDoor).


	ironDoor=new BlockDoubleDoor("iron_door",Material.IRON,5.0F, SoundType.METAL,"iron_door"); 
	oakDoor=new BlockDoubleDoor("wooden_door",Material.WOOD,3.0F,SoundType.WOOD,"wooden_door");
	darkOakDoor=new BlockDoubleDoor("dark_oak_door",Material.WOOD,3.0F,SoundType.WOOD,"dark_oak_door");
	spruceDoor=new BlockDoubleDoor("spruce_door",Material.WOOD,3.0F,SoundType.WOOD,"spruce_door");
	jungleDoor=new BlockDoubleDoor("jungler_door",Material.WOOD,3.0F,SoundType.WOOD,"jungle_door");
	birchDoor=new BlockDoubleDoor("birch_door",Material.WOOD,3.0F,SoundType.WOOD,"birch_door");
	acaciaDoor=new BlockDoubleDoor("acacia_door",Material.WOOD,3.0F,SoundType.WOOD,"acacia_door");
	substitute(Blocks.IRON_DOOR,ironDoor); //works
	//substitute(Blocks.OAK_DOOR,oakDoor);	//errors, halts
	//substitute(Blocks.DARK_OAK_DOOR,darkOakDoor); //errors, halts
	substitute(Blocks.SPRUCE_DOOR,spruceDoor); //works
	substitute(Blocks.JUNGLE_DOOR,jungleDoor); //works
	substitute(Blocks.BIRCH_DOOR,birchDoor);	//works
	substitute(Blocks.ACACIA_DOOR,acaciaDoor); //works

public BlockDoubleDoor(String name, Material materialIn,float hardness, SoundType sound,String unlocalizedname){
		this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(OPEN, Boolean.valueOf(false)).withProperty(HINGE, BlockDoor.EnumHingePosition.LEFT).withProperty(POWERED, Boolean.valueOf(false)).withProperty(HALF, BlockDoor.EnumDoorHalf.LOWER));


public static void substitute(Block toReplace, Block newBlock) {
		if(newBlock instanceof BlockDoor){
			substitute(toReplace, newBlock, new ItemDoor(newBlock));
			substitute(toReplace, newBlock, new ItemBlock(newBlock));

ublic static void substitute(Block toReplace, Block newBlock, Item newItem) {
		try {
			ResourceLocation oldName = Block.REGISTRY.getNameForObject(toReplace);
			String nameToSubstitute = oldName.toString();
			String nameToRegister = DadMod.modId + ":" + oldName.getResourcePath();
			System.out.println("Substitute:"+nameToSubstitute+" with "+nameToRegister);
			GameRegistry.addSubstitutionAlias(nameToSubstitute.toString(), GameRegistry.Type.BLOCK, newBlock);
			GameRegistry.addSubstitutionAlias(nameToSubstitute.toString(), GameRegistry.Type.ITEM, newItem);
		} catch (ExistingSubstitutionException e) {
			throw new RuntimeException(e);

error when trying to substitute dark oak or wooden doors:


java.lang.NullPointerException: Initializing game
        at net.minecraft.client.renderer.block.model.ModelResourceLocation.<init>(ModelResourceLocation.java:24)
        at net.minecraft.client.renderer.block.statemap.DefaultStateMapper.getModelResourceLocation(DefaultStateMapper.java:15)
        at net.minecraft.client.renderer.block.statemap.StateMapperBase.putStateModelLocations(StateMapperBase.java:56)
        at net.minecraft.client.renderer.block.statemap.BlockStateMapper.getVariants(BlockStateMapper.java:74)
        at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:122)
        at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:252)"


Seems like the replacement is working, but something about loading models is not.


All the jsons (blockstates,models (block & items), textures (with variants)) for all the types of doors were copied over to my projects and verified mutliple times that they are in the correct directories.


Is there anything different about the Dark Oak and Wooden doors that would cause them to fail, while the other ones work?


Edited by aw_wolfe
problem solved by isolating substitution in new mod by itself
Link to comment
Share on other sites

Small progress, If I change to

//ok, I really don't think this was doing this before. But if I only register one of them it works, but trying to register both does not.





Link to comment
Share on other sites

Go to the log file and look for JSON warnings. Better yet, set a breakpoint in the JSON loader (and anywhere else that looks informative) and run in the debugger.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

No warnings in the log. I've been trying to debug for a bit, but not super familiar with eclipse and conditional breakpoints..so taking a while...not working the way I think it should. Anyway, ends up crashing when


protected void loadBlock(BlockStateMapper blockstatemapper, Block block, final ResourceLocation resourcelocation)


gets passed a resourcelocation with one of the original doors (class BlockDoor --instead of my BlockDoubleDoor and the resource location is a null).

Actual fault:


private ResourceLocation getBlockstateLocation(ResourceLocation location) // location is null
        return new ResourceLocation(location.getResourceDomain(), "blockstates/" + location.getResourcePath() + ".json");


Now, why is an original BlockDoor getting passed in? Why is it null? Not sure, would need to back continue tracking down.


However, I wanted to create a new project and just have the double doors, isolate my issue and post to github for help.  However, now....it compiles and runs , however the texutures aren't getting mapped. Arg!! same directory structure from my other project.  I'm not seeing my mapping error. Sees the language mappings, model mappings work, and my doubledoor functions, just get the pink/black blocks and items. I need sleep.


One step forward, two steps backward.


It's here if you have any inkling to take a look and see why the textures aren't mapping.



Link to comment
Share on other sites

22 hours ago, aw_wolfe said:

get the pink/black blocks and items.

Feed your json files to jsonlint, then pick through them looking for tiny errors (like errant underscores, capitalization etc), then post them here.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

jeffryfisher, super thanks for taking the time to try and help.


I have no idea why the doubledoor issues was failing in my original mod. Again, if either oak (wooden) or dark oak were substituted it worked fine, but if both were, then crashed. I have to assume something else in my mod was causing an issue, or forge had difficulty when a lot of other items/blocks are added, some kind of overflow issue ?


Anyway, isolating the double doors into a new mod showed that both could be substituted if done in a mod by itself.  Maybe a better design anyway to have separate mods with segragated functionality, rather than piling everything into a single mod.


I spent way too much time assuming something was wrong with the mapping of modid/item, directory structure, json files etc....Turned out I was calling the substitution in the fml init instead of preInit.  Arg, ugh. kicking myself, but nice to be able to move on to something else.


I updated the github repro. I love the doubledoor functionality, maybe someone else will want it or can use the code examples.



Link to comment
Share on other sites

Your problem could still reappear later with your mod. If you register or substitue new items, for example. If it happens try changing the order of registration or try to register placeholder entries.

I reported this bug with substitution here : https://github.com/MinecraftForge/MinecraftForge/issues/3837

Note I said 19 in the report, but I think there are other value threshold than can trigger the bug. I have been trying for the last few days to precisely figure out the pattern without much success, but there's definitely one. Your classes&JSON are good and unrelated with this.

  • Like 1
Link to comment
Share on other sites


Thanks. I guess I'm still at the point where I assume anything wrong is my issue. Good to know that maybe I'm getting the hang of things...sorta. 


You do any custom work on Forge itself?

I was trying to setup a modified forge workspace, but couldn't get it to generate a complete snapshot (only got a few files).  Wanted to be able to substitute other things than Items or blocks.  Between only basic+ java, new to me gradle, new to me maven, new to me forge, and little time,  just couldn't get it and put it on the back burner.  Eventually, as I get a better understanding, I want to go back and work on a few things in forge itself.

Link to comment
Share on other sites

Well it's a bit hard to help "just like that", all I can recommend you is to watch CPW's video ( https://www.youtube.com/watch?v=yanCpy8p2ZE ) if it's not already done.

There is already a PR to extend substitution, but it's for 1.10 so this one will not be accepted. You can find it here : https://github.com/MinecraftForge/MinecraftForge/pull/3462

Maybe there could also be a method in IForgeRegistry<T>, that would feel consistent with the new register events introduced in 1.11.

But all of this is a bit useless if that bloody bug is left unfixed ><".

  • Like 1
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.

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.

  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, I don't have much experience with forge but I have some java knowledge, I want to add a button that says "Explore New Packs" to the Pause Screen that opens when we enter a world in the game and press the "esc" button, but I couldn't understand it (or I don't know how to use it), although I did research from artificial intelligence or different places. I was told that I can do it using mixins but I have no idea how to do it, can you explain step by step
    • We need the crash report or debug.log, as explained in the FAQ
    • i have the decocraft mod and i can see all of them. i can click right click and place the items but as soon as i put it down it disappears. im so sad it doesnt work and i dont know how to fix it. i used cursed forge to launch minecraft as well.
    • Me and my friend wanted to make a custom mod pack hosted on aternos. I downloaded the same mods as the server then started the server and my minecraft and I joined the server without issues. Then I sent the mods to my friend compressed in a zip folder (i don’t know if that has anything to do with the issue). He unpacked it put it in his mod folder and started it but couldn't join the server and got this issue:   internal exception: java.lang.runtimeexception: server not initialized yet! call IMDLib.entityHandler (modid)   Also we are using curseforge launcher to manage the mods on client side. But as I said it works on my side but not with my friend, that’s why it doesn’t make sense   Mod list:   xplosives-1.2.0.jar whisperwoods-1.18.2-2.1.0-forge.jar waystones-forge-1.18.2-10.2.2.jar voicechat-forge-1.18.2-2.4.32.jar trashslot-forge-1.18.2-11.0.3.jar towns_and_towers_forge- torchmaster-18.2.1.jar ToolBelt-1.18.2-1.18.9.jar toms_storage-1.18.2-1.4.4.jar swingthroughgrass-1.18.2-1.9.1.jar strictly_origins_v5.1_1.18.2.jar starlight-1.0.2+forge.546ae87.jar SpartanWeaponry-1.18.2-3.0.4.jar SimpleQuarry-1.18.2-18.2.5.jar simpleplanes-1.18.2-5.2.2.jar secretrooms-1.18.2-1.1.5.jar right-click-harvest-3.2.0+1.18.2-forge.jar REIPluginCompatibilities-forge-8.0.89.jar RoughlyEnough|tems-8.3.681-forge.jar RegionsUnexploredForge-0.4.1_1+1.18.2.jar TerraBlender-forge-1.18.2- Recall_Potion_v1.0.3-1.18.2.jar Quark-3.2-358.jar PickleTweaks-1.18.2-6.1.2.jar Pehkui-3.7.11+1.18.2-forge.jar Origins-1.18.2- naturalist-forge-1.1.1-1.18.2.jar mysticaloaktree-1.18.2-1.2.jar selene-1.18.2-1.17.14.jar MysticalAgradditions-1.18.2-5.1.4.jar MysticalAgriculture-1.18.2-5.1.5.jar MultiMine-1.18.7.jar moyai-1.18.2-1.1.4.jar ModernDynamicSurroundings- lootbeams-1.18.1-release-july1722.jar journeymap-1.18.2-5.9.7-forge.jar ironfurnaces-1.18.2-3.3.3.jar ironchest-1.18.2-13.2.11.jar industrial-foregoing-1.18.2- titanium-1.18.2-3.5.11-45.jar immersive_armors-1.5.6+1.18.2-forge.jar hardcorerevival-forge-1.18.2-8.0.1.jar HammerLib-1.18.2-18.2.16. jar gravestone-1.18.2-1.0.1.jar geckolib-forge-1.18-3.0.57.jar findme-3.0.6-forge.jar faithfulbackrooms3.0.0.7.jar elevatorid-1.18.2-1.8.4.jar EasyMagic-v3.3.0-1.18.2-Forge.jar PuzzlesLib-v3.5.9-1.18.2-Forge.jar easy_villagers-1.18.2-1.0.11.jar easy_mob_farm_1.18.2-7.1.0.jar DynamicTrees-1.18.2-1.0.4.jar dragonseeker-1.1.1-1.18.2.jar iceandfire-2.1.12-1.18.2.jar Cucumber-1.18.2-5.1.5 jar cloth-config-6.5.116-forge.jar citadel-1.11.3-1.18.2.jar chunkloaders-1.2.8a-forge-mc1.18.jar supermartijn642configlib-1.1.8-forge-mc1.18.jar supermartijn642corelib-1.1.17-forge-mc1.18.jar cave_dweller-1.18.2-1.6.4.jar carryon-1.18.2- caelus-forge-1.18.1- BotanyTrees-Forge-1.18.2-4.0.13.jar BotanyPots-Forge-1.18.2-8.1.29.jar Bookshelf-Forge-1.18.2-13.3.56.jar balm-3.2.6.jar AutoRegLib-1.7-53.jar ars_nouveau-1.18.2-2.9.0.jar curios-forge-1.18.2- Patchouli-1.18.2-71.1.jar architectury-4.12.94-forge.jar almostunified-forge-1.18.2-0.3.10.jar [1.18.2] SecurityCraft v1.9.8.jar
  • Topics

  • Create New...

Important Information

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