Jump to content

Recommended Posts

Posted (edited)

I am new to Minecraft modding, so I followed 2 tutorials on how to make custom blocks. 1 by Harry Talks, the other one by Loremaster. Both of the series use the same type of RegistryHandler's, but both series don't show how to use this way of registering slabs, stairs or walls. I found a post about custom slabs, but it does not use a RegistryHandler to register the slabs. Looking at it, I can understand what is going on. I just have a hard time converting that code to the other technique.

 

Therefor my question is, given the RegistryHandler, BlockSlabBase and BlockInit bellow, how do I go on about registering a new slab?

My code could be completely off to what it should be, but that's just because of the lack of tutorials.


 

  Reveal hidden contents

 

Edited by FloppyGaming
Posted

I’m just gonna link this, read it, it’s all important. https://gist.github.com/Cadiboo/fbea89dc95ebbdc58d118f5350b7ba93

 

Slabs are a fairly complicated thing for a new Modder, as they involve 2 semi-seperate blocks and 1 custom itemblock. 

Heres my slab class (not how it’s abstract had has 2 subclasses, double & single) https://github.com/Cadiboo/Legendary-Winter/blob/master/src/main/java/geek/legendarywinter/blocks/BlockWinterstoneSlab.java

I create the blocks with

	registry.register(setupBlock(new BlockWinterstoneSlab.Half(), "winterstone_slab"));
	registry.register(setupBlock(new BlockWinterstoneSlab.Double(), "winterstone_double_slab"));
	

and the itemblock with

	final ItemSlab itemSlab = new ItemSlab(WINTERSTONE_SLAB_HALF, WINTERSTONE_SLAB_HALF, WINTERSTONE_SLAB_DOUBLE);
	final ResourceLocation name = WINTERSTONE_SLAB_HALF.getRegistryName();
	itemSlab.setRegistryName(name);
	registry.register(itemSlab);
	

I use a local variable and don’t chain setRegistryName because it returns an Item and not an ItemSlab, it’s not necessary though

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.