Class AbstractShipRaidEvent

java.lang.Object
com.minecolonies.core.colony.events.raid.AbstractShipRaidEvent
All Implemented Interfaces:
IColonyEntitySpawnEvent, IColonyEvent, IColonyRaidEvent, IColonySpawnEvent, IColonyStructureSpawnEvent, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Direct Known Subclasses:
DrownedPirateRaidEvent, NorsemenShipRaidEvent, PirateRaidEvent

public abstract class AbstractShipRaidEvent extends Object implements IColonyRaidEvent, IColonyStructureSpawnEvent
The Ship based raid event, spawns a ship with raider spawners onboard.
  • Field Details

    • WAYPOINT_SPACING

      protected static final int WAYPOINT_SPACING
      Spacing between waypoints
      See Also:
    • TAG_DAYS_LEFT

      public static final String TAG_DAYS_LEFT
      NBT Tags
      See Also:
    • TAG_SPAWNER_COUNT

      public static final String TAG_SPAWNER_COUNT
      See Also:
    • TAG_POS

      public static final String TAG_POS
      See Also:
    • TAG_SPAWNERS

      public static final String TAG_SPAWNERS
      See Also:
    • TAG_SHIPSIZE

      public static final String TAG_SHIPSIZE
      See Also:
    • TAG_SHIP_ROTMIR

      public static final String TAG_SHIP_ROTMIR
      See Also:
    • TAG_RAIDER_THRESHOLD_TRACKER

      public static final String TAG_RAIDER_THRESHOLD_TRACKER
      See Also:
    • TAG_MAX_RAIDER_COUNT

      public static final String TAG_MAX_RAIDER_COUNT
      See Also:
    • status

      protected EventStatus status
      The current raidstatus
    • raidBar

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

      protected IColony colony
      The associated colony
    • spawnPoint

      protected net.minecraft.core.BlockPos spawnPoint
      The ships spawnpoint
    • shipSize

      protected ShipSize shipSize
      The events shipsize
    • raiders

      protected Map<net.minecraft.world.entity.Entity,UUID> raiders
      Reference to the currently active pirates for this event.
    • shipRotationMirror

      protected com.ldtteam.structurize.api.RotationMirror shipRotationMirror
      Rotation of the ship to spawn
    • spawnPathResult

      protected PathResult spawnPathResult
      The path result towards the intended spawn point
    • wayPoints

      protected List<net.minecraft.core.BlockPos> wayPoints
      Waypoints helping raiders travel
    • maxRaiderCount

      protected int maxRaiderCount
      Max raider count.
    • spawnerThresholdKillTracker

      protected int spawnerThresholdKillTracker
      Raider kill count.
  • Constructor Details

    • AbstractShipRaidEvent

      public AbstractShipRaidEvent(@NotNull @NotNull IColony colony)
      Create a new ship based raid event.
      Parameters:
      colony - the colony.
  • Method Details

    • 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
    • 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
    • isUnderWater

      public boolean isUnderWater()
      If this is an underwater ship based event.
      Returns:
      true if so.
    • 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
    • onTileEntityBreak

      public void onTileEntityBreak(net.minecraft.world.level.block.entity.BlockEntity te)
      Description copied from interface: IColonyEvent
      Called by tileentities relevant to the event on invalidation.
      Specified by:
      onTileEntityBreak in interface IColonyEvent
      Parameters:
      te - the broken Tile entity.
    • 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
    • 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.
    • registerEntity

      public void registerEntity(net.minecraft.world.entity.Entity entity)
      Description copied from interface: IColonyEntitySpawnEvent
      Called to register an entity with this event
      Specified by:
      registerEntity in interface IColonyEntitySpawnEvent
      Parameters:
      entity - the entity to register.
    • 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.
    • setShipSize

      public void setShipSize(ShipSize shipSize)
      Sets the ship size for this event.
      Parameters:
      shipSize - the ship size.
    • setShipRotation

      public void setShipRotation(com.ldtteam.structurize.api.RotationMirror shipRotationMirror)
      Sets the ships rotation
      Parameters:
      shipRotationMirror - the ship rotation.
    • 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.
    • 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.
    • getSchematicSpawns

      public List<Tuple<String,net.minecraft.core.BlockPos>> getSchematicSpawns()
      Description copied from interface: IColonyStructureSpawnEvent
      Returns the list of used schematics and their positions. The string should be the full path to the schematic file.
      Specified by:
      getSchematicSpawns in interface IColonyStructureSpawnEvent
      Returns:
      list of schematics
    • 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>
    • 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
    • isRaidActive

      public boolean isRaidActive()
      Description copied from interface: IColonyRaidEvent
      Whether or not the raid is still active.
      Specified by:
      isRaidActive in interface IColonyRaidEvent
      Returns:
      true if so.
    • setMaxRaiderCount

      public void setMaxRaiderCount(int maxRaiderCount)
      Description copied from interface: IColonyStructureSpawnEvent
      Set the max raider count.
      Specified by:
      setMaxRaiderCount in interface IColonyStructureSpawnEvent
      Parameters:
      maxRaiderCount - the count.