• check_circle Functions
  • 19,505 views, 3 today
  • 1,699 downloads, 0 today
  • 49
  • 34
  • 6
Gen's Avatar Gen
Level 61 : High Grandmaster Ghast Rider
200
This is just an API to store functions I'll often use for datapacks so that it doesn't clutter anyone's scoreboard list. I'll be adding more as they come up


Notes:
- You must uninstall this datapack properly before you remove it.
- Works in 1.15 to 1.18
- You can use this as a base for your datapacks too. I really dc what you do.


- This features page is incredibly outdated, it is guaranteed that this api doesn't work the same as it did when I made this



Features:


Entity Tags:
Chunk Loading
- Tag an entity with "gen.ChunkLoad" and it will continue to load the chunk it is in. Once its removed the chunk will unload itself unless another chunkloader is in the same chunk.

Custom Crafting GUI
- Tag an entity that is in the same coordinates of a 3x9 storage container with the tag "gen.Crafter" and it will get a crafting table GUI. These really are just retextured white dye so it is recommended you use "GenData Textures" version 0.6 and up unless a resourcepack is provided with equivalent textures.

Item Hitbox
- Any entity designated with the tag "gen.Hitbox" will be given a high defense stat, will be despawned when hit, and will despawn when another is in the same block as it. This allows for a very handy hitbox for items like lamps or crops. Alternatively add "gen.HitboxNull" to it as well to allow multiple hitboxes in the same location.

Invisibility
- Tag an entity that can be affected by potion effects and give it the "gen.Invisible" tag and it will be truly invisible for as long as it has the tag on it. No potion swirls or anything.

Entity Illumination
- This is mainly for fixing a bug in minecraft where an armor stand will turn dark when inside a block which screws with textures when you're developing custom blocks. Giving it the "gen.Illuminate" continuously sets the entity on fire fixing that issue. Please don't give this tag to your friends' in-game pets.

Fire Immunity
- Give an entity the tag "gen.FireRez" and it will be fire resistant for as long as it has the tag.

Light Detection
- Give an entity the tag "gen.Light" and it will get a score between 0-15 on the scoreboard objective "gen.Light" based on its light level. 0 is the darkest and 15 is the lightest.

Pushable Markers
- Armor Stands can often be used to be skins for custom blocks but what happens if it gets pushed by a piston? Well now any armor stand with the tag "gen.Pushable" will also be moved in the direction the piston is pushing it.

Item Tags:

Food Saturation
- For food items I have the tag "gen.Saturate:Xb". Any cookie or potion consumed with this tag will add saturation as if eating a larger meal. Replace the "X" with a number between 1-20 to set the added value



Item Frame Alignment
- If an item frame has an item inside it with the tag "gen.Align:Xb", it will align the direction it is facing according to the number X is replaced with.



Pig Rejection
- Since Carrots on Sticks are the most popular item to use as custom tools, this mechanic makes it so that while holding a tool with the tag "gen.Gadget:1b" a player cannot ride pigs. This is so that the Carrot on a Stick cannot break or if it is set to unbreakable then the mechanic cannot be exploited for infinite pig rides.

Scoreboard Tools:
API Detection
- Sets score on a scoreboard for $$gen.Api on objective gen.Install to 116 by default so that it can be detected if "Gen API" can be detected by other datapacks

Click Detection
- Added scoreboard "gen.Click" which goes up in score every time you right-click with a Carrot on a Stick. It clears itself once you get to a score of 2, which can be useful for creating right-click events for custom items.

Countdown Timers
- Added three timer scores on scoreboard objective "gen.Timer" with the names "$gen.Delay1", "gen.Delay2", & "gen.Delay3" which continuously count down. They time 0.5sec, 1sec, and 5sec respectively and are useful for when you need to run commands without running them every tick

Death Detection
- All players get a score of 1 on the objective "gen.Death" the moment they die which is set to 0 a moment later

Entity Despawning
- Any entity with the scoreboard score of 2 or more on the objective "gen.Remove" will be removed from the game. No drops, no death animation, no puff of smoke. Just gone. Please do not use this on players because it will not go well.

Player ID
- Upon first joining the world all players will be assigned a unique scoreboard ID on the objective "gen.ID". This can be used to specify players in commands

Version Detection
- This doesn't exactly detect your Minecraft Version, but it by defailt sets itself to 1.16. If a player is in creative mode they will see an option on reload to change its version though which makes it possible to have datapacks that can withstand command changes in minecraft updates.

Datapacks that use Gen API:
- Gen's "Better Babies" Datapack
- Gen's "Better Farming" Datapack
- Gen's "Better Fishing" Datapack
- Gen's "Inventory Blocks"
- Gen's "Server Utilities"

Uninstall:
Uninstall Command:
/function api:uninstall
CompatibilityMinecraft 1.15
toMinecraft 1.18
Tags

15 Update Logs

Gen API 1.18 - Update:1.4 : by Gen 03/07/2023 5:21:18 amMar 7th, 2023

- Optimized Code
LOAD MORE LOGS

Create an account or sign in to comment.

1
03/09/2023 7:59 am
Level 3 : Apprentice Crafter
RustyLake
RustyLake's Avatar
Can i ask what does API mean?
2
03/10/2023 12:19 am
Level 61 : High Grandmaster Ghast Rider
Gen
Gen's Avatar
"Application programming interface". It's pretty much a centralized program where ppl put their functions instead of just remaking them over and over for everything
1
06/11/2022 8:20 pm
Level 1 : New Miner
bswan2
bswan2's Avatar
Hey, mate. First things first: loving your farming and fishing datapacks.
Looking forward to you updating it to 1.19 and probably adding even more cool things to play with.

But I got an issue with api/farming



From time to time server TPS drops drastically and slowly creeping down for several hours until server die, restarts sometimes with some crops missing. But that is not a source of the issue. I tracked issue back to your logic that prevents players from accidentally feeding invisible hitbox parrots with cookies. Commenting those 2 lines in
run/score/hitbox makes server run smoothly with less than 20MSPT:



execute as @s[scores={gen.Hitbox=2}] if entity @a[nbt={SelectedItem:{id:"minecraft:cookie"}},distance=..8] unless entity @e[tag=gen.CookieNull,distance=..0.2] run function api:run/score/hitbox/cookie_null
execute as @e[tag=gen.CookieNull] unless entity @a[nbt={SelectedItem:{id:"minecraft:cookie"}}] run kill @s

I can see what are you trying to do there and it seems reasonable, but for some reason it lags server. And you have to believe that there are n players around crops with cookie in hand :D So maybe there is an logic issue I can't see, or you can do it some other way/optional feature togglable through triggers. Meanwhile I am keeping it commented out.

Once again - it is great pair of datapacks, good luck and have fun!
1
06/11/2022 10:22 pm
Level 61 : High Grandmaster Ghast Rider
Gen
Gen's Avatar
I appreciate the advice. I'll make sure to keep that in mind. I'm actually as of now working on updates to my api (which will come out months from now sadly) but I can work on that straight away. I very much appreciate how helpful followers like you are
1
06/11/2022 8:44 pm
Level 1 : New Miner
bswan2
bswan2's Avatar
To be clear - problem is the first line. I commented out both because without first one second one is useless.

I can suggest flipping expression in problematic line, look for a player with cookie in hand first, then look if there are some crops nearby. Because not it executes player inventory check once per crop, and flipped around it would do it once per player.
2
05/28/2022 5:12 am
Level 1 : New Miner
User4176397G
User4176397G's Avatar
Sweet
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome