Test Inventory

Changes the target player's score if they have the correct item in the correct slot.

/goop testinventory <player> <slot> {filter} [amount] [objective [±]score[%]] [comp] [Shulker Name]

If the item does not match, nothing happens.

Args Breakdown (What everything does)

<Player>

  • The player whose inventory will be checked, and score changed.

  • Supports a few vanilla selectors.


<Slot>

  • The slot in the player's inventory that will be checked. To read on slots see Inventory Slots.

  • Examples: mainhand, offhand, chest, feet, any, 0-8, ec*


{Filter}

  • Specify what NBT the item must have by the use of a GooP Item Filter.

  • Always three words long.


[Amount] ( GooP 1.8.6+ )

  • A quick number range of the amounts of items that will allow the command to succeed.

  • If this is specified, it will dominate whether the command succeeds (Say you use 0 as the amount, usually, finding no items makes the command fail, but this time it will succeed because you are searching for there to be 0 items).

  • May be omitted entirely (preserves backwards compatibility to when this wasn't there).


[Objective]

  • The name of the scoreboard objective that will store the results.

  • You must specify a score for this to be understood as a 'scoreboard objective,' otherwise it will be thought of as a shulker box name filter.


[±][Score][%]

  • The score that will be set if the item is found. Will be round to an integer number.

  • Using the amount keyword instead of an integer number will set the score to the number of items that mach in the slot:

    • If the item in that slot doesnt match, the score will be set to 0, because zero items matched the filter.

    • If the item in that slot matches, the score will be set to how many items are in that slot.

    • If you are targetting multiple slots, all the items of all the slots will be counted.

  • May be an operation prformed on the score the player already has. See PlusMinusPercent page.


[Comp]

  • Usually, this command succeeds and ends when the first item that matches is found (unless you used the amount keyword for score), which is undesirable if you want to use slots of success on all items that match. comp fixes this by forcing the command to go to completion.

  • The [amount] argument, if you are using it, wirte comp after it.

  • The [±][Score][%] argument, if you are using it, wirte comp after it.

  • The shulker box name filter, if you are using it, wirte comp before it.

  • May be omitted entirely (preserves backwards compatibility to when this wasn't there).


[Shulker Box Name Filter]

  • Allows to only match items within shulker boxes named this, color-code and case sensitive.

  • Must use slots that search within shulker boxes, example for slot #5 of any shulker box in the enderchest: ec*.5

Tips

  • You can use the amount keyword in place for a score. This will count the amount of items the player has. More detail on this in Args Breakdown section.


  • The shulker-box-name-filter only applies to slots that target shulker boxes, normal slots won't be affected.

    • See last example, below.


  • To detect that the player has no item in that slot, use the filter v AIR 0

    • When used targetting multiple slots, it will then detect if any of these is free.

    • And if used with the amount keyword for the scoreboard score, it will count how many of these slots are free.


  • You can use a range of accepted amounts, in the vanilla format: 2..20 will allow the command to succeed if the total count of the items is between two and twenty (inclusive).

    • You must thus use 6.. for something like "at least six"

Simple Examples:

/goop testinventory gunging mainhand v NETHER_STAR 0 nitherStar 3

Will set the player gunging's score nitherStar to 3 if they are holding a nether star. Otherwise, nothing will happen. Note that as of GooP 1.6, MMOItems that are Nether Stars won't match anymore.


/goop testinventory gunging 0-8 m CONSUMABLE PIRATE_KEY keys amount

Will set the score keys of player gunging to the amount of Pirate Keys they have in their hotbar


/goop testinventory gunging 0-8 m CONSUMABLE MANGO 256 keys amount oS: &aYou have 256 mangoes in your hotbar!

Will set the score keys of player gunging to the amount of Pirate Keys they have in their hotbar. However, the command will only succeed and tell gunging he has 256 mangoes if he has exactly 4 stacks.


/goop testinventory gunging 0-8 m CONSUMABLE MANGO 256.. keys amount oS: &aYou have at least 256 mangoes in your hotbar!

Will set the score keys of player gunging to the amount of Pirate Keys they have in their hotbar. However, the command will only succeed and tell gunging he has 256 mangoes if he has at least 4 stacks.


/goop testinventory gunging 0-8 m CONSUMABLE MANGO

The command will succeed as soon as it finds a mango in the hotbar


/goop testinventory gunging 0-8 m CONSUMABLE MANGO 45..

The command will succeed if the first slot with mangoes in the hotbar has at least 45 mangoes (checks in ascending order, starting with 0). If there are 30 mangoes in slot #2 but 40 mangoes in slot #5, the command will fail!


/goop testinventory gunging 0-8 m CONSUMABLE MANGO 45.. comp

The command will succeed if the hotbar has at least 45 mangoes total.


/goop testinventory gunging 0-8 m CONSUMABLE MANGO 80..

The command can never succeed because you cant have 80 mangoes in one slot


/goop testinventory gunging 0-8 m CONSUMABLE MANGO 80.. comp

The command will succeed if the hotbar has at least 80 mangoes total.


/goop testinventory gunging 0-8 m CONSUMABLE MANGO 80.. myObjective 20

The command can never succeed because you cant have 80 mangoes in one slot, the player's score will not change.


/goop testinventory gunging 0-8 m CONSUMABLE MANGO 80.. myObjective amount

The command will succeed if the hotbar has at least 80 mangoes total. Player's score will not change if there aren't at least 80 mangoes.


/goop testinventory gunging 0-8 m CONSUMABLE MANGO 80.. myObjective +20 comp

The command will succeed if the hotbar has at least 80 mangoes total. Player's score will not change if there aren't at least 80 mangoes.


/goop testinventory gunging ec*.* e infinity 7 geotop 5 Geodes

Will set the score geotop of player gunging to 5 if any item enchanted with Infinity VII is found within a shulker box named 'Geodes' in their enderchest. This will not consider items outside shulker boxes, but if you wanted that, use ec*.*,ec* as the slot.


/goop testinventory gunging 0-8,9-35.* v STONE 0 hasStone 3 &8Stone Box

The slot is targetting the hotbar, as well as any slot within shulker boxes in the rest of the inventory. This will set the score hasStone of player gunging only if he has a vanilla Stone Block in any hotbar slot, or within a shulker box named "Stone Box" (with gray letters) that is not in their hotbar.

Example: Making a charged sword (MythicMobs+MMOItems)

This sword will have a 5% chance of becoming 'charged' every time you hit an unholy creature with it.

  • It will change texture (CustomModelData)

  • It will fire forth green waves while charged (MythicMobs)

  • The item itself is a MMOItem, and the green waves will scale with Magic Damage (MMOItems)

  • Every time you deal damage while it is charged, it has a chance of losing its charge, reverting to original state.

Preparations: Making the MMOItem, the Dynamic MythicSkill-MMOItemAbility file, and the two textures.

In case for MMOItems to execute Mythic Skills, you are required to create a dynamic mythicSkill-to-mmoitemAbility .yml file:

plugins/MMOItems/dynamic/mythic-mobs-abilities/soul_wave.yml:# The internal name of the MM skill.mythicmobs-skill-id: GooP_Green_Wave
# Ability name displayed in lore.name: "Soul Charge and Projection"
# Ability Modifiers (default values).cooldown: 0.1
  • You must reboot your server for these dynamics files to load.

You also need a MMOItem with the ability attached to it:

plugins/MMOItems/item/long_sword.yml:SOULSTORM: material: STONE_SWORD max-durability: 3000.0 will-break: true name: §a✙ §7§lSoulstorm, §8Tempest from the Edge of the World §a✙ enchants: smite: 10 fire_aspect: 5 sharpness: 5 luck_of_the_sea: 5 lore: - §aGathers soul energy from struck unholy creatures - §aand then releases it forth as waves. - §r - §8A replica of giant Orpheus's greatsword, - §8that even thrust into the ground stands 30m - §8tall atop the far northern floating island. attack-damage: 15.0 attack-speed: 1.6 required-level: 15.0 required-strength: 10.0 disable-repairing: true disable-enchanting: true disable-smelting: true unbreakable: false ability: ability1: type: SOUL_WAVE mode: ON_HIT

Finally, you want to link your textures to stone_sword. I'll use Custom Model Datas 68 (normal) and 69 (powered) for mine.

Below you can see the two different textres I'll be using.

Skill and Explanation

This skill will only work with a sword of MMOItem Type LONG_SWORD and ID SOULSTORM; It is hard-coded that way.

  • You could make it detect more swords by uncommenting the lines commented with #EX#; If any succeeds, player score will end up being 3 and the skill will proceed.

GooP_Green_Wave: Skills: - skill{s=WitchHunterSoulReleaseCall} # Note the name of the sword was once 'Witch Hunter' but was changed.# Releasing # Sure, it is an example here but it is a working item in a server I devved at.WitchHunterSoulReleaseCall: Cooldown: 0.2 Skills: # Unknown Sword Holding State ---------------------------------- GooP TEST INVENTORY in action - settargetscore{objective=swordhold;value=0} @Self{targetcreative=true} - command{c="goop testinventory <target.name> mainhand m LONG_SWORD SOULSTORM swordhold 3"} @Self #EX#- command{c="goop testinventory <target.name> mainhand m SWORD SOULSLASH swordhold 3"} @Self #EX#- command{c="goop testinventory <target.name> mainhand m GAUNTLET SOULPUNCH swordhold 3"} @Self # Score of player will be set to 3 IF they are holding the sword in their mainhand. # The reason this is so important is that MMOItems # Updates player equipment every 0.5 seconds, so if # Players swich to another item and attack within this # interval, that item will execute this skill. # Usually doesnt matter that much, but since # This skill messes with item NBT (CustomModelData) # It is imperative to make sure the player is # Actually holding the sword. # Delay of 1 tick for the command to run. - delay 1 # Execute - skill{s=WitchHunterSoulRelease}WitchHunterSoulRelease: Cooldown: 0.5 Conditions: - score{objective=swordhold;v=>2} true # If the sword is being held (swordhold == 3) - score{objective=swordhold;v=<4} true Skills: # Determine if the sword is POWERED already ---------------------------- GooP TEST INVENTORY in action - command{c="goop testinventory <target.name> mainhand e frost_walker 5 swordhold 5"} @Self # In the skills below, the sword will enchant itself with Frost Walker 5; # I guess you could use /goop nbt to read the Custom Model Data itself, # but this works as well. # Wait 1 tick to run command. - delay 1 - skill{s=WitchHunterSoulReleaseE}WitchHunterSoulReleaseE: Conditions: # If the score is less than 5 => The sword doesnt have Frost Walker => The sword is not powered # Cast the CHARGE skill instead; Otherwise continue to fire the soul wave (because the sword is charged) - score{objective=swordhold;v=<4} castinstead WitchHunterCharge Skills: # Fire a Soul Pulse Projectile ( ACTUALLY FIRING PROJECTILE) - skill{s=WitchHunterSoulPulse} @Forward{f=30.0;y=1.0} # # 1/7 Chance of losing the charge, reverting to original state. - skill{s=WitchHunterUncharge} @Self 0.18# UnchargingWitchHunterUncharge: Skills: # Some blunt sound - the sword just losts its power - effect:sound{s=item.trident.hit_ground;volume=2.0;pitch=1} @SelfLocation # # Actually editing item NBT -------------- GooP NBT in action # Remove Frost Walker Enchantment (Will cause sword to no longer detect as 'POWERED') - command{c="goop nbt enchantment <target.name> mainhand frost_walker 0"} @Self # Restore Custom Model Data to UNPOWERED state texture - command{c="goop nbt cModelData <target.name> mainhand 68"} @Self#### Gathering - Casted IF the sword doesnt have FROST WALKER V enchantmentWitchHunterCharge: Skills: # Every hit has a 1/50 chance of charging the sword - sudoskill{s=WitchHunterChargeReturn;cat=true} @Trigger 0.02WitchHunterChargeReturn: TargetConditions: # Skill will only run tho if the creature being hit is 'unholy' (Which we define here by including such entity type) - entitytype{t=BABY_DROWNED,BABY_ZOMBIE,BABY_ZOMBIE_VILLAGER,BABY_PIG_ZOMBIE,GHAST,MAGMA_CUBE,PIG_ZOMBIE,BLAZE,DROWNED,PHANTOM,SKELETON,SKELETON_HORSE,STRAY,HUSK,WITHER_SKELETON,WITHER,ZOMBIE,ZOMBIE_HORSE,ZOMBIE_VILLAGER,CHICKEN,EVOKER,WITCH,ILLUSIONER} true Skills: # Modifying Sword Data --- GooP NBT in action # Enchanting with FROST WALKER V (So it is detected as 'POWERED' next time) - command{c="goop nbt enchantment <trigger.name> mainhand frost_walker 5"} @Self # Change Custom Model Data to POWERED state texture - command{c="goop nbt cModelData <trigger.name> mainhand 69"} @Self
# Some powerful sound, as the sword becomes powered - effect:sound{s=item.trident.thunder;volume=2.0;pitch=1.8} @SelfLocation
# Particle Fx (Just some normal MythicMobs Projectile stuff)WitchHunterSoulPulse: Skills: - projectile{onTick=WHSP_TV;oS=WHSP_S;onHit=WHSP_H;onEnd=WHSP_E;v=30;i=1;hR=0.5;vR=1;mr=25;hnp=true;g=0;tyo=0.25;sE=false;sB=false}WHSP_TV: Skills: - effect:particles{p=totem_of_undying;a=15;hS=0.1;vS=1;y=1} @Origin - effect:particles{p=flame;a=3;hS=0.1;vS=1;y=1} @OriginWHSP_S: Skills: - effect:sound{s=entity.zombie_villager.converted;volume=1;pitch=1.6}WHSP_H: Skills: # Deals a base 20 damage, and it scales with MAGIC DAMAGE (Of items equipped, it does not account for MMOCore Class Bonuses) - damage{a="20 * (<goop.castermmostat.magicdamage> + 100) * 0.1"}

Notes

  • GooP Test Inventory is used here to detect when the sword is powered based on it having FROST_WALKER V enchantment.

    • There are more ways, like using /goop nbt cModelData <target.name> mainhand +0 swordhold which will add 0 to the current CustomModelData value of the sword, and store the final result in that player's swordhold score (And then detecting if the score is 68 or 69 --- 69 being the powered state).

  • It is also used to make sure the player is holding the sword in their mainhand, and not in their offhand or whatever.

    • That way players wont be holding the sword in their offhand and some boots in the mainhand and enchant it with Frost Walker.

      • Or change any other items' CustomModelData.

    • Also, MMOItems has a 0.5s delay of updating held equipment, so it would be possible to hold the sword, then quickly change to another item, and run the skill - enchanting it with frost walker 5 and changing its CustomModelData.