Sheep locking against a fence

Post any bugs that you find *in the mod* here. This place is NOT for posting installation errors or bugs with vanilla Minecraft, or add-on mods.
Locked
Mesh
Posts: 210
Joined: Sun May 12, 2013 6:24 pm

Sheep locking against a fence

Post by Mesh »

I read the (now locked) thread in the Bug Reports forum about the sheep being locked against a fence post and I just wanted to come on and mention that this is a common problem with all animals, not just sheep. I'm not sure if it's more of a regular occurence in SMP, but we get it happening often and always have. I've never mentioned it because I figured it was just a well known problem of vanilla considering how often it happens (always with penned animals in our experience) but after reading your replies it seems you are perhaps not aware of it? Unless of course I'm miss-understanding this bug, hence why I'm posting it in this forum.

We reached a generally accepted explanation for this problem along the lines of animals standing right next to a fence when the chunk is unloaded are considered by the game to be standing on said block and when the chunk is reloaded the mob has an option to move onto a block either side of the fence. It's why animals consistently escape fanced areas unless they are "double fenced" or are fenced against an outer wall so their path is still blocked. If the latter is the case then the animals just stay "stuck" inside the fence; cows don't eat grass and fill their udders, sheep don't regrow wool. All types of animals are visibly spooked when blocks are broken nearby but do not move. To free them you end up having to break the fence they are occupying or the one next to it.

Again I apologise if this is not the bug that was reported, but from what I read it seemed like the same thing and I just wanted to point out that we have experienced it many times, so I thought I'd make a post on the off-chance it isn't known already.
User avatar
Kazuya Mishima
Posts: 411
Joined: Thu Feb 16, 2012 4:09 pm

Re: Sheep locking against a fence

Post by Kazuya Mishima »

That was the really frustrating problem with my latest playthrough. Early game I was able to pen two sheep but one would always get geometry-locked at the north-western corner of my pen and would not eat grass and replenish it's wool. In general I had tons of problems with early game animals. Prior to getting wheat I lost a few cows that got consumed by blocks. Its' a sort of devil's bargain: you can use walls to pen your cows or sheep in but then you risk them being annihilated by the block during chunk load but they will be able to move around and eat grass, you could use fence posts and make sure no cow or sheep dies but they will get stun-locked infinitely by the post essentially reducing you to one less penned animal. In and early game situation neither outcome is desirable.

Ultimately glass, yes GLASS was my workaround - it has a property as a block that makes it unable to suffocate I believe. Ugly and requires crucible tech but cows, sheep can't get enveloped by it.

I found it was possible to remove the sheep, cow from the fence-lock by just walking into them. There didn't seem to be a need to break the fence post.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: Sheep locking against a fence

Post by FlowerChild »

Just had a thought on this while working on something else. The following is more notes to myself than anything:

Fences don't store their shape. Instead, they adapt on the fly to whatever is neighboring them. I suspect that what might be happening here is that fences neighboring on unloaded chunks are temporarily thinking that they don't have a neighboring fence, and thus the struts that would normally be there, aren't.

So, under this theory, animals would slip between fence posts during load, then get embedded in them once the neighboring chunks are loaded and the struts reappear.

I believe fences don't make any use of their metadata, so I should be able to store connection status in there to potentially resolve this.

Going to move this over to bug reports until I get around to taking care of the above.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: Sheep locking against a fence

Post by FlowerChild »

Ok, going to ask for additional feedback and discussion on this one:

What I'm doing for next release is changing the oak fences to the scheme that I mentioned above to try and help resolve this issue. What would be super cool is if you guys could try similar tests on them to see if the same problems result. I'm only doing it for oak right now as the other fence types would require me to split them into new blocks because of the way I originally implemented them as part of sub-blocks like moulding and siding. If this works well, I'll do the same for the others too.

In order for the tests to be 100% valid the oak fences used will have to be newly placed. Old ones will adjust over time to conform to the new system, but they'll have to be new to be 100% certain they've already done so.

One thing I've noticed in my own tests though is that animals seem to suffocate in single-wide full block (like dirt) barriers, whereas if you double layer them they seem to be fine. This is making me wonder if the issue is really with fences themselves, or if this is just a more general collision issue that I need to resolve with a more far-reaching solution.
User avatar
dawnraider
Posts: 1876
Joined: Sun Dec 11, 2011 7:00 pm

Re: Sheep locking against a fence

Post by dawnraider »

I've had issues in the past of animals in pits suffocating in the walls on opening a save game, which I always remedied by making the walls glass or fences. So I suspect it is probably more than just fences.
Come join us on discord! https://discord.gg/fhMK5kx
Get the Deco Addon here!
Get the Better Terrain Addon here!
Get the Vanilla Mix TP here!
Get the Conquest TP here!
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: Sheep locking against a fence

Post by FlowerChild »

dawnraider wrote:I've had issues in the past of animals in pits suffocating in the walls on opening a save game, which I always remedied by making the walls glass or fences. So I suspect it is probably more than just fences.
Yes, there's certainly a larger problem with collisions in general, but there's also the question as to whether there's something specific going on with fences here that's independent of that.

That's what this upcoming test is intended to try and figure out, so your suspicions about other blocks aren't really relevant to that.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: Sheep locking against a fence

Post by FlowerChild »

Well, I think I may have fixed an aspect of fences, but it was a side-effect of switching to one of my custom block models in the process of making the change I described above.

I just found out that there's a really weird deal going on in older versions of Minecraft (1.5.2 included) with the client and server threads in SSP wrestling over the collision data for a bunch of blocks, and frequently getting muddled in the process. It looks like this is a big part of why things got so messed up with collisions when that whole Minecraft SMP/SSP unification update fiasco happened.

So blocks all over the place evaluating collision versus the wrong shape. I had the right general idea as to what was happening with the shapes being temporarily off, but misinterpreted the root cause, and inadvertently fixed the right problem while attempting a fix for the wrong one :)

I need to mull over what to do about this. It looks like it actually requires a fairly heavy reworking of some vanilla code. Also: the SMP problems are something else entirely from what I'm talking about here. I'll still need to address the SMP issues as well.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: Sheep locking against a fence

Post by FlowerChild »

Care to trip ye some hairy testicles?
Spoiler
Show
Fixed for next release.
User avatar
jorgebonafe
Posts: 2714
Joined: Mon Sep 19, 2011 3:22 am
Location: Brasil

Re: Sheep locking against a fence

Post by jorgebonafe »

FlowerChild wrote:Care to trip ye some hairy testicles?
I dont know why, in my mind I heard that in David Tennant's voice...
Better Than Wolves was borne of anal sex. True Story.
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: Sheep locking against a fence

Post by FlowerChild »

Lol! Pfffffft... This bug is a many tentacled beasty!

So, turns out I fixed collisions. That rules, and is pure awesomesauce of epic proportions. So, animals won't get locked in walls and suffocate anymore. Huzah!

The real kick in the pants I just discovered though is that it looks like there's also an AI component to them getting locked in fences. They aren't actually embedded in them anymore, and I've got a shit ton of debug code to verify that's the case, but they also still like to just stand around in fence corners and hang out.

So, not quite dead yet :)
User avatar
FlowerChild
Site Admin
Posts: 18753
Joined: Mon Jul 04, 2011 7:24 pm

Re: Sheep locking against a fence

Post by FlowerChild »

Spoiler
Show
Locked