Class CitizenItemUtils
java.lang.Object
com.minecolonies.core.util.citizenutils.CitizenItemUtils
Handles the citizens interaction with an item with the world.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleapplyMending(@NotNull AbstractEntityCitizen citizen, double xp) static voidbreakBlockWithToolInHand(@NotNull AbstractEntityCitizen citizen, @Nullable net.minecraft.core.BlockPos blockPos) Swing entity arm, create sound and particle effects.static voiddamageItemInHand(@NotNull AbstractEntityCitizen citizen, net.minecraft.world.InteractionHand hand, int damage) Damage the current held item.static net.minecraft.world.entity.item.ItemEntityentityDropItem(@NotNull AbstractEntityCitizen citizen, @NotNull net.minecraft.world.item.ItemStack itemstack) Handles the dropping of items from the entity.static voidhitBlockWithToolInHand(@NotNull AbstractEntityCitizen citizen, @Nullable net.minecraft.core.BlockPos blockPos) Swing entity arm, create sound and particle effects.static voidhitBlockWithToolInHand(@NotNull AbstractEntityCitizen citizen, @Nullable net.minecraft.core.BlockPos blockPos, boolean breakBlock) Swing entity arm, create sound and particle effects.static voidpickupItems(AbstractEntityCitizen citizen) Pick up all items in a range around the citizen.static voidremoveHeldItem(AbstractEntityCitizen citizen) Removes the currently held item.static voidsetHeldItem(@NotNull AbstractEntityCitizen citizen, net.minecraft.world.InteractionHand hand, int slot) Sets the currently held item.static voidsetMainHeldItem(@NotNull AbstractEntityCitizen citizen, int slot) Sets the currently held for mainHand item.static voidtryPickupItemEntity(@NotNull AbstractEntityCitizen citizen, @NotNull net.minecraft.world.entity.item.ItemEntity itemEntity) Citizen will try to pick up a certain item.static voidupdateArmorDamage(@NotNull AbstractEntityCitizen citizen, double damage) Updates the armour damage after being hit.
-
Constructor Details
-
CitizenItemUtils
public CitizenItemUtils()
-
-
Method Details
-
tryPickupItemEntity
public static void tryPickupItemEntity(@NotNull @NotNull AbstractEntityCitizen citizen, @NotNull @NotNull net.minecraft.world.entity.item.ItemEntity itemEntity) Citizen will try to pick up a certain item.- Parameters:
itemEntity- the item he wants to pickup.
-
removeHeldItem
Removes the currently held item. -
setHeldItem
public static void setHeldItem(@NotNull @NotNull AbstractEntityCitizen citizen, net.minecraft.world.InteractionHand hand, int slot) Sets the currently held item.- Parameters:
hand- what hand we're settingslot- from the inventory slot.
-
setMainHeldItem
Sets the currently held for mainHand item.- Parameters:
slot- from the inventory slot.
-
hitBlockWithToolInHand
public static void hitBlockWithToolInHand(@NotNull @NotNull AbstractEntityCitizen citizen, @Nullable @Nullable net.minecraft.core.BlockPos blockPos) Swing entity arm, create sound and particle effects.Will not break the block.
- Parameters:
blockPos- Block position.
-
hitBlockWithToolInHand
public static void hitBlockWithToolInHand(@NotNull @NotNull AbstractEntityCitizen citizen, @Nullable @Nullable net.minecraft.core.BlockPos blockPos, boolean breakBlock) Swing entity arm, create sound and particle effects.If breakBlock is true then it will break the block (different sound and particles), and damage the tool in the citizens hand.
- Parameters:
blockPos- Block position.breakBlock- if we want to break this block.
-
damageItemInHand
public static void damageItemInHand(@NotNull @NotNull AbstractEntityCitizen citizen, net.minecraft.world.InteractionHand hand, int damage) Damage the current held item.- Parameters:
damage- amount of damage.
-
pickupItems
Pick up all items in a range around the citizen. -
breakBlockWithToolInHand
public static void breakBlockWithToolInHand(@NotNull @NotNull AbstractEntityCitizen citizen, @Nullable @Nullable net.minecraft.core.BlockPos blockPos) Swing entity arm, create sound and particle effects.This will break the block (different sound and particles), and damage the tool in the citizens hand.
- Parameters:
blockPos- Block position.
-
entityDropItem
public static net.minecraft.world.entity.item.ItemEntity entityDropItem(@NotNull @NotNull AbstractEntityCitizen citizen, @NotNull @NotNull net.minecraft.world.item.ItemStack itemstack) Handles the dropping of items from the entity.- Parameters:
itemstack- to drop.- Returns:
- the dropped item.
-
updateArmorDamage
public static void updateArmorDamage(@NotNull @NotNull AbstractEntityCitizen citizen, double damage) Updates the armour damage after being hit.- Parameters:
damage- damage dealt.
-
applyMending
-