Jump to content

Recommended Posts

Posted

I'd like to learn how to make a portal block for 1.15.2 for a custom dimension you create. I would also like to know in addition how to make an Item that lets you spawn the portal when you right click on the frame. I want this portal to be like the nether portal.

 

I would really like if you could help. Thanks! :D 

Posted

You might want to look at how vanilla handles the portal (check vanilla obsidian class).

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted (edited)
5 hours ago, DavidM said:

(check vanilla obsidian class)

There is no class for the Obsidian block, it is just an instance of the Block class.

 

5 hours ago, Blazesword2008 said:

You mean like BlockObsidian?

There is no BlockObsidian class, and block classes are named <NAME>Block, i.e. it would be called ObsidianBlock (if it existed).

 

As far as I can tell, if a block is part of the portal frame is determined in the IForgeBlock isPortalFrame method which returns true if the passed blockstate is Obsidian.

 

I'm not actively trying to create a portal myself, but if I were that's pretty much where I'd get started. Also be sure to look at the Teleporter class.

Edited by Ugdhar
Posted
7 hours ago, Blazesword2008 said:

I'd like to learn how to make a portal block for 1.15.2 for a custom dimension you create. I would also like to know in addition how to make an Item that lets you spawn the portal when you right click on the frame. I want this portal to be like the nether portal.

 

I would really like if you could help. Thanks! :D 

First try to read vanilla tile entity of a target model/example (So EnderPortalBlock tile entity or the tile entity of a NetherPortalBlock). Hope this will help you. Else you can extends of the two classes and just override some methods and functions

New in Modding? == Still learning!

Posted
1 hour ago, Ugdhar said:

There is no class for the Obsidian block, it is just an instance of the Block class.

My bad. Don't know where I got that from.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted
1 hour ago, DragonITA said:

First try to read vanilla tile entity of a target model/example (So EnderPortalBlock tile entity or the tile entity of a NetherPortalBlock). Hope this will help you. Else you can extends of the two classes and just override some methods and functions

 

2 hours ago, Ugdhar said:

There is no class for the Obsidian block, it is just an instance of the Block class.

 

There is no BlockObsidian class, and block classes are named <NAME>Block, i.e. it would be called ObsidianBlock (if it existed).

 

As far as I can tell, if a block is part of the portal frame is determined in the IForgeBlock isPortalFrame method which returns true if the passed blockstate is Obsidian.

 

I'm not actively trying to create a portal myself, but if I were that's pretty much where I'd get started. Also be sure to look at the Teleporter class.

Okay, I'll get back you guys on if I get it working. Thanks for the help!

  • 4 weeks later...
Posted (edited)

I am actually curious about the answer to this as well.

 

As far as building a portal and using the vanilla classes to help for 1.15.2, I have found the following vanilla classes:

FlintAndSteelitem.java

NetherPortalBlock.java

Teleporter.java

 

and possibly the tile-entity classes for the end dimension but they don't have the same mechanics as the nether. At this point I'm just curious where the vanilla code is for teleporting from nether to overworld is. The teleport class really only has methods for building the portal and correctly positioning the player it seems.

 

I'm not an expert in Minecraft modding but I've been looking online for any sort of documentation on this and could only find this thread on forge. I have a dimension created and all it's missing is the portal. Hopefully it's an easy fix!

 

Edited by vandy2424
  • 1 year later...
Posted

While the OP may have moved on from this topic... I have been pursuing this same goal for 1.16.5

I have been searching the Vanilla Library and came across the net.minecraft.block.AbstractFireBlock#onPlace method. This is where nether portal activation occurs, and gives sample code to achieving your own.

My intent was to implement a nether portal using crying obsidian, rather than obsidian. I did this by 1) cancelling the PortalSpawnEvent (which is called in net.minecraft.blocks.AbstractFireBlock#onPlace) and then 2) Copying the net.minecraft.block.PortalSize class over to my own. Then changing the AbstractBlock.IPositionPredicate FRAME instance variable to check that the block is Crying obsidian. I would have liked to not copy, but the vanilla code offers a private method isPortalFrame in one of the block classes that only returns true for obsidian.

For anyone making a custom portal for a custom dimension, I would recommend making your own PortalFrame block similar to the vanilla nether portal frame class, then replacing all nether portal frame references in the PortalSize class to your new block.

 

 

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.