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

I have a dynamic light system that not requires pakets(thanks to diesieben07), but there is something wrong with it.

I have two types of light: "Under the player" and "Where the player is looking at".

The underplayer one works like a charm, but the otherone not so well.

 

The problem is in client side its OK, but on server side other player see the light under me and not where im looking at.

The player who is crating the light always see the light in a correct pos. Only others not.

The problem occourns when the player raytrace is hitting a block. When its not others see the light correctly.

I read it a problem with raytrace that its only client sided, but then i read there is another method via look vectors for both side.

So i made the following:

 

THIS CODE IS ONLY FOR TESTING

 

LightHandler(PlayerTickHandler):

http://pastebin.com/QcCUzykc

 

ExtendedPlayerProperties(Only the raytrace part):

http://pastebin.com/uanxRjQB

 

Thanks for helping me!

Don't know if this is the problem, but on this line:

if(props.getRayTraceX(distance) != props.getLastPosX2() || props.getRayTraceY(distance) != props.getLastPosY2(){

You don't check for the Z coord. Maybe that's intended, but i may just point it out.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Hi

 

I don't understand how your code is supposed to work.

 

I think you might be confusing "server side" with other clients.  There doesn't need to be any raytracing on the server, unless you want your server to raytrace each player's line of sight and send the resulting location to all other clients using packets or IExtendedProperties, which seems unnecessary to me.

 

What I think you should be doing is performing your raytracing on the client for each of the other players.  The server has nothing to do with it, except that it communicates between the clients to tell where the other players are looking, which it does already.

 

If you want to stick with the server doing the ray tracing, I suggest you add a few System.out.println statements to your server calculations to se if they're working correctly and narrow down where the problem is.

 

-TGG

 

 

  • Author

Hi there

 

So my code is supposed to create the light without pakets to not raise the network usage! So the light is crated client side.

Even if another player is emitting the light its created by your client. And that realy helps to raise the performance of the dynamic lighting. And i have to use that anyway because in 1.7.10 you cannot create light server side anymore.

 

Im using PlayerTickHander and i need ExtendedPlayerProperties because all player is getting the data from the same PlayerTickHander class and if i store data there it becomes realy messed up.

So i need diferent values for each player.

 

I tracked down whats the problem and its that line in my getRayTrace methods:

		
MovingObjectPosition mop = player.worldObj.rayTraceBlocks(pos, addedlook);
if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK)
return mop.blockXYZ;

 

Without that other do see he light correctly but than the light can be in a block because i don't check for block hit.

For some reason the code above only gets data for the client.

 

I do some printLn debug and this is what i get:

Client side , no other player: Correct pos!

Client side, with other player: Correct and bad pos at the same time!

Server side: Always bad pos!

 

I will play around with it a bit more, but if you have any idea please tell me! Thanks!

 

 

 

  • Author

Thank you so much! The fix is to add the player eye height to the yCoord and BOOM. Its working!!!

 

Funny that appears to be a recent fix.  I first noticed that discrepancy in 1.6.2 about a year ago and wondered why on earth it was like that. 

 

-TGG

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.