Blood Magic

Blood Magic

90M Downloads

[1.10.2]Sentient sword Spawns can hurt other people when PVP is disabled or teammembers

Speiger opened this issue ยท 3 comments

commented

Its a rehash of this one since you guys disabled my ability to speak there.
You should not do that instantly since i am a person who would like to provide help to fix that issue.

Original post: #1121

Here is the issue:
https://github.com/WayofTime/BloodMagic/blob/1.9/src/main/java/WayofTime/bloodmagic/entity/mob/EntitySentientSpecter.java#L290

This code allows Sentientiens to attack other entities. But what if this Entity is a Player and we have PVP disabled? It clearly can bypass the pvp protection.

Reference where the Owner of that entity is set:
https://github.com/WayofTime/BloodMagic/blob/1.9/src/main/java/WayofTime/bloodmagic/item/soul/ItemSentientSword.java#L522

Arrows cant bypass protection even so they are indirect damage too.
And here is the proof. the Shooter can not hurt a Player if PVP is disabled.

            if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
            {
                EntityPlayer entityplayer = (EntityPlayer)movingobjectposition.entityHit;

                if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(entityplayer))
                {
                    movingobjectposition = null;
                }
            }

This includes also Team Support. Sentient swords can even hurt team members even so they should not do that.

It would be nice next time to allow me to show what that issue is.
This proof comes from the 1.9 source here on github. So it is the latest source even if it is Unreleased!
So no issue in this area.

Fix suggestion:
Make a target check if the target is a Player and if the owner is a player then check if the target can be attackt by the host.

commented

@PapiDimmi enough proof that its not fixed already?
Also there is no forge required in that. its pure MC code.

commented

I disabled messages in there because I know it's a bug and Papi was spamming. I'm doing the same here.

commented

If a thread is locked, it means we do NOT want another thread opened about the same issue. As you can see, the other thread is still open. If this happens again (not referring to you necessarily) we may have to bar posting access, since it's kind of ridiculous.