Skip to content

Commit

Permalink
feat(event): CatMorningGiftChanceEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Sep 17, 2022
1 parent 0b3b77d commit e981694
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Expand Up @@ -6,6 +6,7 @@
import java.util.UUID;
import java.util.function.Function;
import org.apache.logging.log4j.Marker;
import org.auioc.mcmod.arnicalib.server.event.impl.CatMorningGiftChanceEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.LivingEatAddEffectEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.PiglinStanceEvent;
import org.auioc.mcmod.arnicalib.server.event.impl.ServerLoginEvent;
Expand All @@ -21,6 +22,8 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.animal.Cat;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.EyeOfEnder;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
Expand Down Expand Up @@ -73,4 +76,10 @@ public static PiglinStanceEvent.Stance firePiglinStanceEvent(LivingEntity target
return event.getStance();
}

public static double fireCatMorningGiftChanceEvent(Cat cat, Player ownerPlayer) {
var event = new CatMorningGiftChanceEvent(cat, ownerPlayer);
BUS.post(event);
return event.getChance();
}

}
@@ -0,0 +1,35 @@
package org.auioc.mcmod.arnicalib.server.event.impl;

import net.minecraft.world.entity.animal.Cat;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.event.entity.living.LivingEvent;

public class CatMorningGiftChanceEvent extends LivingEvent {

private final Cat cat;
private final Player ownerPlayer;
private double chance = 0.7D;

public CatMorningGiftChanceEvent(Cat cat, Player ownerPlayer) {
super(cat);
this.cat = cat;
this.ownerPlayer = ownerPlayer;
}

public Cat getCat() {
return this.cat;
}

public Player getOwnerPlayer() {
return this.ownerPlayer;
}

public double getChance() {
return this.chance;
}

public void setChance(double chance) {
this.chance = chance;
}

}

0 comments on commit e981694

Please sign in to comment.