Skip to content

Commit

Permalink
feat(event): FishingRodCastEvent.Pre
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Sep 17, 2022
1 parent 38fecf4 commit c4eb51d
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Expand Up @@ -7,6 +7,7 @@
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.FishingRodCastEvent;
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 @@ -19,13 +20,15 @@
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.protocol.handshake.ClientIntentionPacket;
import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket;
import net.minecraft.server.level.ServerLevel;
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.minecraft.world.level.Level;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;

Expand Down Expand Up @@ -82,4 +85,10 @@ public static double fireCatMorningGiftChanceEvent(Cat cat, Player ownerPlayer)
return event.getChance();
}

public static FishingRodCastEvent.Pre firePreFishingRodCastEvent(Player player, Level level, ItemStack fishingRod, int speedBonus, int luckBonus) {
var event = new FishingRodCastEvent.Pre((ServerPlayer) player, (ServerLevel) level, fishingRod, speedBonus, luckBonus);
BUS.post(event);
return event;
}

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

import org.auioc.mcmod.arnicalib.api.game.event.ServerPlayerEvent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;

public class FishingRodCastEvent extends ServerPlayerEvent {

private final ServerLevel level;
private final ItemStack fishingRod;

public FishingRodCastEvent(ServerPlayer player, ServerLevel level, ItemStack fishingRod) {
super(player);
this.level = level;
this.fishingRod = fishingRod;
}

public ServerLevel getLevel() {
return this.level;
}

public ItemStack getFishingRod() {
return this.fishingRod;
}

public static class Pre extends FishingRodCastEvent {

private int speedBonus;
private int luckBonus;

public Pre(ServerPlayer player, ServerLevel level, ItemStack fishingRod, int speedBonus, int luckBonus) {
super(player, level, fishingRod);
this.speedBonus = speedBonus;
this.luckBonus = luckBonus;
}

public int getSpeedBonus() {
return this.speedBonus;
}

public void setSpeedBonus(int speedBonus) {
this.speedBonus = speedBonus;
}

public int getLuckBonus() {
return this.luckBonus;
}

public void setLuckBonus(int luckBonus) {
this.luckBonus = luckBonus;
}

}

}

0 comments on commit c4eb51d

Please sign in to comment.