Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mixin): CatMorningGiftChanceEvent
- Loading branch information
1 parent
e981694
commit 38fecf4
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/org/auioc/mcmod/arnicalib/mixin/server/MixinCatRelaxOnOwnerGoal.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,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); | ||
} | ||
|
||
} |
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