Jump to content

Recommended Posts

Posted

New guy here. I made my first mod, FlameIgnitions, it's still in very early development but it's posted to Github. Yes, I know there are issues with it, mainly that the wooden lighter doesn't use an event to light TNT (causing strangeness, I'll fix it later).

 

Since this is a hardcore mod, one of the things I want to add is lava burning things from a distance. I want to have it burn everything (animals, players, flammable blocks) within a certain sphere around it (about 4 blocks). But I don't know any way of doing this. Any ideas?

Posted

I would be interested in this as well.  What I'm doing at the moment (which doesn't set things on fire, but spawn a "smoke" liquid) is randomly look at blocks near a player and if its lava, do something.

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.

Posted

I don't know if this will work, but you can subscribe to the PlaceEvent. If it's a lava block, then save the BlockPos somewhere, and then later in a WorldTickEvent if the position is still valid, iterate in a sphere around the position and burn whatever up.

 

I'm not sure if the PlaceEvent works with generated lava however.

 

Maybe subscribe to one of the chunk population events?

BEFORE ASKING FOR HELP READ THE EAQ!

 

I'll help if I can. Apologies if I do something obviously stupid. :D

 

If you don't know basic Java yet, go and follow these tutorials.

Posted

WorldServer#pendingTickListEntriesThisTick is a collection of all pending blocks needing updating, calling Block#updateTick on each one as their time comes. Now, this may not help directly, since the collection is cleared each time and there is no hook at any time during the process, but there is WorldServer#getPendingBlockUpdates(Chunk, boolean) which could give you what you need. I've never tried messing with it myself, so I can't say for sure.

 

Alternatively, you could use ASM to patch Block#updateTick to fire an event, which you could then listen for and, if it's lava, check the surrounding area, preferably not too often.

Posted
Alternatively, you could use ASM to patch Block#updateTick to fire an event, which you could then listen for and, if it's lava, check the surrounding area, preferably not too often.

 

I was actually looking at ASM about two hours ago for another problem (making crops tick less often) and arrived at the conclusion that ASM is way too advanced for my britches.  I mean, I literally want to change "return 10" to "return 100" and I have no idea HTF to do that.

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.

Posted

Or as I just said to a friend,

 

"I looked at ASM this evening and ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn."

width=100 height=100http://s10.postimg.org/yawll0uad/back_eyed_loaf2.png[/img]

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.

Posted

OH GOD! Bytecode now?

 

Also, from a performance in modpacks standpoint, some mods have large lava lakes and volcanoes, which could overload your computer. So I don't know how bad it would be to have it run every tick (since 20 ticks = 1 sec). Is there anyway I can count the ticks and have it run every, say, half second?

Posted

Every tick would be bad.  You'd want something more like every 1000 ticks.

Which will probably be "every tick, if random(1000) == 0, doSomething()."

 

As for mods that add large lava lakes, test your code out in the Nether.  I took my smoke generation code down there and found it was very poor, performance wise.  But I'll admit that was due to the fact that I was telling the game to spawn a ton of liquid blocks that then had to float up to the ceiling....

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.

Posted

Might want to hash the blocks' position so they don't all run at the same time. ;)

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.

Posted

ASM

 

Programming Sucks at a high level of abstraction enough.  Having to think in single-byte instructions is maddening.

 

Two freaking days to write 11 lines of code that insert 2 lines (in regular Java) into BlockCrops.

 

#NeverAgain

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.

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.