Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import crafttweaker.event.PlayerInteractBlockEvent;
- import crafttweaker.event.PlayerInteractEvent;
- import crafttweaker.world.IWorld;
- import crafttweaker.player.IPlayer;
- import crafttweaker.event.PlayerSleepInBedEvent;
- //This script will hopefully check whether the player has the Restful potion effect or if the weather is not clear, and prevent sleeping otherwise. I probably don't need all those imports but I really am not certain.
- /*Reference pages:
- https://docs.blamejared.com/1.12/en/#Vanilla/Events/Events/PlayerInteractBlock/#playerinteractblock
- https://docs.blamejared.com/1.12/en/#Vanilla/Events/Events/PlayerInteract/
- https://docs.blamejared.com/1.12/en/#Vanilla/World/IWorld/
- https://docs.blamejared.com/1.12/en/#Vanilla/Events/Events/PlayerSleepInBed/
- */
- //Should I be doing InteractBlockEvent? PlayerSleepInBed seems more appropriate but I don't see that it can access the world states?
- events.onPlayerInteractBlockEvent(function(event as crafttweaker.event.PlayerInteractEvent){
- if (world.isDaytime(false)) {
- if (world.isRaining(true) | world.isThundering(true) | player.activePotionEffects(/*????*/)) {
- //Then let sleep happen?
- }
- }
- if (world.isDayTime(true)) {
- event.cancel();
- }
- }
- );
- /*
- world:
- isRaining()
- isThundering()
- isDayTime()
- player:
- activePotionEffects(List<IPotionEffect>) <--- I have no idea whatsoever how the syntax for this works. The potion name is "simplytea.effect.restful" and the registry name is just "simplytea:restful"
- */
Advertisement
Add Comment
Please, Sign In to add comment