Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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?

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.

  • Author

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.

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.

  • Author

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.

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.

  • Author

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.