Arphahat Posted January 27, 2013 Posted January 27, 2013 So, I think this is probably a pretty easy question, but I am still pretty new to messing around with MC modding. I am trying to open a portal using fire like a traditional obsidian portal. What do I need to detect? I think I should be able to do a check in the tickUpdate function like was being done in this thread and just check to see if the portal frame block has fire on it every certain number of ticks, but I am wondering if there is a better way? Quote
thebest108 Posted January 28, 2013 Posted January 28, 2013 Look into forge events, they should give you what you need Quote "you seem to be THE best modder I've seen imo." ~spynathan ლ(́◉◞౪◟◉‵ლ
Arphahat Posted January 28, 2013 Author Posted January 28, 2013 Look into forge events, they should give you what you need Thanks. Is there a centralized location where I could find all the events? Edit: I found this link: http://www.minecraftforge.net/wiki/Event_Reference But, at a glance, nothing here seems to be something that is triggered by fire on a block. Where do I need to look? Quote
Arphahat Posted January 28, 2013 Author Posted January 28, 2013 OK, I figured it out. I'll provide the details here for anyone else looking for this (most likely me from the future trying to remember how to do this. ) World.java has a routine called "notifyBlockOfNeighborChange". It is called for a number of reasons, like when a block is placed. One of these is when fire is next to a block. This routine calls the block's "onNeighborBlockChange" routine. So, in your block code, it is as easy as adding something like this: @Override public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { if (par5 == Block.fire.blockID) { // check to see if the fire is on top of block if (this.fireOnBlock()) { // check if this block is ignitable part of a portal frame. There are two per portal. if (this.ignitablePortalBlock()) { this.lightPoral(); } } } } Quote
Chibill Posted January 28, 2013 Posted January 28, 2013 I can use this in my mod thanks for sharing! Quote
Arphahat Posted January 28, 2013 Author Posted January 28, 2013 No problem! Hey, if you come up with, or already have, an optimized routine for the "ignitablePortalBlock" part, I'd be interested. The way it is right now, it only needs to check starting with assuming the block is one of the two in the base of the portal, but it still is going to take some thought to iterate through it properly. Quote
Recommended Posts
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.