#Remove function from shears

1 messages · Page 1 of 1 (latest)

rich kindle
#

I am making a custom brush for something in a modpack. I want to remove the functionality of the shears right clicking and doing, well, shear things, but only whenever it is specifically my brush variant (which is shears with NBT tags of {display:{Name:'[{"text":"Brush","italic":false}]'}, CustomModelData:4831}. Such as shearing sheep/mooshrooom. I also want to remove whatever signifies that it will mine cobweb/leaves etc. Basically I just need a 'does nothing' version of the shears item.

I'm not sure if the above is possible, but if it is, how would I go about it?

If you want clarification on anything I said just ask.

craggy ruin
#

Not possible. Maybe try to use a different item for that.

rich kindle
#

Are you able to add durability to an item that didn't have it in the first place through attributes? I ask because if you can't remove stuff like shears functionality, I don't think there is any item that has durability already that I could reskin and it wouldn't have some unwanted function.

craggy ruin
#

You could add custom durability in the form of a custom tag. Or make it, so that an item with more durability, loses more than just one point.

rich kindle
#

I meant I don't think I could use any item for the brush that already has durability because it has some other function I don't want, as in if I reskin a pickaxe it will mine, I reskin flint it will start fires, etc. Even if it loses more than one point it still has something I don't want it to do.
Durability through tags sounds like an interesting idea, though. I think I'll probably do that, thank you.

craggy ruin
#

but don't forget to make the item unbreakable then.

rich kindle
#

It shouldn't need to be if it doesn't have actual durability outside of the custom tags

craggy ruin
#

I meant for items that have durabillity

rich kindle
#

There is no item that has durability that doesn't already have a function I don't want the brush to have

atomic totem
#

How about a warped fungus on a stick, it's only functionality is walking fast with stiders and that’s not done often

#

Or a sword, if you remove it's attributes it's only "special" feature is the sweap attack

rich kindle
#

I know it probably wouldn't impact gameplay to do something like that, as the probability someone decides to pull out a brush while riding a strider for example is basically nill. Despite that though, I haven't decided if I actually want the brush to break yet, or just needs to be refilled, so if I do it through custom tags it would (probably ?) be easier to just set it to zero uses left instead of breakingentirely, unlike an item with real durability that will just break.

craggy ruin
rich kindle
#

If it's unbreakable doesn't it just not take durability damage?

craggy ruin
#

It's the same as using an item that doesn't have durability

rich kindle
#

If the point of using an item with durability is for it to have durability without me having to add custom tags as the durability system then I don't see why I would want to make it unbreakable?

#

Wouldn't that defeat the purpose of the item having durability

craggy ruin
#

I thought you didn't want to use it because it has the wrong durability or just breaks?

#

with a custom durability system you can control all of this.

rich kindle
#

I don't want the functions of items that have built in durability. Everything with durability does something that I don't want the brush to do.

#

Does something as in, not how much durability or breakage etc, but actual function of that item

#

E.g. right click with shears and they shear a sheep

craggy ruin
#

then why would you choose a shear?

#

If it shouldn't have any functions, then just use a command block.

rich kindle
# craggy ruin then why would you choose a shear?

I chose a shear originally because I didn't know if I could remove that functionality or not, which was my original question. When you said I could not, I moved onto further questions to help me be informed so I could choose what item to replace it with.

craggy ruin
#

oh, ok

rich kindle
craggy ruin
#

warped fungus on a stick

#

or ender eye (but this one has a bit more to it)

rich kindle
#

What about what you said earlier of tracking durability through a custom tag?

craggy ruin
#

when giving the item, you can add a custom tag (ex: {CustomDurability:100b})

#

every time you use the item, you can remove one from it with commands

rich kindle
#

ohhh we had different definitions of tags

#

I thought you meant item tags

craggy ruin
#

that's what it is

#

or what do you mean with item tag?

rich kindle
#

example would be

#

minecraft:wool is a tag that is on every wool block

#

oredict

craggy ruin
#

ah

#

I meant nbt tags

rich kindle
#

I thought you meant you could apply a tag like forge:brush/uses_8 and then every time it's used subtract one so next would be forge:brush/uses_7 and so on till zero where the item is now unusable

#

essentially adding durability to something without durability

craggy ruin
#

with custom nbt you can do exactly that

#

When using an item, check if the tag is not 0 and then execute the function. To remove 1 from the tag you can use an item modifier

rich kindle
#

is it possible to use different models based on nbt tags?

craggy ruin
#

yes

#

you can use the {CustomModelData:12} tag

#

in the model file of an item, you can then specify which other model it should use based on that number.

rich kindle
#

I've never written a recipe before using datapacks so this might be obvious but would I be able to make an Ingredient in a recipe require an nbt tag of CustomDurability that isn't 0 (so just anything above zero)

craggy ruin
#

sadly you can't use any nbt in a crafting recipe before 1.20

#

after 1.20 you can kind of use it.

rich kindle
#

ah that's too bad I'm on 1.19

#

I honestly might just mod in a brush item

#

I already know how to do that it just felt like too much for one item

#

So I thought I'd try datapacks

#

hm well

#

there might be a workaround

#

Can you make an item have a custom effect on right click with a datapack?

craggy ruin
#

potion effects?

rich kindle
#

Is it able to be something where if I right clicked a block and it matches an oredict tag and the item I'm right clicking with has a CustomDurability higher than 0, set that block to a different block, and change the custom durability count down by 1

craggy ruin
#

yes

#

for that, you need a raycast

rich kindle
#

What's a raycast

worldly nicheBOT
#
Raycast

If you've not made many datapacks, you might not be familiar with raycasting. It's a really useful tool which we can use to essentially find where the player is looking and then do stuff (such as spawn explosions B) ).

