OvercastNetwork / SportBukkit

CraftBukkit and Bukkit modifications that improve stability and add new features
100 stars 85 forks source link

Fix leash interaction bugs #125

Closed ShinyDialga closed 9 years ago

ShinyDialga commented 9 years ago

Currently, there is a bug where if you right click a fence with a certain item it glitches. This due to the fact leashes allow the player to interact with fences, even though they don't need to hold a leash. This patch fixes it by checking their held item, and if it is one that causes a glitch, then end it there instead of going on to start the glitch. It also checks if the player has a leash attached to them to make sure that it won't cancel the leash being attached when they interact a fence. I had good results after testing this several times on my local, but feel free to test it out to find any potential bugs that could arise from this. While testing, I attempted to re-create 1.7.10 behavior, and it seems to be functioning properly so far. Thanks.

jedediah commented 9 years ago

Does this let you draw a bow while looking at a fence?

ShinyDialga commented 9 years ago

You will continue interacting with the fence like it did before, it just won't let you right click it so that your bow will still be drawn. So no, when you right click a fence your bow won't draw to both the server and your client.

ShinyDialga commented 9 years ago

Just added a commit to add food, and checked it using instanceof instead of using Item[]. In case my last comments weren't clear, I'm sharing this information I learned. When leashes were added, they allowed the interaction of fences so that you can add leashes to them. By making them interactable, the client cannot see what changes when they right click a fence. For example, when you draw your bow while right clicking a fence, all you see is an interaction between the fence, while the server thinks you are charging up a bow. This code attempts to fix that by cancelling the interaction before it occurs if the item will cause any glitches.

tonybruess commented 9 years ago

How well is this tested? I'm down to merge it.

ShinyDialga commented 9 years ago

I tested this with me and @Electroid and found no issues, but feel free to test it to make sure there are none. There were 6 possible outcomes, and they were when you right click a fence with nothing, a leash, or a separate item, and the same things while a leash was attached to your character. They all matched vanilla 1.7.10 behavior, and I found no other bugs. If you'd like to try it out, go ahead.

ShinyDialga commented 9 years ago

Doesn't appear to be an issue anymore as of 1.8, closing this PR.