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

Ok guys .. So , I'm trying to replace a vanilla block in 1.16.4 but no luck!

First I created a Workspace like I always do ..

I created a block class for my replaced block:

public class ExempleBlock extends CactusBlock /*just an ex.*/ {
    public ExempleBlock() {
        super(AbstractBlock.Properties.from(Blocks.CACTUS));
    }

}

Then I tried to register it :

First method( copied from an old 1.12 mod by rwTema )

@Mod.EventHandler/* not in 1.16*/
	public void preinit(FMLPreInitializationEvent event) {/* not in 1.16 , I think*/
		Block blockDietHopper = new BlockDietHopper();
		ForgeRegistries.BLOCKS.register(blockDietHopper);
	}

Then I tried to do this with a new registry event

//from the exemple mod
private void setup(final FMLCommonSetupEvent event){
		Block ex = new ExempleBlock();
		ForgeRegistries.BLOCKS.register(ex);
}

no luck

Then I tried this :

@Mod(ExempleMain.MOD_ID)
public class ExempleMain
{
    public static final String MOD_ID = "id";
    private static final Logger LOGGER = LogManager.getLogger();
    public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "minecraft");
    public static final RegistryObject<Block> BETTER_EXEMPLE = BLOCKS.register("exemple_block", () -> new ExempleBlock());

    public ExempleMain() {
        IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
        bus.addListener(this::setup);
        ExempleMain.BLOCKS.register(bus);
    }
    private void setup(final FMLCommonSetupEvent event){}

}

No luck :/ 

The idea is , I want to modify the TileEntity or the TESR for the vanilla blocks (ex: tools hovering on enchanting table , Nethar anchor GUI, Composter GUI, etc)

 

Note:

I use IntelliJ and mdk-1.16.4-35.1.37

 

And Thanks for every topic :)

Edited by Wintersky20

Note: I am using registry events instead of deferred registry so if someone chimes in on a difference that works better than listen to them. this method still works so i am yet to be motivated to change.

I am able to replace blocks using the RegistryEvent.Register<Block>.
I get the old resource location ForgeRegistries.BLOCKS.getKey(oldBlock); and set the custom block with that blocks registry location newBlock.setRegistryName(resourceLocation); ForgeRegistries.BLOCKS.register(newBlock);

I also replace the Item (again i dont know if this is still needed as doing so still works so i have yet to change it)

  • Author
3 minutes ago, AurenX said:

Note: I am using registry events instead of deferred registry so if someone chimes in on a difference that works better than listen to them. this method still works so i am yet to be motivated to change.

I am able to replace blocks using the RegistryEvent.Register<Block>.
I get the old resource location ForgeRegistries.BLOCKS.getKey(oldBlock); and set the custom block with that blocks registry location newBlock.setRegistryName(resourceLocation); ForgeRegistries.BLOCKS.register(newBlock);

I also replace the Item (again i dont know if this is still needed as doing so still works so i have yet to change it)

Ok , I'll try it 

Thanks for the replay

I'll let you know if is working 

If all you want is to change the screen, not the block itself, you can create your own ContainerScreen, and than bind that to the vanilla Containers

  • Author
45 minutes ago, AurenX said:

Note: I am using registry events instead of deferred registry so if someone chimes in on a difference that works better than listen to them. this method still works so i am yet to be motivated to change.

I am able to replace blocks using the RegistryEvent.Register<Block>.
I get the old resource location ForgeRegistries.BLOCKS.getKey(oldBlock); and set the custom block with that blocks registry location newBlock.setRegistryName(resourceLocation); ForgeRegistries.BLOCKS.register(newBlock);

I also replace the Item (again i dont know if this is still needed as doing so still works so i have yet to change it)

Thanks a lot , it's working perfectly :)

  • Author
1 minute ago, kiou.23 said:

If all you want is to change the screen, not the block itself, you can create your own ContainerScreen, and than bind that to the vanilla Containers

You have a point , but I want to change the entire tile , for input and output in to the blocks

Thanks a lot for the replay ,, but I solve it :) 

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.