Class HordeRaidEvent

java.lang.Object
com.minecolonies.core.colony.events.raid.HordeRaidEvent
All Implemented Interfaces:
IColonyCampFireRaidEvent, IColonyEntitySpawnEvent, IColonyEvent, IColonyRaidEvent, IColonySpawnEvent, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Direct Known Subclasses:
AmazonRaidEvent, BarbarianRaidEvent, EgyptianRaidEvent, NorsemenRaidEvent, PirateGroundRaidEvent

public abstract class HordeRaidEvent extends Object implements IColonyRaidEvent, IColonyCampFireRaidEvent
Horde raid event for the colony, triggers a horde that spawn and attack the colony.
  • Field Details

    • MAX_SPAWN_DEVIATION

      public static int MAX_SPAWN_DEVIATION
      The max distance a barbarian is allowed to spawn from the original spawn position
    • MAX_RESPAWN_DEVIATION

      public static int MAX_RESPAWN_DEVIATION
      The max distance to search for a loaded blockpos on a respawn try
    • MIN_CENTER_DISTANCE

      public static int MIN_CENTER_DISTANCE
      The minimum distance to the colony center where mobs are allowed to spawn
    • horde

      protected Horde horde
      The amount of entities overall
    • raidBar

      protected final net.minecraft.server.level.ServerBossEvent raidBar
      The raids visual raidbar
    • normal

      protected Map<net.minecraft.world.entity.Entity,UUID> normal
      The references to living raiders left
    • archers

      protected Map<net.minecraft.world.entity.Entity,UUID> archers
    • boss

      protected Map<net.minecraft.world.entity.Entity,UUID> boss
    • status

      protected EventStatus status
      Status of the event
  • Constructor Details

    • HordeRaidEvent

      public HordeRaidEvent(IColony colony)
  • Method Details

    • setSpawnPoint

      public void setSpawnPoint(net.minecraft.core.BlockPos spawnPoint)
      Description copied from interface: IColonySpawnEvent
      Sets the spawn point
      Specified by:
      setSpawnPoint in interface IColonySpawnEvent
      Parameters:
      spawnPoint - the spawn point to set.
    • getSpawnPos

      public net.minecraft.core.BlockPos getSpawnPos()
      Description copied from interface: IColonySpawnEvent
      The position the event starts at
      Specified by:
      getSpawnPos in interface IColonySpawnEvent
      Returns:
      the spawn pos.
    • getEntities

      public List<net.minecraft.world.entity.Entity> getEntities()
      Description copied from interface: IColonyEntitySpawnEvent
      The list of entities related to this event
      Specified by:
      getEntities in interface IColonyEntitySpawnEvent
      Returns:
      the list.
    • getStatus

      public EventStatus getStatus()
      Description copied from interface: IColonyEvent
      Returns the events current status
      Specified by:
      getStatus in interface IColonyEvent
      Returns:
      the status.
    • setStatus

      public void setStatus(EventStatus status)
      Description copied from interface: IColonyEvent
      Sets the current event status
      Specified by:
      setStatus in interface IColonyEvent
      Parameters:
      status - the status to set.
    • getID

      public int getID()
      Description copied from interface: IColonyEvent
      Returns this events ID.
      Specified by:
      getID in interface IColonyEvent
      Returns:
      the event id.
    • setColony

      public void setColony(@NotNull @NotNull IColony colony)
      Description copied from interface: IColonyEvent
      Sets the colony
      Specified by:
      setColony in interface IColonyEvent
      Parameters:
      colony - the colony to set.
    • unregisterEntity

      public void unregisterEntity(net.minecraft.world.entity.Entity entity)
      Called when an entity is removed
      Specified by:
      unregisterEntity in interface IColonyEntitySpawnEvent
      Parameters:
      entity - the entity to unregister.
    • onEntityDeath

      public void onEntityDeath(net.minecraft.world.entity.LivingEntity entity)
      Description copied from interface: IColonyEntitySpawnEvent
      Trigger on entity death.
      Specified by:
      onEntityDeath in interface IColonyEntitySpawnEvent
      Parameters:
      entity - the killed entity.
    • spawnHorde

      protected void spawnHorde(net.minecraft.core.BlockPos spawnPos, IColony colony, int id, int numberOfBosses, int numberOfArchers, int numberOfRaiders)
      Spawn a specific horde.
      Parameters:
      spawnPos - the pos to spawn them at.
      colony - the colony to spawn them for.
      id - the raid event id.
      numberOfBosses - the bosses.
      numberOfArchers - the archers.
      numberOfRaiders - the normal raiders.
    • onFinish

      public void onFinish()
      Description copied from interface: IColonyEvent
      Actions which are done on the finish/removal of the event.
      Specified by:
      onFinish in interface IColonyEvent
    • onNightFall

      public void onNightFall()
      Description copied from interface: IColonyEvent
      Called on night fall, to execute special day-based logic.
      Specified by:
      onNightFall in interface IColonyEvent
    • setHorde

      public void setHorde(Horde horde)
    • getRandomCampfire

      public net.minecraft.core.BlockPos getRandomCampfire()
      Returns a random campfire
      Returns:
      a random campfire.
    • onStart

      public void onStart()
      Description copied from interface: IColonyEvent
      Actions which are done on the start of the event.
      Specified by:
      onStart in interface IColonyEvent
    • getColony

      public IColony getColony()
      Get the assigned colony.
      Returns:
      the colony.
    • updateRaidBar

      protected void updateRaidBar()
      Updates the raid bar
    • getDisplayName

      protected abstract net.minecraft.network.chat.MutableComponent getDisplayName()
      Gets the raids display name
      Returns:
    • onUpdate

      public void onUpdate()
      Description copied from interface: IColonyEvent
      Onupdate function, called every 25s / 500 ticks. Comes from colony then goes to the eventmanager and then to the event.
      Specified by:
      onUpdate in interface IColonyEvent
    • sendHordeMessage

      protected void sendHordeMessage()
      Sends the right horde message.
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      serializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • deserializeNBT

      public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
      Specified by:
      deserializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • setCampFireTime

      public void setCampFireTime(int time)
      Description copied from interface: IColonyCampFireRaidEvent
      Sets the intervals to wait before moving away from campfires.
      Specified by:
      setCampFireTime in interface IColonyCampFireRaidEvent
      Parameters:
      time - in MAX_TICK(25s) intervals
    • addSpawner

      public void addSpawner(net.minecraft.core.BlockPos pos)
      Description copied from interface: IColonyRaidEvent
      Add a spawner to an event.
      Specified by:
      addSpawner in interface IColonyRaidEvent
      Parameters:
      pos - the pos to add the spawner at.
    • getWayPoints

      public List<net.minecraft.core.BlockPos> getWayPoints()
      Description copied from interface: IColonyRaidEvent
      Gets the list of waypoints
      Specified by:
      getWayPoints in interface IColonyRaidEvent
    • setSpawnPath

      public void setSpawnPath(PathResult result)
      Set the pathing for this raids spawnpoint
      Parameters:
      result - pathing result to wait for