Skip to content

Instantly share code, notes, and snippets.

View eggohito's full-sized avatar
🥚
egg.

eggohito eggohito

🥚
egg.
  • 01:07 (UTC +08:00)
View GitHub Profile

Resource bars cannot have fully dynamic max values, at least not yet. This means that you would need to modify the power JSON file just to adjust the max value, which is quite a hassle, especially in an environment where you want it to be configurable in-game easily.

Luckily, we can copy the value of a resource to a score holder in a scoreboard objective, and vice versa. Mix this with being able to do math operations in scoreboard, you can now have a resource with a pseudo-dynamic max value.

How?

First, we would need to create two scoreboard objectives: one for storing the current value of the resource, and one for indicating the max value of the resource. In this example, we'll be naming the scoreboard objectives resource.cur and resource.max respectively

💡 The variables used are reset after, so you'll need to set them again if you wish to make it persist. 💡


Initial setup

To determine which entity initiated the pickpocket, you'll need to add the pickpocket.actor tag to the entity via the /tag command. Afterwards, you can execute the pickpocket:this function using the /function command as the entity you wish to pickpocket from.


Taking a specific amount of items

As you may know, there have been a lot of major changes from 1.20.2, to 1.20.5/6 and 1.21; which resulted in some power/action/condition/data types that cannot be re-implemented. This is due to the work-arounds being either too unreliable/too hacky, too much of a pain to maintain in the long run, or just outright impossible to do, therefore, we've decided to remove and re-structure stuff to accommodate for the changes.

Things that have been removed

  • Any fields/types related to harvest levels (e.g: harvest_level item condition type) since items no longer have a harvest level property.
  • Any fields/types related to entity groups (e.g: entity_group entity condition/power type) since entity groups have been removed in favor of using entity type tags.
  • Reach Entity Attributes have been removed as a dependency since vanilla now provides new attributes related to interaction range:
    • minecraft:player.entity_interaction_range (equivalent to reach-entity-attributes:attack_range)
    • `minecraft:pl