#shears damage
1 messages · Page 1 of 1 (latest)
I set the meta back to usedShears but now the damage is reset after looping through all of the nearby sheep
?paste
Wait i dont why not work the command
Allrigh
I will check it
What are you trying to do
I didnt understand
Sorry but im not native speaker and sometimes its really difficult to me to understand what you want
The plugin shears all sheep in a 3 block radius of the sheared sheep
it works except for giving the shears damage
here is the full code https://paste.md-5.net/evuviseceg.java
Allright
A recommendation
Dont have listeners on main class
do it on another class
yeah I thought this was going to be more simple, I'll refactor it
the issue in the paste is specifically between lines 73 and 82
setting the itemMeta didn't keep the damage at the end
fixed ?
no I'm still trying to figure it out
I changed up the code though so I'll make a new paste of it
now it's saying the shears are broken everytime
simple operator error
hang on
[13:58:31] [Server thread/INFO]: Collected list of nearby entities
[13:58:31] [Server thread/INFO]: Found 26
[13:58:31] [Server thread/INFO]: Looping through entities
[13:58:31] [Server thread/INFO]:
[13:58:31] [Server thread/INFO]: shearing sheep
[13:58:31] [Server thread/INFO]: Shears damaged. Current Damage: 56
[13:58:31] [Server thread/INFO]:
[13:58:31] [Server thread/INFO]: shearing sheep
[13:58:31] [Server thread/INFO]: Shears damaged. Current Damage: 57
[13:58:31] [Server thread/INFO]:
[13:58:31] [Server thread/INFO]: shearing sheep
[13:58:31] [Server thread/INFO]: Shears damaged. Current Damage: 58
[13:58:31] [Server thread/INFO]:
[13:58:31] [Server thread/INFO]: shearing sheep
[13:58:31] [Server thread/INFO]: Shears damaged. Current Damage: 59
[13:58:31] [Server thread/INFO]:
[13:58:31] [Server thread/INFO]: shearing sheep
[13:58:31] [Server thread/INFO]: Shears damaged. Current Damage: 60```
this goes all the way to 80 damage
[14:00:39] [Server thread/INFO]: Collected list of nearby entities
[14:00:39] [Server thread/INFO]: Found 2
[14:00:39] [Server thread/INFO]: Looping through entities
[14:00:39] [Server thread/INFO]: PLAYER is not a sheep, continuing
[14:00:39] [Server thread/INFO]: Original sheep, continuing
[14:00:39] [Server thread/INFO]:
[14:00:39] [Server thread/INFO]: shearing sheep
[14:00:39] [Server thread/INFO]: Shears damaged. Current Damage: 56```
when I shear sheep again, damage is reset
[14:01:23] [Server thread/INFO]: Collected list of nearby entities
[14:01:23] [Server thread/INFO]: Found 4
[14:01:23] [Server thread/INFO]: Looping through entities
[14:01:23] [Server thread/INFO]: PLAYER is not a sheep, continuing
[14:01:23] [Server thread/INFO]:
[14:01:23] [Server thread/INFO]: shearing sheep
[14:01:23] [Server thread/INFO]: Shears damaged. Current Damage: 56
[14:01:23] [Server thread/INFO]:
[14:01:23] [Server thread/INFO]: shearing sheep
[14:01:23] [Server thread/INFO]: Shears damaged. Current Damage: 57
[14:01:23] [Server thread/INFO]:
[14:01:23] [Server thread/INFO]: shearing sheep
[14:01:23] [Server thread/INFO]: Shears damaged. Current Damage: 58
[14:01:23] [Server thread/INFO]: Original sheep, continuing```
and this is with 4 sheep
Hum
I think that every entity has a unique id
Like players
If not i dont find the cause
yeah, it's weird
line 52 should work
in the paste
usedShears.setItemMeta(usedShearsMeta);
Its not working?
no the damage is reset
Why doing Array - 1?
because the player is always grabbed in the list
Ah allright
so length excluding player
Yeah
Wait
This
Damageable usedShearsMeta = (Damageable) usedShears.getItemMeta();
doesnt convince mee
opensource jdk 17
cuz i only do plugins on 1.8x
language level 17
of spigot sorry
it's cast to the Damageable interface used for dealing with item damage
Ah allright
because ItemStack item.getDurability and item.setDurability is deprecated
Im really clown