To create a raycast, we can use a recursive function. A recursive function is a function which will run itself over and over again. In our case, the function will run itself 0.1 blocks forward (^ ^ ^0.1) each time, and repeat until it hits something. It will do this all within the same tick - but bear in mind that the bigger the distance, the more laggy it will be. We can stop this unwanted behaviour by putting a distance limit on the raycast - each time it runs itself, it will count down on a scoreboard, and only repeat if it hasn't hit the limit.

start_raycast function:```elixir

Set the distance limit on the raycast. (10 x limit in blocks, so 1000 would be 100 blocks)

scoreboard players set .limit <objective> 1000

Start the raycast

execute at @s anchored eyes positioned ^ ^ ^.1 run function <namespace>:raycast```

raycast function:```elixir

Optional - place a particle, to make the raycast leave a trail

particle minecraft:dust 1 0 0 1 ~ ~ ~

If the raycast has hit a block, do something

execute unless block ~ ~ ~ <namespace>:pass_through run setblock ~ ~ ~ diamond_block

If the raycast hasn't hit a block, continue

execute if block ~ ~ ~ <namespace>:pass_through positioned ^ ^ ^0.1 run function <namespace>:raycast```

namespace/tags/blocks/pass_through.json: { "replace": false, "values": [ "minecraft:air", "minecraft:cave_air", "minecraft:void_air" ] }

This should be it! Make sure you add all the functions, and fill in all the blanks (indicated by <this>). Then, you can run the start_raycast function as a player, and it should work.

rich kindle
#

and how do you pull from the right click event

#

I phrased that weird

#

how do you have something like execute at @s anchored eyes positioned ^ ^ ^.1 run function <namespace>:raycast trigger on right click in a datapack

#

or is it just meant to be running constantly and if it meets the conditions such as holding a brush item with the nbt tag

craggy ruin
#

for that, you need a scoreboard that shows if you used a warped fungus on a stick. (/scoreboard objectives add click minecraft.used:warped_fungus_on_a_stick).
Then check in the tick function if a player has a score higher than 0.

#

Every time it is higher than 0 the raycast gets triggered and resets the scoreboard

rich kindle
#

is every logic statement prefaced by execute

craggy ruin
#

only at the start of the command

rich kindle
#

or does that have a meaning I don't know of

#

Alr

#

I'll play around with that function and let you know if I have more questions

craggy ruin
#

👍

rich kindle
#

Thanks for your help thus far

rich kindle
#

Also is the scoreboard compatible with any modded item? I ended up just making a small mod that added in a brush item, and I want to make on right click event, if damage > 3, replace help item with dry brush