Package com.minecolonies.core.util
Class WorkerUtil
java.lang.Object
com.minecolonies.core.util.WorkerUtil
Utility methods for BlockPos.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic List<Tuple<EquipmentTypeEntry, net.minecraft.world.item.ItemStack>> List of tools to test blocks against, used for finding right tool. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidfaceBlock(@Nullable net.minecraft.core.BlockPos block, AbstractEntityCitizen citizen) Change the citizens Rotation to look at said block.static @Nullable net.minecraft.core.BlockPosfindFirstLevelSign(com.ldtteam.structurize.blueprints.v1.Blueprint structure, net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level level) Find the first level in a structure and return it.static EquipmentTypeEntrygetBestToolForBlock(net.minecraft.world.level.block.state.BlockState state, float blockHardness, AbstractBuilding building, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) Get a Tooltype for a certain block.static intgetCorrectHarvestLevelForBlock(net.minecraft.world.level.block.state.BlockState target) Get the correct havestlevel for a certain block.static intgetLastLadder(@NotNull net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level world) Find the last ladder by iterating over the y pos in the world.static List<Tuple<EquipmentTypeEntry, net.minecraft.world.item.ItemStack>> Gets or initializes the test tool list.static booleanhasTooManyExternalItemsInInv(IRecipeStorage currentRecipeStorage, @NotNull InventoryCitizen inv) Check if there are too many items (i.e.static booleanisPartOfRecipe(net.minecraft.world.item.ItemStack stack, IRecipeStorage currentRecipeStorage) Check if stack is part of the recipe.static booleanisPathBlock(net.minecraft.world.level.block.Block block) Checks if a certain block is a pathBlock (roadBlock).static booleanisThereCompostedLand(BuildingFlorist buildingFlorist, net.minecraft.world.level.Level world) Check if there is any already composted land.static booleansetSpawnPoint(@Nullable net.minecraft.core.BlockPos spawnPoint, @NotNull AbstractEntityCitizen citizen) Recalls the citizen, notifies player if not successful.static voidupdateLevelSign(net.minecraft.world.level.Level world, MinerLevel level, int levelId) Updated the level sign of a certain level in the world.
-
Field Details
-
tools
List of tools to test blocks against, used for finding right tool.
-
-
Method Details
-
getOrInitTestTools
public static List<Tuple<EquipmentTypeEntry,net.minecraft.world.item.ItemStack>> getOrInitTestTools()Gets or initializes the test tool list.- Returns:
- the list of possible tools.
-
isPathBlock
public static boolean isPathBlock(net.minecraft.world.level.block.Block block) Checks if a certain block is a pathBlock (roadBlock).- Parameters:
block- the block to analyze.- Returns:
- true if is so.
-
setSpawnPoint
public static boolean setSpawnPoint(@Nullable @Nullable net.minecraft.core.BlockPos spawnPoint, @NotNull @NotNull AbstractEntityCitizen citizen) Recalls the citizen, notifies player if not successful.- Parameters:
spawnPoint- the spawnPoint.citizen- the citizen.- Returns:
- true if successful.
-
getBestToolForBlock
public static EquipmentTypeEntry getBestToolForBlock(net.minecraft.world.level.block.state.BlockState state, float blockHardness, AbstractBuilding building, net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) Get a Tooltype for a certain block. We need this because minecraft has a lot of blocks which have strange or no required tool.- Parameters:
state- the target BlockState.blockHardness- the hardness.- Returns:
- the toolType to use.
-
getCorrectHarvestLevelForBlock
public static int getCorrectHarvestLevelForBlock(net.minecraft.world.level.block.state.BlockState target) Get the correct havestlevel for a certain block. We need this because minecraft has a lot of blocks which have strange or no required harvestlevel.- Parameters:
target- the target block.- Returns:
- the required harvestLevel.
-
faceBlock
public static void faceBlock(@Nullable @Nullable net.minecraft.core.BlockPos block, AbstractEntityCitizen citizen) Change the citizens Rotation to look at said block.- Parameters:
block- the block he should look at.citizen- the citizen that shall face the block.
-
findFirstLevelSign
@Nullable public static @Nullable net.minecraft.core.BlockPos findFirstLevelSign(com.ldtteam.structurize.blueprints.v1.Blueprint structure, net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level level) Find the first level in a structure and return it.- Parameters:
structure- the structure to scan.level-- Returns:
- the position of the sign.
-
updateLevelSign
public static void updateLevelSign(net.minecraft.world.level.Level world, MinerLevel level, int levelId) Updated the level sign of a certain level in the world.- Parameters:
world- the world.level- the level to update.levelId- the id of the level.
-
isThereCompostedLand
public static boolean isThereCompostedLand(BuildingFlorist buildingFlorist, net.minecraft.world.level.Level world) Check if there is any already composted land.- Parameters:
buildingFlorist- the building to check.world- the world to check it for.- Returns:
- true if there is any.
-
getLastLadder
public static int getLastLadder(@NotNull @NotNull net.minecraft.core.BlockPos pos, net.minecraft.world.level.Level world) Find the last ladder by iterating over the y pos in the world.- Parameters:
pos- the starting pos.world- the world.- Returns:
- the y of the last one.
-
hasTooManyExternalItemsInInv
public static boolean hasTooManyExternalItemsInInv(IRecipeStorage currentRecipeStorage, @NotNull @NotNull InventoryCitizen inv) Check if there are too many items (i.e. more than 3) unrelated to the current recipe.- Parameters:
currentRecipeStorage- the reciep to compare it to.inv- the inventory to check in.- Returns:
- true if so.
-
isPartOfRecipe
public static boolean isPartOfRecipe(net.minecraft.world.item.ItemStack stack, IRecipeStorage currentRecipeStorage) Check if stack is part of the recipe.- Parameters:
stack- the stack to check.currentRecipeStorage- the recipe to compare.- Returns:
- true if so.
-