Переопределение EntityPlayer.onUpdate()

Версия Minecraft
1.12.2
API
Forge
11
0
Хеллоу всем форумчанам! Мне захотелось изменить механику сна. Вот покопался и нашел в EntityPlayer.onUpdate() воть такое:
EntityPlayer.onUpdate():
    /**
     * Called to update the entity's position/logic.
     */
    public void onUpdate()
    {
        // ... Some code before
        
        if (this.isPlayerSleeping())
        {
            ++this.sleepTimer;

            if (this.sleepTimer > 100)
            {
                this.sleepTimer = 100;
            }

            if (!this.world.isRemote)
            {
                if (!this.isInBed())
                {
                    this.wakeUpPlayer(true, true, false);
                }
                else if (this.world.isDaytime())
                {
                    this.wakeUpPlayer(false, true, true);
                }
            }
        }
        else if (this.sleepTimer > 0)
        {
            ++this.sleepTimer;

            if (this.sleepTimer >= 110)
            {
                this.sleepTimer = 0;
            }
        }

        // ... Some code after
    }
Именно this.wakeUpPlayer(false, true, true); , как я понимаю, позволяет проснуться. Ну и допустим я хочу чтобы сон был бесконечным, и он не просыпался. Нужно отменить выполнение вот этого:
EntityPlayer.onUpdate():
else if (this.world.isDaytime()) {
    this.wakeUpPlayer(false, true, true);
}
:unsure: И как же его отменять? Можно бы было унаследоваться от класса игрока и переопределить onUpdate() метод. В нем не вызывать super.onUpdate(), вместо этого скопировать код из майна, и заменить там что нужно. Но как потом заменить того игрока из майна на того что мы создали? Я не знаю. Короче, вопрос: как переопределить вообще что угодно в различных методах а потом все это применить в игру?
 

sk9zist :l

Исправился
981
18
157

sk9zist :l

Исправился
981
18
157
Если не знаешь, это не так сложно.
 
11
0
¯\(ツ)
Можешь посмотреть что там в wolrd#isDaytime()
World#isDaytime():
/**
    * Checks whether its daytime by seeing if the light subtracted from the skylight is less than 4
*/
public boolean isDaytime() {
    return this.provider.isDaytime();
}
:unsure: Хмм... Посмотрел. Не думаю, что это мне как-то поможет...
Угу, ясно...
 

sk9zist :l

Исправился
981
18
157
Сверху