Class ShipBasedRaiderUtils
java.lang.Object
com.minecolonies.core.colony.events.raid.pirateEvent.ShipBasedRaiderUtils
Utils for Colony pirate events
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanPlaceShipAt(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 booleancanPlaceShipAt(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 booleancanSpawnShipAt(IColony colony, net.minecraft.core.BlockPos spawnPoint, int raidLevel, int rotation, String shipName) Checks whether a pirate event is possible at this place.static booleancanSpawnShipAt(IColony colony, net.minecraft.core.BlockPos spawnPoint, int raidLevel, int rotation, String shipName, int neededDepth) Checks whether a pirate event is possible at this place.static net.minecraft.core.BlockPoschooseWaypointFor(List<net.minecraft.core.BlockPos> wayPoints, net.minecraft.core.BlockPos startPos, net.minecraft.core.BlockPos target) Chooses the next position to go tostatic 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 pathstatic net.minecraft.core.BlockPosfindSpawnPosOnShip(net.minecraft.core.BlockPos spawnPos, net.minecraft.world.level.Level world, int radius) Finds a spawnpoint for pirates on a shipstatic net.minecraft.core.BlockPosgetLoadedPositionTowardsCenter(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 centerstatic net.minecraft.core.BlockPosgetLoadedPositionTowardsCenter(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 centerstatic booleanisSurfaceAreaMostlyMaterial(@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 voidsetupSpawner(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 booleanspawnPirateShip(net.minecraft.core.BlockPos targetSpawnPoint, IColony colony, com.ldtteam.structurize.blueprints.v1.Blueprint blueprint, IColonyRaidEvent event) Used to trigger a pirate event.
-
Field Details
-
SHIP_FOLDER
Folder name for the pirate ship schematics- See Also:
-
-
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, int rotation, String shipName) Checks whether a pirate event is possible at this place.- Parameters:
colony- the colony.spawnPoint- the spawn point.raidLevel- the raid level.rotation- the rotation.- Returns:
- true if successful.
-
canSpawnShipAt
public static boolean canSpawnShipAt(IColony colony, net.minecraft.core.BlockPos spawnPoint, int raidLevel, int rotation, 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.rotation- the rotation.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 checkship- the ship structure to checkworld- 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 checkship- the ship structure to checkworld- 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 usebaseY- the base y pos.from- First corner of search rectangleto- Second corner of search rectanglepercentRequired- 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 positioncolony- the colony to usemaxDistance- the max distance to gomaxDistancePos- the position from where to calc the max distance.minDistance- the min distance from colony center allowedaccuracy- 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 positioncolony- the colony to usemaxDistance- the max distance to gomaxDistancePos- the position from where to calc the max distance.minDistance- the min distance from colony center allowedaccuracy- 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 spawnpointworld- the worldradius- 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:
startPos- the Position we're starting fromtarget- original destinationwayPoints- waypoints to compare- Returns:
- position to go to
-