Package com.minecolonies.core.items
Class ItemBannerRallyGuards
java.lang.Object
net.minecraft.world.item.Item
com.minecolonies.core.items.AbstractItemMinecolonies
com.minecolonies.core.items.ItemBannerRallyGuards
- All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement,net.minecraft.world.level.ItemLike,net.neoforged.neoforge.common.extensions.IItemExtension
Rally Guards Banner Item class. Used to give tasks to guards.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.Item
net.minecraft.world.item.Item.Properties, net.minecraft.world.item.Item.TooltipContext -
Field Summary
Fields inherited from class net.minecraft.world.item.Item
ABSOLUTE_MAX_STACK_SIZE, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, canRepair, DEFAULT_MAX_STACK_SIZE, MAX_BAR_WIDTHFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsConstructorDescriptionItemBannerRallyGuards(net.minecraft.world.item.Item.Properties properties) Rally Guards Banner constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidappendHoverText(@NotNull net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.world.item.Item.TooltipContext ctx, @NotNull List<net.minecraft.network.chat.Component> tooltip, @NotNull net.minecraft.world.item.TooltipFlag flagIn) static intbroadcastPlayerToRally(net.minecraft.world.item.ItemStack banner, net.minecraft.world.level.Level worldIn, @Nullable ILocation rallyLocation) Broadcasts the player all the guardtowers rallied by the item are supposed to follow.static @Nullable IGuardBuildinggetGuardBuilding(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos position) Fetches the (server-side) buildings for the guard tower at a specific position.static AbstractBuildingGuards.ViewgetGuardBuildingView(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos position) Fetches the (client-side) View for the guard tower at a specific position.static List<net.minecraft.core.BlockPos> getGuardTowerLocations(net.minecraft.world.item.ItemStack banner) Deprecated, for removal: This API element is subject to removal in a future version.use inlinestatic List<com.mojang.datafixers.util.Pair<net.minecraft.core.BlockPos, AbstractBuildingGuards.View>> getGuardTowerViews(net.minecraft.world.item.ItemStack banner, net.minecraft.world.level.Level level) Fetches the (client-side) Views of the guard towers rallied by the banner.static booleanisActive(net.minecraft.world.item.ItemStack stack) Deprecated, for removal: This API element is subject to removal in a future version.use inlinebooleanisActiveForGuardTower(net.minecraft.world.item.ItemStack banner, IGuardBuilding guardTower) Checks if the given banner is active and valid for the given guardtower.booleanisFoil(@NotNull net.minecraft.world.item.ItemStack stack) static booleanisGuardBuilding(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos position) Checks if the position is a guard buildingbooleanonDroppedByPlayer(net.minecraft.world.item.ItemStack item, net.minecraft.world.entity.player.Player player) static booleanremoveGuardTowerAtLocation(net.minecraft.world.item.ItemStack banner, net.minecraft.core.BlockPos guardTowerLocation) Removes the guard tower from the rallying list based on its positionstatic voidtoggleBanner(net.minecraft.world.item.ItemStack banner, net.minecraft.world.entity.player.Player playerIn) Toggles the banner.@NotNull net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack> use(net.minecraft.world.level.Level worldIn, net.minecraft.world.entity.player.Player playerIn, net.minecraft.world.InteractionHand handIn) @NotNull net.minecraft.world.InteractionResultuseOn(net.minecraft.world.item.context.UseOnContext context) Methods inherited from class net.minecraft.world.item.Item
asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canFitInsideContainerItems, components, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, getBreakingSound, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDefaultMaxStackSize, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getId, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEnchantable, isRepairable, isValidRepairItem, mineBlock, modifyDefaultComponentsFrom, onCraftedBy, onCraftedPostProcess, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, requiredFeatures, toString, useOnRelease, verifyComponentsAfterLoadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension
applyEnchantments, canBeHurtBy, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultAttributeModifiers, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, isPrimaryItemFor, makesPiglinsNeutral, onAnimalArmorTick, onDestroyed, onEntityItemUpdate, onEntitySwing, onEntitySwing, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation, supportsEnchantment
-
Constructor Details
-
ItemBannerRallyGuards
public ItemBannerRallyGuards(net.minecraft.world.item.Item.Properties properties) Rally Guards Banner constructor. Sets max stack to 1, like other tools.- Parameters:
properties- the properties.
-
-
Method Details
-
useOn
@NotNull public @NotNull net.minecraft.world.InteractionResult useOn(net.minecraft.world.item.context.UseOnContext context) - Overrides:
useOnin classnet.minecraft.world.item.Item
-
use
@NotNull public @NotNull net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack> use(net.minecraft.world.level.Level worldIn, net.minecraft.world.entity.player.Player playerIn, net.minecraft.world.InteractionHand handIn) - Overrides:
usein classnet.minecraft.world.item.Item
-
onDroppedByPlayer
public boolean onDroppedByPlayer(net.minecraft.world.item.ItemStack item, net.minecraft.world.entity.player.Player player) -
toggleBanner
public static void toggleBanner(net.minecraft.world.item.ItemStack banner, net.minecraft.world.entity.player.Player playerIn) Toggles the banner. This cannot be done by "the system" but must happen from here by the player. (Note that it will also send chat messages to the player) Thus, this method is private on purpose (for now).- Parameters:
banner- The banner to toggleplayerIn- The player toggling the banner
-
broadcastPlayerToRally
public static int broadcastPlayerToRally(net.minecraft.world.item.ItemStack banner, net.minecraft.world.level.Level worldIn, @Nullable @Nullable ILocation rallyLocation) Broadcasts the player all the guardtowers rallied by the item are supposed to follow.- Parameters:
banner- The banner that should broadcast- Returns:
- The number of guards rallied
-
getGuardTowerLocations
@Deprecated(forRemoval=true, since="1.21") public static List<net.minecraft.core.BlockPos> getGuardTowerLocations(net.minecraft.world.item.ItemStack banner) Deprecated, for removal: This API element is subject to removal in a future version.use inlineReturns the guard tower positions of towers rallied by the given banner.- Parameters:
banner- The banner of which the guard towers should be retrieved- Returns:
- The list of guardtower positions, or an empty list if anything goes wrong during retrieval.
-
isGuardBuilding
public static boolean isGuardBuilding(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos position) Checks if the position is a guard building- Parameters:
worldIn- The world in which to checkposition- The position to check- Returns:
- true if there is a guard building at the position
-
getGuardBuildingView
@Nullable public static AbstractBuildingGuards.View getGuardBuildingView(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos position) Fetches the (client-side) View for the guard tower at a specific position.- Parameters:
worldIn- The world in which to search for the guard tower.position- The position of the guard tower.- Returns:
- The Guard tower View, or null if no guard tower present at the location.
-
getGuardBuilding
@Nullable public static @Nullable IGuardBuilding getGuardBuilding(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos position) Fetches the (server-side) buildings for the guard tower at a specific position.- Parameters:
worldIn- The world in which to search for the guard tower.position- The position of the guard tower.- Returns:
- The building, or null if no guard tower present at the location.
-
getGuardTowerViews
public static List<com.mojang.datafixers.util.Pair<net.minecraft.core.BlockPos,AbstractBuildingGuards.View>> getGuardTowerViews(net.minecraft.world.item.ItemStack banner, net.minecraft.world.level.Level level) Fetches the (client-side) Views of the guard towers rallied by the banner. If a rallied position is not a guard tower anymore (tower was moved or destroyed), the corresponding entry will be null.- Returns:
- A list of maps. Map's key is the position, Map's value is a guard tower or null.
-
isActiveForGuardTower
public boolean isActiveForGuardTower(net.minecraft.world.item.ItemStack banner, IGuardBuilding guardTower) Checks if the given banner is active and valid for the given guardtower.- Parameters:
banner- The banner to checkguardTower- The guardtower to check- Returns:
- true if the banner is active and has guardTower in the list.
-
isActive
@Deprecated(forRemoval=true, since="1.21") public static boolean isActive(net.minecraft.world.item.ItemStack stack) Deprecated, for removal: This API element is subject to removal in a future version.use inlineChecks if the banner is active- Parameters:
stack- The banner that should be checked- Returns:
- true if the banner is active
-
removeGuardTowerAtLocation
public static boolean removeGuardTowerAtLocation(net.minecraft.world.item.ItemStack banner, net.minecraft.core.BlockPos guardTowerLocation) Removes the guard tower from the rallying list based on its position- Parameters:
banner- The banner to remove the guard tower fromguardTowerLocation- The location of the guard tower- Returns:
- true if a tower has been removed
-
isFoil
public boolean isFoil(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) - Overrides:
isFoilin classnet.minecraft.world.item.Item
-
appendHoverText
public void appendHoverText(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, @Nullable @Nullable net.minecraft.world.item.Item.TooltipContext ctx, @NotNull @NotNull List<net.minecraft.network.chat.Component> tooltip, @NotNull @NotNull net.minecraft.world.item.TooltipFlag flagIn) - Overrides:
appendHoverTextin classnet.minecraft.world.item.Item
-