Minecraft Data Packs / Item

Personal Force Fields

  • check_circle Functions
  • 5,503 views, 7 today
  • 534 downloads, 1 today
  • 26
  • 23
  • 7
memerminecraft's Avatar memerminecraft
Level 54 : Grandmaster Miner
66
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.
CompatibilityMinecraft 1.17
Tags

Create an account or sign in to comment.

1
07/09/2021 11:42 pm
Level 1 : New Miner
Creeaper
Creeaper's Avatar
It's not working for me too for some reason.
1
06/24/2021 10:37 pm
Level 1 : New Miner
SethAquauis
SethAquauis's Avatar
Not working for me for some reason. I did it the same as the other datapacks I have
1
06/22/2021 3:04 pm
Level 48 : Master Pyro
Howzieky
Howzieky's Avatar
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
06/21/2021 6:56 pm
Level 1 : New Miner
Iance
Iance's Avatar
1.16.5?
2
06/21/2021 9:19 am
Level 1 : New Miner
Tchinen
Tchinen's Avatar
Cool (here from reddit too)
3
06/20/2021 11:59 pm
Level 2 : Apprentice Miner
Spellbreaker13
Spellbreaker13's Avatar
Here from reddit
3
06/20/2021 10:18 pm
Level 54 : Grandmaster Archer
iRtaRyZ
iRtaRyZ's Avatar
very good! 😀
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome