Class ShipBasedRaiderUtils

java.lang.Object
com.minecolonies.core.colony.events.raid.pirateEvent.ShipBasedRaiderUtils

public final class ShipBasedRaiderUtils extends Object
Utils for Colony pirate events
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Folder name for the pirate ship schematics
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    canPlaceShipAt(net.minecraft.core.BlockPos pos, com.ldtteam.structurize.blueprints.v1.Blueprint ship, net.minecraft.world.level.Level world)
    Checks whether the structure fits the position.
    static boolean
    canPlaceShipAt(net.minecraft.core.BlockPos pos, com.ldtteam.structurize.blueprints.v1.Blueprint ship, net.minecraft.world.level.Level world, int neededDepth)
    Checks whether the structure fits the position.
    static boolean
    canSpawnShipAt(IColony colony, net.minecraft.core.BlockPos spawnPoint, int raidLevel, com.ldtteam.structurize.api.RotationMirror rotMir, String shipName)
    Checks whether a pirate event is possible at this place.
    static boolean
    canSpawnShipAt(IColony colony, net.minecraft.core.BlockPos spawnPoint, int raidLevel, com.ldtteam.structurize.api.RotationMirror rotMir, String shipName, int neededDepth)
    Checks whether a pirate event is possible at this place.
    static net.minecraft.core.BlockPos
    chooseWaypointFor(List<net.minecraft.core.BlockPos> wayPoints, net.minecraft.core.BlockPos startPos, net.minecraft.core.BlockPos target)
    Chooses the next position to go to
    static List<net.minecraft.core.BlockPos>
    createWaypoints(net.minecraft.world.level.Level world, net.minecraft.world.level.pathfinder.Path path, int spacing)
    Creates a list of waypoints of a path
    static net.minecraft.core.BlockPos
    findSpawnPosOnShip(net.minecraft.core.BlockPos spawnPos, net.minecraft.world.level.Level world, int radius)
    Finds a spawnpoint for pirates on a ship
    static net.minecraft.core.BlockPos
    getLoadedPositionTowardsCenter(net.minecraft.core.BlockPos startPos, IColony colony, int maxDistance, net.minecraft.core.BlockPos maxDistancePos, int minDistance, int accuracy)
    Returns a loaded blockpos towards the colony center
    static net.minecraft.core.BlockPos
    getLoadedPositionTowardsCenter(net.minecraft.core.BlockPos startPos, IColony colony, int maxDistance, net.minecraft.core.BlockPos maxDistancePos, int minDistance, int accuracy, boolean underWater)
    Returns a loaded blockpos towards the colony center
    static boolean
    isSurfaceAreaMostlyMaterial(@NotNull List<Predicate<net.minecraft.world.level.block.state.BlockState>> materials, @NotNull net.minecraft.world.level.Level world, int baseY, @NotNull net.minecraft.core.BlockPos from, @NotNull net.minecraft.core.BlockPos to, double percentRequired)
    Returns true when most parts of the given area are water, more then 90%
    static void
    setupSpawner(net.minecraft.core.BlockPos location, net.minecraft.world.level.Level world, net.minecraft.world.entity.EntityType<?> mob, IColonyRaidEvent event, int colonyId)
    Setup a spawner.
    static boolean
    spawnPirateShip(net.minecraft.core.BlockPos targetSpawnPoint, IColony colony, com.ldtteam.structurize.blueprints.v1.Blueprint blueprint, IColonyRaidEvent event)
    Used to trigger a pirate event.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • spawnPirateShip

      public static boolean spawnPirateShip(net.minecraft.core.BlockPos targetSpawnPoint, IColony colony, com.ldtteam.structurize.blueprints.v1.Blueprint blueprint, IColonyRaidEvent event)
      Used to trigger a pirate event.
      Parameters:
      targetSpawnPoint - the target spawn point.
      colony - the target colony.
      blueprint - the ship blueprint.
      event - the raids event.
      Returns:
      true if successful.
    • setupSpawner

      public static void setupSpawner(net.minecraft.core.BlockPos location, net.minecraft.world.level.Level world, net.minecraft.world.entity.EntityType<?> mob, IColonyRaidEvent event, int colonyId)
      Setup a spawner.
      Parameters:
      location - the location to set it up at.
      world - the world to place it in.
      mob - the mob to spawn.
      event - the event.
      colonyId - the colony id.
    • canSpawnShipAt

      public static boolean canSpawnShipAt(IColony colony, net.minecraft.core.BlockPos spawnPoint, int raidLevel, com.ldtteam.structurize.api.RotationMirror rotMir, String shipName)
      Checks whether a pirate event is possible at this place.
      Parameters:
      colony - the colony.
      spawnPoint - the spawn point.
      raidLevel - the raid level.
      rotMir - the rotation and mirror.
      Returns:
      true if successful.
    • canSpawnShipAt

      public static boolean canSpawnShipAt(IColony colony, net.minecraft.core.BlockPos spawnPoint, int raidLevel, com.ldtteam.structurize.api.RotationMirror rotMir, String shipName, int neededDepth)
      Checks whether a pirate event is possible at this place.
      Parameters:
      colony - the colony.
      spawnPoint - the spawn point.
      raidLevel - the raid level.
      rotMir - the rotation mirror.
      neededDepth - the required depth.
      Returns:
      true if successful.
    • canPlaceShipAt

      public static boolean canPlaceShipAt(net.minecraft.core.BlockPos pos, com.ldtteam.structurize.blueprints.v1.Blueprint ship, net.minecraft.world.level.Level world)
      Checks whether the structure fits the position.
      Parameters:
      pos - the position to check
      ship - the ship structure to check
      world - the world to use
      Returns:
      true if ship fits
    • canPlaceShipAt

      public static boolean canPlaceShipAt(net.minecraft.core.BlockPos pos, com.ldtteam.structurize.blueprints.v1.Blueprint ship, net.minecraft.world.level.Level world, int neededDepth)
      Checks whether the structure fits the position.
      Parameters:
      pos - the position to check
      ship - the ship structure to check
      world - the world to use
      Returns:
      true if ship fits
    • isSurfaceAreaMostlyMaterial

      public static boolean isSurfaceAreaMostlyMaterial(@NotNull @NotNull List<Predicate<net.minecraft.world.level.block.state.BlockState>> materials, @NotNull @NotNull net.minecraft.world.level.Level world, int baseY, @NotNull @NotNull net.minecraft.core.BlockPos from, @NotNull @NotNull net.minecraft.core.BlockPos to, double percentRequired)
      Returns true when most parts of the given area are water, more then 90%
      Parameters:
      materials - the materials.
      world - Blockacces to use
      baseY - the base y pos.
      from - First corner of search rectangle
      to - Second corner of search rectangle
      percentRequired - the required percentage.
      Returns:
      true if enough water surface blocks are found
    • getLoadedPositionTowardsCenter

      public static net.minecraft.core.BlockPos getLoadedPositionTowardsCenter(net.minecraft.core.BlockPos startPos, IColony colony, int maxDistance, net.minecraft.core.BlockPos maxDistancePos, int minDistance, int accuracy)
      Returns a loaded blockpos towards the colony center
      Parameters:
      startPos - the start position
      colony - the colony to use
      maxDistance - the max distance to go
      maxDistancePos - the position from where to calc the max distance.
      minDistance - the min distance from colony center allowed
      accuracy - the accuracy of steps to check in percent, min 1.
      Returns:
      the position.
    • getLoadedPositionTowardsCenter

      public static net.minecraft.core.BlockPos getLoadedPositionTowardsCenter(net.minecraft.core.BlockPos startPos, IColony colony, int maxDistance, net.minecraft.core.BlockPos maxDistancePos, int minDistance, int accuracy, boolean underWater)
      Returns a loaded blockpos towards the colony center
      Parameters:
      startPos - the start position
      colony - the colony to use
      maxDistance - the max distance to go
      maxDistancePos - the position from where to calc the max distance.
      minDistance - the min distance from colony center allowed
      accuracy - the accuracy of steps to check in percent, min 1.
      underWater - if an underwater spawn pos is okay.
      Returns:
      the position.
    • findSpawnPosOnShip

      public static net.minecraft.core.BlockPos findSpawnPosOnShip(net.minecraft.core.BlockPos spawnPos, net.minecraft.world.level.Level world, int radius)
      Finds a spawnpoint for pirates on a ship
      Parameters:
      spawnPos - the ships spawnpoint
      world - the world
      radius - the radius to check for.
      Returns:
      the position.
    • createWaypoints

      public static List<net.minecraft.core.BlockPos> createWaypoints(net.minecraft.world.level.Level world, net.minecraft.world.level.pathfinder.Path path, int spacing)
      Creates a list of waypoints of a path
      Parameters:
      path -
      spacing - min distance between waypoints
      Returns:
      list of waypoints
    • chooseWaypointFor

      public static net.minecraft.core.BlockPos chooseWaypointFor(List<net.minecraft.core.BlockPos> wayPoints, net.minecraft.core.BlockPos startPos, net.minecraft.core.BlockPos target)
      Chooses the next position to go to
      Parameters:
      wayPoints - waypoints to compare
      startPos - the Position we're starting from
      target - original destination
      Returns:
      position to go to