Skip to content

Commit

Permalink
Fix cats not dropping gifts after sleeping (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveplays28 committed Dec 4, 2024
1 parent 927f7b6 commit 226e14c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.github.steveplays28.stevesrealisticsleep.mixin.entity;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(targets = "net/minecraft/entity/passive/CatEntity$SleepWithOwnerGoal")
public class CatEntityMixin {
@Unique
private static final float stevesrealisticsleep$ALLOWED_SKY_ANGLE_FOR_GIFT_DROPS = 0.78f;

@ModifyExpressionValue(method = "stop", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getSkyAngle(F)F"))
private float stevesrealisticsleep$preventUseOfSkyAngleForGiftDrops(float original) {
return stevesrealisticsleep$ALLOWED_SKY_ANGLE_FOR_GIFT_DROPS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"ServerWorldMixin",
"SleepManagerMixin",
"accessor.AbstractCauldronBlockAccessor",
"accessor.ServerWorldAccessor"
"accessor.ServerWorldAccessor",
"entity.CatEntityMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 226e14c

Please sign in to comment.