Skip to content

Commit

Permalink
feat(mixin): CatMorningGiftChanceEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Sep 17, 2022
1 parent e981694 commit 38fecf4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
@@ -0,0 +1,34 @@
package org.auioc.mcmod.arnicalib.mixin.server;

import javax.annotation.Nullable;
import org.auioc.mcmod.arnicalib.server.event.ServerEventFactory;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import net.minecraft.world.entity.animal.Cat;
import net.minecraft.world.entity.player.Player;

@Mixin(targets = "net.minecraft.world.entity.animal.Cat$CatRelaxOnOwnerGoal")
public class MixinCatRelaxOnOwnerGoal {

@Shadow
@Final
private Cat cat;

@Nullable
@Shadow
private Player ownerPlayer;

@ModifyConstant(
method = "Lnet/minecraft/world/entity/animal/Cat$CatRelaxOnOwnerGoal;stop()V",
constant = @Constant(doubleValue = 0.7D),
require = 1,
allow = 1
)
private double modifyConstant_stop(double title) {
return ServerEventFactory.fireCatMorningGiftChanceEvent(this.cat, this.ownerPlayer);
}

}
3 changes: 2 additions & 1 deletion src/main/resources/arnicalib.mixin.json
Expand Up @@ -16,7 +16,8 @@
"server.MixinServerPlayer",
"server.MixinLivingEntity",
"server.MixinEyeOfEnder",
"server.MixinEnderEyeItem"
"server.MixinEnderEyeItem",
"server.MixinCatRelaxOnOwnerGoal"
],
"client": [],
"server": [],
Expand Down

0 comments on commit 38fecf4

Please sign in to comment.