This commit is contained in:
DBotThePony 2022-10-01 12:01:41 +07:00
parent 70edbb58f5
commit acf568d6cc
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -12,6 +12,8 @@ import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.player.Player
import net.minecraftforge.client.event.RenderGuiEvent
import net.minecraftforge.client.event.RenderGuiOverlayEvent
import net.minecraftforge.client.event.RenderLevelLastEvent
import net.minecraftforge.client.event.RenderLevelStageEvent
import net.minecraftforge.client.event.ScreenEvent
import net.minecraftforge.client.gui.overlay.ForgeGui
import net.minecraftforge.client.gui.overlay.GuiOverlayManager
@ -34,7 +36,7 @@ object MatteryGUI {
private var lastState: MatteryPlayerCapability? = null
private val button_shaker = Random()
private val buttonShaker = Random()
fun onScreenRender(event: ScreenEvent.Render.Pre) {
val screen = minecraft.screen as? InBedChatScreen
@ -62,9 +64,9 @@ object MatteryGUI {
val dispersion = (10.0 * Math.max(0, it.ply.sleepTimer - 20) / (MatteryPlayerCapability.SLEEP_TICKS_LIMIT - 20)).toInt()
screen.leaveBedButton.x =
originalBedButtonX - dispersion / 2 + (button_shaker.nextDouble() * dispersion).toInt()
originalBedButtonX - dispersion / 2 + (buttonShaker.nextDouble() * dispersion).toInt()
screen.leaveBedButton.y =
originalBedButtonY - dispersion / 2 + (button_shaker.nextDouble() * dispersion).toInt()
originalBedButtonY - dispersion / 2 + (buttonShaker.nextDouble() * dispersion).toInt()
}
}