Data Packs Item

Personal Force Fields

  • 6.5k views 0 today
  • save_alt 622 downloads
Compatibility
Minecraft 1.17
Changes include
  • Functions
  • 28
  • 26
  • 7
memerminecraft
Lvl 56Grandmaster Miner
69
I created this little project where you can create items that, when held, generate a repulsing or attracting field for entities nearby.

--Craft--
Force Field: Throw 10 lapis blocks and 32 lightning rods on the ground.
Inverted Force Field: Throw 10 redstone blocks and 32 lightning rods on the ground.

These can be used to protect yourself from mobs or simply move them around.



Note: Force fields will only affect entities on the actual border of the field itself and not inside the field.

More like this

  Have something to say?

Creeaper
07/09/2021 11:42 pm
Level 1 : New Miner
It's not working for me too for some reason.
1
SethAquauis
06/24/2021 10:37 pm
Level 1 : New Miner
Not working for me for some reason. I did it the same as the other datapacks I have
1
Howzieky
06/22/2021 3:04 pm
Level 51 : Grandmaster Pyro
Nice stuff! I see that this is a small and simple datapack, but if I may make a suggestion, I notice that you're using nbt in your tick function, not once, not 6 times, but twice for every player and an extra 4 times for every entity. I've only looked at the tick function so far, but nbt is very very slow, especially done every tick and combined with @e.

If you ever need to optimize this pack, I would recommend using a predicate to read the player's selected item, and maybe only check the other things if the player throws an item on the ground. You could set up a hidden advancement that triggers a function when the player's inventory changes, then immediately look for any new, dropped items. If it finds one, then you read the nbt. If that nbt matches the nbt you're searching for, give it a /tag. It's WAY faster to use the tag= selector than it is to use nbt= because any time you read or write nbt to or from an entity, the game has to do some disgustingly slow serialization, so you want to minimize it as much as possible.

If you're not worried about datapack execution speed, ignore all this. If you are worried, hmu I've been fixing a lot of my own mistakes recently
1
Iance
06/21/2021 6:56 pm
Level 1 : New Miner
1.16.5?
1
Tchinen
06/21/2021 9:19 am
Level 1 : New Miner
Cool (here from reddit too)
2
Spellbreaker13
06/20/2021 11:59 pm
Level 2 : Apprentice Miner
Here from reddit
3
iRtaRyZ
06/20/2021 10:18 pm
He/Him • Level 57 : Grandmaster Archer
very good! 😀
3

Welcome