Jump to content

Integration of Custom Stairs


OrangeySnicket

Recommended Posts

For the mod I'm creating, I need to create several different stairs and slabs. I've read that the stairs are easier, so for now they are my focus. I've followed through a couple tutorials as well as correlated with other mods, but I can't seem to get my stairs to function properly. Every time I attempt to run the JDK, the game crashes citing an error at line 30 of my event subscriber, where I begin to deal with the stairs. Do any of you have any ideas? Code can be found at https://github.com/OrangeySnicket/CosCraft-Mod/tree/WIP/workspace/InvestitureMod/src/main/java, with logs and crash reports only a couple directories up. There are a lot of blocks there, but the one I've chosen to start with is Bronze Stairs. Thanks in advance!

Link to comment
Share on other sites

11 minutes ago, OrangeySnicket said:

Thanks in advance!

You cant do this

"static IBlockState modelState = ModBlocks.BRONZE_BLOCK.getDefaultState();"

 

ModBlocks.BRONZE_BLOCK is still null at this point in time.

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.

Link to comment
Share on other sites

53 minutes ago, OrangeySnicket said:

How would I do that with everything still being null?

Pass it in through the constructor. Store the value of the block you need as a local variable in your registry event method. Yes you'll have to do this for each one.

29 minutes ago, Jummit said:

You can do this

No they cant because they need to have the value to create another block. And ObjectHolder values are not populated until after the registry events have fired.

 

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.

Link to comment
Share on other sites

1 hour ago, OrangeySnicket said:

What would your solution look like?

registerBlock(event)

   Block block:

   event.getRegistry().registerAll(

      ...

      block = new BronzeBlock(),

      new BlockStairs(block)...

   );

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.

Link to comment
Share on other sites

I hope it doesn't seem like I want too be spoonfed too much, I really am trying here, but I still just don't get what you're trying to say. My initial thought was that I was supposed to create a whole new function that uses the registerBlock(event) method and use that to instantiate the stairs. I next guessed that maybe you meant  me to register all the regular blocks first as I am, then use the bronze block from there as my base. Neither of these worked, nor have a couple of other strange interpretations I've attempted. Is that intended to be its own module or to go inside one of the functions I've already created? And, either way, should any of those be curly brackets? Seriously, so sorry for not figuring this out more easily.

Link to comment
Share on other sites

10 minutes ago, OrangeySnicket said:

I really am trying here, but I still just don't get what you're trying to say.

Its psuedocode.

8 hours ago, Animefan8888 said:

registerBlock(event)

This is your Register<Block> method you can use the one you already have.

 

8 hours ago, Animefan8888 said:

Block block:

This is a variable declaration at the top of the method for a Block type called block.

 

8 hours ago, Animefan8888 said:

event.getRegistry().registerAll

We call the register all method on the registry allowing us to pass in all of the blocks we want.

 

9 hours ago, Animefan8888 said:

...

This is here to say all your blocks you have.

 

9 hours ago, Animefan8888 said:

block = new BronzeBlock(),

This sets the block variable we created at the top of our registry method to the BronzeBlock and puts it in the registry.

 

9 hours ago, Animefan8888 said:

new BlockStairs(block)...

Create the stairs Block and pass in the block variable we created at the top of the method and just set to the Bronze Block(you may want it to be the getDefaultState() of the block).

9 hours ago, Animefan8888 said:

);

Close out of the registerAll method.

 

Is that enough explanation?

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.

Link to comment
Share on other sites

I... think so. My rewritten code now looks something like this:

public static void registerBlocks(Register<Block> event) {
		
		Block block;
		
		event.getRegistry().registerAll(
				new AluminumBlock().setRegistryName("aluminum_block").setTranslationKey(Investiture.MODID + "." + "aluminum_block"),
				new ZincBlock().setRegistryName("zinc_block").setTranslationKey(Investiture.MODID + "." + "zinc_block"),
				block = new BronzeBlock(),
				new BronzeStairs(block.getDefaultState()).setRegistryName("bronze_stairs").setTranslationKey(Investiture.MODID + "." + "bronze_stairs")
			);

with this as my constructor: 

public class BronzeStairs extends BlockStairs{
	
	public BronzeStairs(IBlockState modelState) {
		super(modelState);
		setCreativeTab(Investiture.INVESTITURE_TAB);
		setSoundType(SoundType.METAL);
		this.useNeighborBrightness = true;
	}
	
}

 

However, this continues to crash my game (according to my crash reports) as soon as I reach the event.getRegistry.registerAll statement.

Link to comment
Share on other sites

1 hour ago, OrangeySnicket said:

However, this continues to crash my game (according to my crash reports) as soon as I reach the event.getRegistry.registerAll statement.

Post the crash report. And also step through your registry method with your IDEs debugger to find out what's happening.

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.

Link to comment
Share on other sites

Quote

Can't use a null-name for the registry, object Block{minecraft:air}.

That seems pretty self explanatory to me. The only issue is that Block's toString method goes based on its registry entry, which failed, so it returns AIR. You have a block that doesn't have a registry name.

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

?‍♂️

 

Thanks... I feel really stupid. For whatever reason, I assumed that since I was only using block as a standin to give me a state, I didn't need to actually give it a registry name. Thank you all so, so much. Hopefully this understanding will transfer over nicely to slabs and I'll be able to work those out without incident. First, though, I need to get my textures working properly... Should be pretty easy. Seriously, so, so much thanks. 

Link to comment
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.
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 deposit 3000 adalah situs slot deposit 3000 via dana yang super gacor dimana para pemain dijamin garansi wd hari ini juga hanya dengan modal receh berupa deposit sebesar 3000 baik via dana, ovo, gopay maupun linkaja untuk para pemain pengguna e-wallet di seluruh Indonesia.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT 3000 ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • OLXTOTO: Menikmati Sensasi Bermain Togel dan Slot dengan Aman dan Mengasyikkan Dunia perjudian daring terus berkembang dengan cepat, dan salah satu situs yang telah menonjol dalam pasar adalah OLXTOTO. Sebagai platform resmi untuk permainan togel dan slot, OLXTOTO telah memenangkan kepercayaan banyak pemain dengan menyediakan pengalaman bermain yang aman, adil, dan mengasyikkan. DAFTAR OLXTOTO DISINI <a href="https://imgbb.com/"><img src="https://i.ibb.co/GnjSVpx/daftar1-480x480.webp" alt="daftar1-480x480" border="0" /></a> Keamanan Sebagai Prioritas Utama Salah satu aspek utama yang membuat OLXTOTO begitu menonjol adalah komitmennya terhadap keamanan pemain. Dengan menggunakan teknologi enkripsi terkini, situs ini memastikan bahwa semua informasi pribadi dan keuangan para pemain tetap aman dan terlindungi dari akses yang tidak sah. Beragam Permainan yang Menarik Di OLXTOTO, pemain dapat menemukan beragam permainan yang menarik untuk dinikmati. Mulai dari permainan klasik seperti togel hingga slot modern dengan fitur-fitur inovatif, ada sesuatu untuk setiap selera dan preferensi. Grafik yang memukau dan efek suara yang mengagumkan menambah keseruan setiap putaran. Peluang Menang yang Tinggi Salah satu hal yang paling menarik bagi para pemain adalah peluang menang yang tinggi yang ditawarkan oleh OLXTOTO. Dengan pembayaran yang adil dan peluang yang setara bagi semua pemain, setiap taruhan memberikan kesempatan nyata untuk memenangkan hadiah besar. Layanan Pelanggan yang Responsif Tim layanan pelanggan OLXTOTO siap membantu para pemain dengan setiap pertanyaan atau masalah yang mereka hadapi. Dengan layanan yang ramah dan responsif, pemain dapat yakin bahwa mereka akan mendapatkan bantuan yang mereka butuhkan dengan cepat dan efisien. Kesimpulan OLXTOTO telah membuktikan dirinya sebagai salah satu situs terbaik untuk penggemar togel dan slot online. Dengan fokus pada keamanan, beragam permainan yang menarik, peluang menang yang tinggi, dan layanan pelanggan yang luar biasa, tidak mengherankan bahwa situs ini telah menjadi pilihan utama bagi banyak pemain. Jadi, jika Anda mencari pengalaman bermain yang aman, adil, dan mengasyikkan, jangan ragu untuk bergabung dengan OLXTOTO hari ini dan rasakan sensasi kemenangan!
    • Slot deposit dana adalah situs slot deposit dana yang juga menerima dari e-wallet lain seperti deposit via dana, ovo, gopay & linkaja terlengkap saat ini, sehingga para pemain yang tidak memiliki rekening bank lokal bisa tetap bermain slot dan terbantu dengan adanya fitur tersebut.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT DANA ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • Slot deposit dana adalah situs slot deposit dana minimal 5000 yang dijamin garansi super gacor dan gampang menang, dimana para pemain yang tidak memiliki rekening bank lokal tetap dalam bermain slot dengan melakukan deposit dana serta e-wallet lainnya seperti ovo, gopay maupun linkaja lengkap. Agar para pecinta slot di seluruh Indonesia tetap dapat menikmati permainan tanpa halangan apapun khususnya metode deposit, dimana ketersediaan cara deposit saat ini yang lebih beragam tentunya sangat membantu para pecinta slot.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT DANA ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
    • Slot deposit pulsa adalah situs slot deposit pulsa tanpa potongan apapun yang dijamin garansi terpercaya, dimana kamu bisa bermain slot dengan melakukan deposit pulsa dan tanpa dikenakan potongan apapun sehingga dana yang masuk ke dalam akun akan 100% utuh. Proses penarikan dana juga dijamin gampang dan tidak sulit sehingga kamu tidak perlu khawatir akan kemenangan yang akan kamu peroleh dengan sangat mudah jika bermain disini.   DAFTAR & LOGIN AKUN PRO SLOT DEPOSIT PULSA TANPA POTONGAN ⭐⭐⭐ KLIK DISINI ⭐⭐⭐  
  • Topics

×
×
  • Create New...

Important Information

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