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.minecraftforge.common.extensions.IForgeItem

public class ItemBannerRallyGuards extends AbstractItemMinecolonies
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
  • Field Summary

    Fields inherited from class net.minecraft.world.item.Item

    BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZE

    Fields inherited from interface net.minecraft.world.flag.FeatureElement

    FILTERED_REGISTRIES
  • Constructor Summary

    Constructors
    Constructor
    Description
    ItemBannerRallyGuards(net.minecraft.world.item.Item.Properties properties)
    Rally Guards Banner constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendHoverText(@NotNull net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level worldIn, @NotNull List<net.minecraft.network.chat.Component> tooltip, @NotNull net.minecraft.world.item.TooltipFlag flagIn)
     
    static int
    broadcastPlayerToRally(net.minecraft.world.item.ItemStack banner, net.minecraft.world.level.Level worldIn, ILocation rallyLocation)
    Broadcasts the player all the guardtowers rallied by the item are supposed to follow.
    static net.minecraft.nbt.CompoundTag
    checkForCompound(net.minecraft.world.item.ItemStack banner)
    Check for the compound and return it.
    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.
    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.
    static com.google.common.collect.ImmutableList<ILocation>
    getGuardTowerLocations(net.minecraft.world.item.ItemStack banner)
    Returns the guard tower positions of towers rallied by the given banner.
    static List<com.mojang.datafixers.util.Pair<ILocation,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 boolean
    isActive(net.minecraft.world.item.ItemStack banner)
    Checks if the banner is active
    boolean
    isActiveForGuardTower(net.minecraft.world.item.ItemStack banner, IGuardBuilding guardTower)
    Checks if the given banner is active and valid for the given guardtower.
    boolean
    isFoil(@NotNull net.minecraft.world.item.ItemStack stack)
     
    static boolean
    isGuardBuilding(net.minecraft.world.level.Level worldIn, net.minecraft.core.BlockPos position)
    Checks if the position is a guard building
    boolean
    onDroppedByPlayer(net.minecraft.world.item.ItemStack item, net.minecraft.world.entity.player.Player player)
     
    static boolean
    removeGuardTowerAtLocation(net.minecraft.world.item.ItemStack banner, ILocation guardTowerLocation)
    Removes the guard tower from the rallying list based on its position
    static void
    toggleBanner(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.InteractionResult
    useOn(net.minecraft.world.item.context.UseOnContext context)
     

    Methods inherited from class net.minecraft.world.item.Item

    asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getBarColor, getBarWidth, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isRepairable, isValidRepairItem, mineBlock, onCraftedBy, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, releaseUsing, requiredFeatures, shouldOverrideMultiplayerNbt, toString, useOnRelease, verifyTagAfterLoad

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.flag.FeatureElement

    isEnabled

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeItem

    canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getAttributeModifiers, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultTooltipHideFlags, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getShareTag, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, initCapabilities, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onItemUseFirst, onLeftClickEntity, onStopUsing, readShareTag, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
  • 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:
      useOn in class net.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:
      use in class net.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 toggle
      playerIn - The player toggling the banner
    • broadcastPlayerToRally

      public static int broadcastPlayerToRally(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.
      Parameters:
      banner - The banner that should broadcast
      Returns:
      The number of guards rallied
    • getGuardTowerLocations

      public static com.google.common.collect.ImmutableList<ILocation> getGuardTowerLocations(net.minecraft.world.item.ItemStack banner)
      Returns 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 check
      position - 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 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<ILocation,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 check
      guardTower - The guardtower to check
      Returns:
      true if the banner is active and has guardTower in the list.
    • isActive

      public static boolean isActive(net.minecraft.world.item.ItemStack banner)
      Checks if the banner is active
      Parameters:
      banner - The banner that should be checked
      Returns:
      true if the banner is active
    • removeGuardTowerAtLocation

      public static boolean removeGuardTowerAtLocation(net.minecraft.world.item.ItemStack banner, ILocation guardTowerLocation)
      Removes the guard tower from the rallying list based on its position
      Parameters:
      banner - The banner to remove the guard tower from
      guardTowerLocation - The location of the guard tower
      Returns:
      true if a tower has been removed
    • checkForCompound

      public static net.minecraft.nbt.CompoundTag checkForCompound(net.minecraft.world.item.ItemStack banner)
      Check for the compound and return it. If not available create and return it.
      Parameters:
      banner - the banner to check for a compound.
      Returns:
      the compound of the item.
    • isFoil

      public boolean isFoil(@NotNull @NotNull net.minecraft.world.item.ItemStack stack)
      Overrides:
      isFoil in class net.minecraft.world.item.Item
    • appendHoverText

      public void appendHoverText(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.world.level.Level worldIn, @NotNull @NotNull List<net.minecraft.network.chat.Component> tooltip, @NotNull @NotNull net.minecraft.world.item.TooltipFlag flagIn)
      Overrides:
      appendHoverText in class net.minecraft.world.item.Item