[MC-1935] Fence gate next to a wall has an incorrect hitbox Created: 02/Nov/12  Updated: 03/Jun/17  Resolved: 15/Feb/16

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.4.3, Minecraft 1.4.5, Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w04a, Snapshot 13w05b, Snapshot 13w06a, Snapshot 13w07a, Snapshot 13w09a, Minecraft 1.5, Snapshot 13w11a, Minecraft 1.5.1, Minecraft 1.5.2, Snapshot 13w18b, Snapshot 13w18c, Snapshot 13w19a, Snapshot 13w21b, Snapshot 13w22a, Snapshot 13w23b, Snapshot 13w24a, Snapshot 13w24b, Snapshot 13w25a, Snapshot 13w26a, Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 13w36a, Minecraft 13w36b, Minecraft 13w39b, Minecraft 13w41a, Minecraft 13w41b, Minecraft 1.7.1, Minecraft 1.7.2, Minecraft 13w48a, Minecraft 13w48b, Minecraft 13w49a, Minecraft 1.7.3, Minecraft 1.7.4, Minecraft 14w02b, Minecraft 14w02c, Minecraft 14w03a, Minecraft 14w05b, Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w08a, Minecraft 1.7.5, Minecraft 14w10b, Minecraft 14w10c, Minecraft 14w11a, Minecraft 14w11b, Minecraft 1.7.9, Minecraft 14w17a, Minecraft 14w18a, Minecraft 14w20a, Minecraft 14w20b, Minecraft 14w21a, Minecraft 14w21b, Minecraft 14w25a, Minecraft 1.7.10-pre4, Minecraft 14w25b, Minecraft 14w26b, Minecraft 14w26c, Minecraft 1.7.10, Minecraft 14w28a, Minecraft 14w28b, Minecraft 14w29a, Minecraft 14w30b, Minecraft 14w30c, Minecraft 14w33c, Minecraft 14w34a, Minecraft 14w34b, Minecraft 14w34c, Minecraft 14w34d, Minecraft 1.8-pre1, Minecraft 1.8.1-pre2, Minecraft 15w44b, Minecraft 15w45a, Minecraft 15w46a, Minecraft 15w47a
Fix Version/s: Minecraft 16w07a

Type: Bug
Reporter: Leon Assignee: [Mojang] Grum (Erik Broes)
Resolution: Fixed Votes: 10
Labels: fence_gate, hitbox

Attachments: PNG File 2013-02-09_14.19.23.png     PNG File 2013-02-09_14.19.38.png     PNG File 2013-02-09_14.19.43.png     PNG File 2014-08-25_10.49.27.png     PNG File fixed-fencegate-box.png    
Issue Links:
Relates
relates to MC-1305 Iron Bar hit-boxes misaligned Resolved
relates to MC-6435 hopper has wrong collision box Resolved
relates to MC-9134 powered sloped powered, detector and ... Resolved
relates to MC-2346 Hitbox of Anvil not proportional Resolved
relates to MC-2666 Corner Cobblestone Wall Has Incorrect... Resolved
relates to MC-3034 Sign Hitbox Resolved
relates to MC-4090 Bed Hit Box is Incorrect Resolved
relates to MC-4504 the hitbox of brewing stands is missi... Resolved
relates to MC-4859 Hitbox of fern is too big Resolved
CHK:
Confirmation Status: Confirmed

 Description   

When a fence gate is between 2 cobblestone walls, the fence gate has incorrect hitboxes.



 Comments   
Comment by George Gates [ 19/Nov/15 ]

Still there in 15w47a.

Comment by Alexander [ 30/Oct/15 ]

Confirmed for 15w44b.

Comment by George Gates [ 18/Oct/14 ]

Confirmed in 1.8.1-pre2.
https://gfycat.com/PiercingCreativeHummingbird

Comment by Marcono1234 [ 19/Jun/14 ]

Confirmed for 14w25b

Comment by Itouch2 [ 25/May/14 ]

Confirmed for 14w21b.

Comment by Itouch2 [ 23/Feb/14 ]

Confirmed for 08a

Comment by branza [ 06/Oct/13 ]

Affects 1.6.4.

Comment by Markku [ 10/Jul/13 ]

A 20 seconds test in creative mode confirms this exists in 1.6.2 (as expected).

Comment by Leon [ 25/Jun/13 ]

:/

Comment by Markku [ 28/Feb/13 ]

Affects 13w09b.

Comment by Markku [ 09/Feb/13 ]

And another bites the dust.

Current code

BlockFenceGate
    public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
        int var5 = getDirection(blockAccess.getBlockMetadata(x, y, z));

        if (var5 != 2 && var5 != 0) {
            this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F);
        } else {
            this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F);
        }
    }

Fixed

BlockFenceGate
    public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
        int var5 = getDirection(blockAccess.getBlockMetadata(x, y, z));

        if (var5 != 2 && var5 != 0) {
            if (blockAccess.getBlockId(x, y, z - 1) == Block.cobblestoneWall.blockID
                    && blockAccess.getBlockId(x, y, z + 1) == Block.cobblestoneWall.blockID)
                this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 0.8125F, 1.0F); // Lower the top
            else 
                this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F);
        } else {
            if (blockAccess.getBlockId(x - 1, y, z) == Block.cobblestoneWall.blockID
                    && blockAccess.getBlockId(x + 1, y, z) == Block.cobblestoneWall.blockID)
                this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 0.8125F, 0.625F); // Lower the top
            else
                this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F);
        }
    }

Tested on 1.4.7 very briefly. May have some unexpected side results, but at least adding and removing worked as expected, and the selection box got adjusted as wished. I attached a screenshot showing the result.

However, while testing I noticed that at least in my opinion, the logical operation between the two cobblestone walls should be "or" instead of "and". It looks quite stupid as it is now, as the fencegate will be higher than the lower side block. (As also seen in the screenshot). If changed, there are two places to do the same change. This method here, and also in the RenderBlocks-class.

Comment by Markku [ 03/Feb/13 ]

The rendering code adjusts the rendered height location of the gate depending on what it has on its sides. I see no reason why the code which decides the selection box could not do the same just as well, it is just a bit more coding (or, as customary in Minecraft code, copying). No changes to metadata is needed for that.

Comment by Dean Baset [ 03/Feb/13 ]

Intended.
They want to control the fence gate's height without changing the selection box (As that would require a new metadata value rather than an NBT)

The fence model gets lowered to match the cobblestone wall's height, but they don't want to change the selection box, resulting in the small gap between the top of the gate and the top of the collision box.

Comment by Alex Campbell [ 09/Nov/12 ]

@Meta
The selection box and collision box are different things - look at fences or stone walls.

Comment by Meta [ 02/Nov/12 ]

I think that's intented as you could jump over those gates if they would lower the collision box.

Generated at Sun Jan 12 11:56:08 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.