Jump to content

[1.12.2] [SOLVED] Need Help Registering Slabs


Emerald_Galaxy

Recommended Posts

So after a long break off modding, I decided to remake my old mod from 1.11.2. So far, it's been going well except that I can't seem to figure out how to make an ItemSlab for my slab. Nor can I even begin to implement a way to register it using my registry handler. If anyone has some ideas on how I can do this, please explain.

 

My Registry Handler

package emerald.emeraldsores.Util.Handlers;

import emerald.emeraldsores.Init.ModBlocks;
import emerald.emeraldsores.Init.ModItems;
import emerald.emeraldsores.Util.ModelInterface;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@EventBusSubscriber

public class RegistryHandler {
	
	@SubscribeEvent
	public static void onItemRegister(RegistryEvent.Register<Item> event) {
		
		event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0]));
		
	}
	
	@SubscribeEvent
	public static void onBlockRegister(RegistryEvent.Register<Block> event) {
		
		event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0]));
		
	}
	
	@SubscribeEvent
	public static void onModelRegister(ModelRegistryEvent event) {
		
		for(Item item : ModItems.ITEMS) {
			
			if(item instanceof ModelInterface) {
				
				((ModelInterface)item).registerModels();
				
			}
			
		}
		
		for(Block block : ModBlocks.BLOCKS) {
			
			if(block instanceof ModelInterface) {
				
				((ModelInterface)block).registerModels();
				
			}
			
		}
		
	}

}

 

Edited by Emerald_Galaxy
Problem Solved
Link to comment
Share on other sites

When I made slabs, I ended up extending ItemSlab to create my own item class for the slabs. I needed to do that because I needed custom behavior in onItemUse, but you might be able to make an ItemSlab directly by passing in a block, half slab, and double slab. ItemSlab extends ItemBlock, so you would then register an instance of your ItemSlab instead of making a generic ItemBlock. You'll probably have to do something custom in your registry to detect when your ItemSlab is being registered.

Link to comment
Share on other sites

11 hours ago, Daeruin said:

When I made slabs, I ended up extending ItemSlab to create my own item class for the slabs. I needed to do that because I needed custom behavior in onItemUse, but you might be able to make an ItemSlab directly by passing in a block, half slab, and double slab. ItemSlab extends ItemBlock, so you would then register an instance of your ItemSlab instead of making a generic ItemBlock. You'll probably have to do something custom in your registry to detect when your ItemSlab is being registered.

Ok I see what your saying. But my problem is I don't know what to put in for the Block parameter. I have both the BlockSlabs in there (My slab and doubleslab) but what do I put for the Block. :/

Edited by Emerald_Galaxy
Link to comment
Share on other sites

I have made my own slabs too and i have a registryHandler class with the @EventBusSubscriber annotiation, where i have for example these 2 methods:

 

    	@SubscribeEvent
	public static void onItemRegister(RegistryEvent.Register<Item> event ) {
		
		event.getRegistry().registerAll(ItemInit.ITEMS.toArray(new Item[0]));
		
		ItemBlock item = new ItemSlab(BlockInit.TERRACOTTA_SLABS_HALF_A, (BlockSlab)BlockInit.TERRACOTTA_SLABS_HALF_A, (BlockSlab)BlockInit.TERRACOTTA_SLABS_DOUBLE_A);
		item.setRegistryName(BlockInit.TERRACOTTA_SLABS_HALF_A.getRegistryName());
		event.getRegistry().register(item);
	}
	
	@SubscribeEvent
	public static void onBlockRegister(RegistryEvent.Register<Block> event ) {
		
		event.getRegistry().registerAll(BlockInit.BLOCKS.toArray(new Block[0]));
		registerTileEntities();
	}

You also have to register the block ofcourse.

Link to comment
Share on other sites

No.

Does vanilla have a double-slab item? No it does not. You don't need one either.

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.

Link to comment
Share on other sites

  • 5 months later...

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Slot Bank Mandiri memberikan penawaran untuk pendaftaran baru akun pro dengan win rate 99% di Museumbola, Secara resmi Slot Mandiri memberikan secara khusus bagi member Museumbola untuk merasakan maxwin pada awal daftar sampai seumur hidup selama bermain di Museumbola. jadi mau kah anda mengambil kesempatan ini? segera klik DAFTAR untuk bergabung bersama Museumbola sekarang juga.  
    • Slot Bank BNI adalah pilihan tergacor untuk memulai bermain slot judi Online dimuka bumi saat ini. Jika anda mempunyai Bank BNI, Anda berkesempatan mendapatkan Akun Pro atau ID pro untuk bermain slot. Tunggu apa lagi? Segera daftarkan diri anda sekarang dan dapatkan kemewahan menang maxwin di Museumbola.
    • Halo para penggemar slot online! Apakah Anda mencari pengalaman bermain slot yang seru dan menguntungkan? Apakah Anda ingin menikmati slot gacor dari server Thailand sambil melakukan deposit melalui Mandiri dengan kesempatan meraih kemenangan besar? Anda telah sampai di tempat yang tepat! Kami di WINNING303 siap memberikan Anda pengalaman bermain yang mengasyikkan dan menguntungkan. Mengapa Memilih WINNING303? WINNING303 telah dikenal sebagai salah satu platform terbaik untuk bermain slot dengan berbagai keunggulan yang kami tawarkan kepada para pemain kami. Berikut adalah beberapa alasan mengapa Anda harus memilih WINNING303: Slot Gacor dari Server Thailand Kami menyajikan koleksi slot gacor terbaik dari server Thailand yang pastinya akan memberikan Anda pengalaman bermain yang menarik dan menguntungkan. Nikmati berbagai jenis permainan slot dengan tingkat kemenangan yang tinggi dan jackpot yang menarik. Deposit Mudah Melalui Mandiri Kami memahami pentingnya kemudahan dalam bertransaksi bagi para pemain kami. Oleh karena itu, kami menyediakan layanan deposit melalui bank Mandiri, salah satu bank terbesar di Indonesia. Proses depositnya cepat, mudah, dan aman, sehingga Anda dapat langsung memulai petualangan bermain tanpa hambatan. Peluang Maxwin Besar Di WINNING303, kami selalu memberikan peluang untuk meraih kemenangan besar. Dengan berbagai promosi dan bonus menarik yang kami sediakan, Anda memiliki kesempatan untuk memenangkan hadiah-hadiah yang fantastis dan meraih maxwin dalam bermain slot.  
    • SLOT Ratubet77 adalah bocoran slot gacor rekomendasi dari Ratubet77 yang bisa anda temukan di SLOT Ratubet77. Situs SLOT Ratubet77 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ratubet77 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ratubet77 merupakan SLOT Ratubet77 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ratubet77. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ratubet77 hari ini yang telah disediakan SLOT Ratubet77. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ratubet77 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ratubet77 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ratubet77 di link SLOT Ratubet77. DAFTAR SEKARANG DAFTAR SEKARANG DAFTAR SEKARANG
    • I am currently running the 1.20.1 Occultcraft modpack in Curseforge and am having numerous troubles making a mob farm with the apotheosis mod. When trying to modify the stats of the spawners specific stats such as the range, spawn count, and max entities reset to default after every spawn. When the spawners spawn boss mobs with certain attributes, that I'm not sure of, the building it is in explode even with mob griefing turned off. This has happened multiple times with varying sizes for the explosions. I was wonder if there is any way to disable these explosions from happening or disable boss abilities with something in the game. I also wanted to know a fix for the resetting stats on spawners and why this is happening.
  • Topics

×
×
  • Create New...

Important Information

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