-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update to Minecraft 1.21-1.21.1
- Loading branch information
1 parent
a938ea9
commit 506fe76
Showing
10 changed files
with
56 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ithub/steveplays28/stevesrealisticsleep/mixin/accessor/AbstractCauldronBlockAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.github.steveplays28.stevesrealisticsleep.mixin.accessor; | ||
|
||
import net.minecraft.block.AbstractCauldronBlock; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.server.world.ServerWorld; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.random.Random; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(AbstractCauldronBlock.class) | ||
public interface AbstractCauldronBlockAccessor { | ||
@Invoker | ||
void invokeScheduledTick(BlockState blockState, ServerWorld serverWorld, BlockPos blockPosition, Random random); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 15 additions & 7 deletions
22
...plays28/stevesrealisticsleep/neoforge/event/StevesRealisticSleepNeoForgeEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
package io.github.steveplays28.stevesrealisticsleep.neoforge.event; | ||
|
||
import io.github.steveplays28.stevesrealisticsleep.StevesRealisticSleep; | ||
import net.neoforged.bus.api.Event; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.neoforged.bus.api.SubscribeEvent; | ||
import net.neoforged.fml.common.Mod; | ||
import net.neoforged.neoforge.event.entity.player.SleepingTimeCheckEvent; | ||
import net.neoforged.fml.common.EventBusSubscriber; | ||
import net.neoforged.neoforge.event.entity.player.CanPlayerSleepEvent; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import static io.github.steveplays28.stevesrealisticsleep.StevesRealisticSleep.config; | ||
|
||
@Mod.EventBusSubscriber(modid = StevesRealisticSleep.MOD_ID) | ||
@EventBusSubscriber(modid = StevesRealisticSleep.MOD_ID) | ||
public class StevesRealisticSleepNeoForgeEventHandler { | ||
@SubscribeEvent | ||
public static void onSleepingTimeCheck(@NotNull SleepingTimeCheckEvent event) { | ||
if (config.allowDaySleeping) { | ||
event.setResult(Event.Result.ALLOW); | ||
public static void onCanPlayerSleep(@NotNull CanPlayerSleepEvent event) { | ||
if (!config.allowDaySleeping) { | ||
return; | ||
} | ||
|
||
@Nullable var vanillaProblem = event.getVanillaProblem(); | ||
if (vanillaProblem == null || !vanillaProblem.equals(PlayerEntity.SleepFailureReason.NOT_POSSIBLE_NOW)) { | ||
return; | ||
} | ||
|
||
event.setProblem(null); | ||
} | ||
} |
File renamed without changes.