Jump to content

Recommended Posts

Posted

Hey guys,

 

Im trying to make a set of tools that actually give off light while they are in your hand but after looking around trying to see if it was even possible I didn't come up with anything. Does anyone know if this is possible and if so could you point me in the right direction?

Posted

I did this.  The way I did it is not...very clean but it works.

 

Essentially check during the item's onUpdate call to see if it's the current item (I did all the time, even when dropped, but this is what you're looking for).

Then if so, spawn at the player's head (if air) a block that has the following properties:

 

1) Emits Light

2) Material.air

3) Resistance and Hardness 0

4) getCollisionBoundingBoxFromPool returns null

5) collisionRayTrace returns null

6) shouldSideBeRendered, isOpaqueCube, renderAsNormalBlock returns false

 

Mind that placing and removing a light-emitting block is laggy if you do it all the time (lighting updates) so you'll want to use your item's ItemStack stackTagCompound to store both WHERE you placed the light (so you can remove it) and WHEN (so you can count up/down towards the next time you'll place a light block).

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

Hmmm seems like it would cause lag not sure if its worth adding the glow if its gonna lag much. Adding this mod to a 94 mod modpack so lag is a very big problem. I may try it and see its impact but this definitely is not a smooth feature.

Posted

I get around it by not updating the light block every tick, but rather every 3.5 blocks between where the light SHOULD be and where it IS.

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

what about shaders or a client side only method?

 

"Magic spells has a spell called lightwalk and server side only it places glowstone under your feet an makes the torch give off light while in hand client side." -Rainfey

 

or do they use the same method as you? (havent looked at there code yet was just told this he thinks they use shaders or client side only.)

 

Just trying to find a plausabile method that doesn't cause much lag.

Posted

You can do it client side only, Dynamic Lights does, but I don't know how to go about doing 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

ok well from talking here and with a few other devs it sounds like though it is possible there isnt a "clean" method of doing it so i guess i will hold off till the main features of the mod is done and I actually have some time to create this effect

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.