Jump to content

Recommended Posts

Posted (edited)

Hello. Basically I maded an item that basically is lantern. I wanna ask if you know a way to make a dynamic light, a light that follows the player only if the lantern is in the main or in the second hand.

How can I do that without using the api from Dynamic Lights?

Thank you

Edited by cinsiian
Posted
Posted (edited)

Well, you haven't actually... you know... write the "block disappear" part.
 

Moreover, your isTimerEnded does nothing as of now; you are not checking it at all. Besides, whether the timer has ended can be determined by a simple

timer <= 0

instead of creating a new variable.

Edited by DavidM

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.

 

 

Posted

Doing lighting like this is very performance intensive. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Find a better way to do it than you’re doing it now. I would try and do it with

1) OptiFine/DynamicLights integration

2) A shader

3) Placing blocks every second or half second and always having a maximum of 1 lighting block around per lantern. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
2 minutes ago, Cadiboo said:

Placing blocks every second or half second and always having a maximum of 1 lighting block around per lantern. 

I am kinda doing that with my code, if a player is not moving, the game will not replace the block but i have some issues with my tile entity that i cant figure out.

Posted
5 hours ago, DavidM said:

Well, you haven't actually... you know... write the "block disappear" part.
 

Moreover, your isTimerEnded does nothing as of now; you are not checking it at all. Besides, whether the timer has ended can be determined by a simple


timer <= 0

instead of creating a new variable.

Well, I removed the boolean and added the function. Keeps not working.

https://github.com/cinsiian/MiningFeelings/blob/master/src/main/java/com/cinsiian/miningFeelings/block/tileEntity/LanternLightTileEntity.java

Posted

This is old, old code (circa 1.7.10 originally, updated to work with 1.10), but this will handle the light source, as a block, utilizing as few updates as possible. Any data stored in the ItemStack NBT should be changed to use a capability, but that's all the necessary information.

 

https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/components/ComponentLight.java#L63-L126

 

"That's not an Item!" you say.
"Doesn't fucking matter, its the same function signature that does exist in Item"

You'll just have to figure out what that function looks like now.

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.