Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [SOLVED] Modifying / Replacing Vanilla Blocks (1.16.X)
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
Wintersky20

[SOLVED] Modifying / Replacing Vanilla Blocks (1.16.X)

By Wintersky20, January 19 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Wintersky20    2

Wintersky20

Wintersky20    2

  • Tree Puncher
  • Wintersky20
  • Members
  • 2
  • 31 posts
Posted January 19 (edited)

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 January 19 by Wintersky20
  • Quote

Share this post


Link to post
Share on other sites

AurenX    1

AurenX

AurenX    1

  • Tree Puncher
  • AurenX
  • Members
  • 1
  • 4 posts
Posted January 19

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 1
  • Quote

Share this post


Link to post
Share on other sites

Wintersky20    2

Wintersky20

Wintersky20    2

  • Tree Puncher
  • Wintersky20
  • Members
  • 2
  • 31 posts
Posted January 19
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 

  • Quote

Share this post


Link to post
Share on other sites

kiou.23    10

kiou.23

kiou.23    10

  • Creeper Killer
  • kiou.23
  • Members
  • 10
  • 190 posts
Posted January 19

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

  • Quote

Share this post


Link to post
Share on other sites

Wintersky20    2

Wintersky20

Wintersky20    2

  • Tree Puncher
  • Wintersky20
  • Members
  • 2
  • 31 posts
Posted January 19
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 :)

  • Quote

Share this post


Link to post
Share on other sites

Wintersky20    2

Wintersky20

Wintersky20    2

  • Tree Puncher
  • Wintersky20
  • Members
  • 2
  • 31 posts
Posted January 19
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 :) 

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • PtownCoderSchool
      [HIRING] Minecraft Modders

      By PtownCoderSchool · Posted 43 minutes ago

      Hey all! I run a coding school with a lot of our students coming in looking to get introduced to coding through Minecraft and building their own mods! Whether you're using redstone and some simpler tools, or more advanced and working with Java, please don't hesitate to reach out with your experience!   This is a PAID role. Our students sign up for weekly sessions where you will assist them in making their ideas come to life and teaching them to code along the way.    Due to the pandemic, we are capable of hiring remotely, though you must be located in California.    Interested? Please message me so we can set-up an interview.    Must be be 15+ years old. 
    • brok4d
      [1.16.4] New particle texture for biome.

      By brok4d · Posted 1 hour ago

      I do not know if I explained well, what I try is to change the color of the water particles since my biome is all reddish, I have been looking at the classes of the forge particles and I do not see that it can be modified as I am doing, any Subjection, because you told me to update the forge version to give support, but so if I see that each time the private class is forge, and they cannot be accessed, and also the setParticleTextureIndex method with which it could be select the index of the texture of the particle, in the end I think it will get worse instead of better, if someone thinks otherwise than say it.
    • ryanmanrules
      Delete

      By ryanmanrules · Posted 1 hour ago

      Fixed
    • AdminCat
      The game crashed whilst rendering overlay Error: java.lang.NullPointerException: Rendering overlay Exit Code: -1

      By AdminCat · Posted 2 hours ago

      hhhhhhhhhhhhh  
    • AdminCat
      The game crashed whilst rendering overlay Error: java.lang.NullPointerException: Rendering overlay Exit Code: -1

      By AdminCat · Posted 2 hours ago

      How would I backdate I'm having the same issue here  
  • Topics

    • PtownCoderSchool
      0
      [HIRING] Minecraft Modders

      By PtownCoderSchool
      Started 43 minutes ago

    • brok4d
      1
      [1.16.4] New particle texture for biome.

      By brok4d
      Started 11 hours ago

    • ryanmanrules
      0
      Delete

      By ryanmanrules
      Started 1 hour ago

    • Blake.bill
      12
      The game crashed whilst rendering overlay Error: java.lang.NullPointerException: Rendering overlay Exit Code: -1

      By Blake.bill
      Started September 9, 2020

    • sc0rich
      8
      how do I config mods in 1.16.4?

      By sc0rich
      Started Friday at 02:11 AM

  • Who's Online (See full list)

    • sarkozi
    • Eksity
    • fallOut015
    • MegaTigerpaw
    • Choonster
    • pitbox46
    • ryanmanrules
    • FaZe_jdx
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [SOLVED] Modifying / Replacing Vanilla Blocks (1.16.X)
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community