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:

  Reveal hidden contents

 

Posted (edited)
  On 3/24/2020 at 5:16 AM, DavidM said:

(check vanilla obsidian class)

Expand  

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

 

  On 3/24/2020 at 5:39 AM, Blazesword2008 said:

You mean like BlockObsidian?

Expand  

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
  On 3/24/2020 at 4:16 AM, 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 

Expand  

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
  On 3/24/2020 at 11:07 AM, Ugdhar said:

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

Expand  

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

Some tips:

  Reveal hidden contents

 

Posted
  On 3/24/2020 at 11:20 AM, 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

Expand  

 

  On 3/24/2020 at 11:07 AM, 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.

Expand  

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.