forked from GeyserMC/Geyser
		
	Fix flickering sky if time is too high (Closes #200)
This was caused because the max int size is 2,147,483,647, which is what Minecraft: Bedrock Edition uses in the time packet. In Minecraft: Java Edition, a long is used which has a max length of 9,223,372,036,854,775,807, thus causing the sky to bug out. This commit uses the modulus operator with the max time value per-day of 24,000 to retrieve the remainder.
This commit is contained in:
		
							parent
							
								
									e203cfd4a7
								
							
						
					
					
						commit
						16c9317a36
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -34,9 +34,9 @@ public class JavaUpdateTimeTranslator extends PacketTranslator<ServerUpdateTimeP | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void translate(ServerUpdateTimePacket packet, GeyserSession session) { |     public void translate(ServerUpdateTimePacket packet, GeyserSession session) { | ||||||
|  |         // https://minecraft.gamepedia.com/Day-night_cycle#24-hour_Minecraft_day | ||||||
|         SetTimePacket setTimePacket = new SetTimePacket(); |         SetTimePacket setTimePacket = new SetTimePacket(); | ||||||
|         setTimePacket.setTime((int) Math.abs(packet.getTime())); |         setTimePacket.setTime((int) Math.abs(packet.getTime()) % 24000); | ||||||
| 
 |  | ||||||
|         session.getUpstream().sendPacket(setTimePacket); |         session.getUpstream().sendPacket(setTimePacket); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue