Fix dedicated dev server crash

This commit is contained in:
modmuss50 2021-08-25 20:05:23 +01:00
parent 077fc48468
commit 62e33f4127
3 changed files with 6 additions and 5 deletions
build.gradle
fabric-entity-events-v1
build.gradle
src/main/java/net/fabricmc/fabric/mixin/entity/event

View file

@ -19,7 +19,7 @@ plugins {
def ENV = System.getenv()
class Globals {
static def baseVersion = "0.39.1"
static def baseVersion = "0.39.2"
static def mcVersion = "1.17.1"
static def yarnVersion = "+build.1"
static def loaderVersion = "0.11.3"

View file

@ -1,5 +1,5 @@
archivesBaseName = "fabric-entity-events-v1"
version = getSubprojectVersion(project, "1.2.1")
version = getSubprojectVersion(project, "1.2.2")
moduleDependencies(project, [
'fabric-api-base'

View file

@ -24,6 +24,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Unit;
import net.minecraft.util.math.BlockPos;
@ -32,7 +33,7 @@ import net.minecraft.world.World;
import net.fabricmc.fabric.api.entity.event.v1.EntitySleepEvents;
@Mixin(PlayerEntity.class)
abstract class PlayerEntityMixin extends LivingEntityMixin {
abstract class PlayerEntityMixin {
@Inject(method = "trySleep", at = @At("HEAD"), cancellable = true)
private void onTrySleep(BlockPos pos, CallbackInfoReturnable<Either<PlayerEntity.SleepFailureReason, Unit>> info) {
PlayerEntity.SleepFailureReason failureReason = EntitySleepEvents.ALLOW_SLEEPING.invoker().allowSleep((PlayerEntity) (Object) this, pos);
@ -46,8 +47,8 @@ abstract class PlayerEntityMixin extends LivingEntityMixin {
private boolean redirectDaySleepCheck(World world) {
boolean day = world.isDay();
if (getSleepingPosition().isPresent()) {
BlockPos pos = getSleepingPosition().get();
if (((LivingEntity) (Object) this).getSleepingPosition().isPresent()) {
BlockPos pos = ((LivingEntity) (Object) this).getSleepingPosition().get();
ActionResult result = EntitySleepEvents.ALLOW_SLEEP_TIME.invoker().allowSleepTime((PlayerEntity) (Object) this, pos, !day);
if (result != ActionResult.PASS) {