Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Help! The blocks do not load :(

 

 

Upgrade from 1.10.2 to 1.11 and everything else works fine, except blocks, they are not registered :(

 

init/ModBlocks.java :

package com.modding.WillyWonka.init;

import com.modding.WillyWonka.blocks.BlockChocolate;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModBlocks {

public static Block chocolate;

public static void  init() {
	chocolate = new BlockChocolate();


}

public static void register() {

	GameRegistry.register(chocolate);


}

public static void registerRenders() {

	registerRender(chocolate);

}

private static void registerRender(Block block){
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));}
}

 

 

Blocks/BlockChocolate.java

 

package com.modding.WillyWonka.blocks;

import com.ibm.icu.text.DisplayContext.Type;
import com.modding.WillyWonka.Reference;
import com.modding.WillyWonka.WillyWonka;
import com.modding.WillyWonka.WillyWonkaTab;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.client.audio.Sound;

public class BlockChocolate extends Block {

public BlockChocolate() {
	super(Material.ROCK);

	this.setUnlocalizedName(Reference.WillyWonkanBlocks.CHOCOLATE.getUnlocalizedName());
	this.setRegistryName(Reference.WillyWonkanBlocks.CHOCOLATE.getRegistryName());
	this.setCreativeTab(WillyWonka.CREATIVE_TAB);
	this.setHardness(3.0F);
	this.setResistance(5.0F);
	this.setSoundType(SoundType.STONE);
}

}

 

REFERENCES

	public static enum WillyWonkanBlocks {		
   CHOCOLATE("chocolate", "BlockChocolate");



	private String unlocalizedName;
	private String registryName;

	WillyWonkanBlocks(String unlocalizedName, String registryName) {
		this.unlocalizedName = unlocalizedName;
		this.registryName = registryName; 

	}

	public String getUnlocalizedName() {
		return unlocalizedName;
	}

	public String getRegistryName() {
		return registryName;


}
  }	

 

CLIENTPROXY

 

package com.modding.WillyWonka.proxy;

import com.modding.WillyWonka.init.ModBlocks;
import com.modding.WillyWonka.init.ModCrafting;
import com.modding.WillyWonka.init.ModItems;

public class ClientProxy implements CommonProxy {

@Override
public void init() {
	ModItems.registerRenders();
	ModCrafting.register();
	ModBlocks.register();

}

}

 

 

 

Show your common proxy.

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.

  • Author

Show your common proxy.

 

package com.modding.WillyWonka.proxy;

public interface CommonProxy {

public void init();

}

 

 

 

  • Author

  • Why are you registering your Blocks in your client proxy?
  • You never call
    ModBlocks.registerRenders


  • You should be using ModelLoader.setCustomModelResourceLocation to set your models.

 

  • If I do not register the block in client proxy, the client does not start

You should register it in common code.  Either:

a) main class

b) common proxy

c) the registration event

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.

  • Author

I've already tried all that, and nothing that lets me create the block

 

2jb1i4j.png

 

I can pass the folder "src"

I've already tried all that, and nothing that lets me create the block

 

2jb1i4j.png

 

I can pass the folder "src"

You also need to register an ItemBlock item for your blocks.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.