Jump to content

[1.15.2] How to make a portal.


Blazesword2008

Recommended Posts

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 

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

  • 4 weeks later...

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
Link to comment
Share on other sites

  • 1 year later...

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.

 

 

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

    • I have the problem that when I have flares or blocks to build in my offhand, they seem to be assigned an NBT tag, so I can't stack them with other flares or blocks.  
    • Thank you that was this mod indeed, it tried to spawn a structure at spawn but since It was already generated he was not able to and so crashed the server lol. I was looking for mod during the pregen and added it just before the ram issue, thank you
    • I’m trying to make a mod that lets me put beacon beams through barrels for a mod pack I’m making but I don’t know what code to put and where to make this happen   (Forge 1.20.1)  
    • ---- Minecraft Crash Report ---- // My bad. Time: 2024-07-17 11:17:18 Description: Unexpected error java.lang.NullPointerException: Unexpected error     at com.google.common.collect.Iterators$6.transform(Iterators.java:829)     at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:52)     at net.minecraft.class_2370.remap(class_2370.java:744)     at net.minecraft.class_2370.unmap(class_2370.java:875)     at net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager.unmap(RegistrySyncManager.java:368)     at net.minecraft.class_310.handler$bma000$fabric-registry-sync-v0$disconnectAfter(class_310.java:11691)     at net.minecraft.class_310.method_18096(class_310.java:2269)     at net.minecraft.class_8673.method_10839(class_8673.java:319)     at net.minecraft.class_2535.method_10768(class_2535.java:673)     at net.minecraft.class_636.method_2927(class_636.java:290)     at net.minecraft.class_310.method_1574(class_310.java:1908)     at net.minecraft.class_310.method_1523(class_310.java:1246)     at net.minecraft.class_310.method_1514(class_310.java:882)     at net.minecraft.client.main.Main.main(Main.java:256)     at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)     at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)     at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at com.google.common.collect.Iterators$6.transform(Iterators.java:829)     at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:52)     at net.minecraft.class_2370.remap(class_2370.java:744)     at net.minecraft.class_2370.unmap(class_2370.java:875)     at net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager.unmap(RegistrySyncManager.java:368)     at net.minecraft.class_310.handler$bma000$fabric-registry-sync-v0$disconnectAfter(class_310.java:11691)     at net.minecraft.class_310.method_18096(class_310.java:2269)     at net.minecraft.class_8673.method_10839(class_8673.java:319)     at net.minecraft.class_2535.method_10768(class_2535.java:673)     at net.minecraft.class_636.method_2927(class_636.java:290) -- Uptime -- Details:     JVM uptime: 111.259s     Wall uptime: 70.335s     High-res time: 44.634s     Client ticks: 508 ticks / 25.400s Stacktrace:     at net.minecraft.class_310.method_1587(class_310.java:2501)     at net.minecraft.class_310.method_54580(class_310.java:949)     at net.minecraft.class_310.method_1514(class_310.java:905)     at net.minecraft.client.main.Main.main(Main.java:256)     at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)     at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)     at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) -- Last reload -- Details:     Reload number: 1     Reload reason: initial     Finished: Yes     Packs: vanilla, fabric, accessories, advanced-xray-fabric, appleskin, armoroftheages, auditory, balm-fabric, beautify, betterf3, betterthirdperson, biolith, bobby, bosses_of_mass_destruction, caffeineconfig, cardinal-components, cardinal-components-base, cardinal-components-block, cardinal-components-chunk, cardinal-components-entity, cardinal-components-item, cardinal-components-level, cardinal-components-scoreboard, cardinal-components-world, carryon, chipped, chunky, cinderscapes, cinderscapes-client, cinderscapes-common, cinderscapes-worldgen, cloth-config, comforts, conditional-mixin, cool_elytra, cratedelight, creativecore, creeperoverhaul, cristellib, croptopia, dramaticdoors, duckling, eatinganimationid, elytratrims, entity_texture_features, epherolib, explorerscompass, fabric-api, fabric-api-base, fabric-api-lookup-api-v1, fabric-biome-api-v1, fabric-block-api-v1, fabric-block-view-api-v2, fabric-blockrenderlayer-v1, fabric-client-tags-api-v1, fabric-command-api-v1, fabric-command-api-v2, fabric-commands-v0, fabric-content-registries-v0, fabric-convention-tags-v1, fabric-convention-tags-v2, fabric-crash-report-info-v1, fabric-data-attachment-api-v1, fabric-data-generation-api-v1, fabric-dimensions-v1, fabric-entity-events-v1, fabric-events-interaction-v0, fabric-game-rule-api-v1, fabric-item-api-v1, fabric-item-group-api-v1, fabric-key-binding-api-v1, fabric-keybindings-v0, fabric-language-kotlin, fabric-lifecycle-events-v1, fabric-loot-api-v2, fabric-loot-api-v3, fabric-message-api-v1, fabric-model-loading-api-v1, fabric-networking-api-v1, fabric-object-builder-api-v1, fabric-particles-v1, fabric-recipe-api-v1, fabric-registry-sync-v0, fabric-renderer-api-v1, fabric-renderer-indigo, fabric-renderer-registries-v1, fabric-rendering-data-attachment-v1, fabric-rendering-fluids-v1, fabric-rendering-v0, fabric-rendering-v1, fabric-resource-conditions-api-v1, fabric-resource-loader-v0, fabric-screen-api-v1, fabric-screen-handler-api-v1, fabric-sound-api-v1, fabric-transfer-api-v1, fabric-transitive-access-wideners-v1, fabricloader, forf, freecam, friendsandfoes, geocluster, glassential, glore, grassoverhaul, horizontal_glass_panes, infinity-cave, iris, jade, jamlib, jankson, libgui, mavapi, mavm, medieval_buildings, mes, midnightlib, mns, more_armor_trims, mostructures, mr_dungeons_andtavernsdeserttempleoverhaul, mr_dungeons_andtavernsendcastlestandalone, mr_dungeons_andtavernsjungletempleoverhaul, mr_dungeons_andtavernsnetherfortressoverhaul, mr_dungeons_andtavernsoceanmonumentoverhaul, mr_dungeons_andtavernswoodlandmansionoverhaul, mss, mvs, natures_spirit, necronomicon, new_slab_variants, nicer-skies, noisium, notenoughanimations, polymer-core, polymer-resource-pack, resourcefulconfig, simple_backpack, sodium, sodium-extra, sound_physics_remastered, spectrelib, status-effect-bars, stendhal, sulfurpotassiummod, terraform-biome-remapper-api-v1, terraform-shapes-api-v1, terraform-surfaces-api-v1, terraform-wood-api-v1, the_bumblezone, time_on_display, toggleableitemframes, toomanypaintings, travelersbackpack, trimeffects, universal-graves, utility_belt, variantbarrels, variantbeehives, variantbookshelves, variantcomposters, variantsandventures, visuality, waterframes, waxablecoral, waystones, xaerominimap, xaeroworldmap, yet_another_config_lib_v3, zoomify, minecraft:supporteatinganimation, file/Stay_True_1.21.zip, file/Better Cats v2.0 1.21.zip, file/Better Horses v2.0 1.21.zip, file/Torrezx-Bad_omen.zip, file/Torrezx-Sculk_power.zip, file/Torrezx-Warden_Power.zip, file/Torrezx-Heavy_core_tools.zip, file/waystones_1.21.zip  
    • Maybe an issue with spawnstructures_forge
  • Topics

×
×
  • Create New...

Important Information

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