[MC-2938] Different types of fences and walls don't connect Created: 14/Nov/12  Updated: 08/Apr/20  Resolved: 06/Oct/16

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.4.4, Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w04a, Snapshot 13w09a, Snapshot 13w09b, Snapshot 13w09c, Snapshot 13w10b, Minecraft 1.5, Minecraft 1.5.2, Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 1.7.4, Minecraft 14w03b, Minecraft 14w08a, Minecraft 1.7.5, Minecraft 14w10b, Minecraft 14w10c, Minecraft 14w11b, Minecraft 14w17a, Minecraft 1.8, Minecraft 1.8.8, Minecraft 15w47c, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 16w35a
Fix Version/s: None

Type: Bug
Reporter: Jlam96 Assignee: [Mojang] Grum (Erik Broes)
Resolution: Works As Intended Votes: 14
Labels: redstone, rendering
Environment:

Windows 7, Java 7


Attachments: PNG File 2013-03-10_18.44.54.png     PNG File 2013-03-10_18.47.22.png     PNG File borked_fences.png     PNG File fixed-backofstairs-fences.png     PNG File fixed_fences_pistons.png    
Issue Links:
Duplicate
is duplicated by MC-11527 Iron Bars & Glass Panes with Cobblest... Resolved
is duplicated by MC-20733 Glass Panes do not connect to iron bars Resolved
is duplicated by MC-177808 Wooden fences dont link to other fenc... Resolved
Relates
relates to MC-8345 Placing torch on backside of stairs i... Resolved
relates to MC-9176 Glass panes not correctly rendering w... Resolved
relates to MC-10613 Fence doesn't connect with stairs Resolved
relates to MC-27428 Wooden Fence doesn't connect with Cob... Resolved
relates to MC-34985 gate and fence bug Resolved
relates to MC-66300 nether brick fence don't connect with... Resolved
CHK:
Confirmation Status: Confirmed

 Description   

What I expected to happen was...:
The blocks should have connected while being pushed.

What actually happened was...:
When they were being pushed, they connected to solid blocks but not to each other.

Steps to Reproduce:
1. Push multiple bars, panes, fences or walls with a piston.
2. Put solid blocks next to them.
3. They will connect to the solid blocks but not to each other while they are pushed.



 Comments   
Comment by user-f2760 (Inactive) [ 05/Sep/14 ]

confirmed for 1.8

Comment by Itouch2 [ 09/Aug/14 ]

It will be completely fixed in 1.9 according to Searge

Comment by Markku [ 09/Aug/14 ]

That still leaves (partially overlapping) issues:
MC-10613 Fences doesn't connect with stairs
MC-11527 Iron Bars & Glass Panes with Cobblestone Walls
MC-20733 Glass Panes do not connect to iron bars
MC-35272 Iron bars/glass panes sticky piston graphical glitch
MC-35665 Glass panes don't join up correctly with ice blocks
MC-41886 Piston Glass Bug
MC-49644 Glass panes not connecting to ice

I think MC-36454 Fences Not Attaching is also WAI and should now be detached.

That is why I thought it might be better leave this issue open, as it is mostly about other issues than the ones that have now been solved. The way the issues are now marked, the fence vs. wall connection resolved as WAI and marked (previously) to this issue translates to all the other issues marked as WAI, too (via duplication resolution)

Comment by Kumasasa [ 09/Aug/14 ]

Detached MC-27428 and MC-34985 , but MC-9176 is still open.

Comment by Markku [ 09/Aug/14 ]

Since several different bugs were made duplicates of this issue, but only one part of them was now fixed and/or made WAI, it might be proper to detach and reopen the other ones. For example, have the bars/panes or connecting to back of stairs been fixed or declared WAI (latter would be just stupid, imho)?

Or maybe better to actually detach the MC-27428 and MC-34985 from this and declare them as WAI, leave this one open.

Edit: would also be nice if Mojang would stop using Twitter as the official bug management system. Apparently reporting issues there works, and Mojang likes to state the results there, too, instead of this JIRA.

Comment by qmagnet [ 09/Aug/14 ]

I think this bug can be resolved as of 14w32d

  • Walls do not connect to fences (WAI)
  • Nether fences do not connect to fences (WAI)
  • Panes and bars do connect (Tested in 14w32d)

https://twitter.com/_grum/status/497382456111431680
https://twitter.com/_grum/status/497489801386684416
https://twitter.com/_grum/status/497500228048936960

Comment by Itouch2 [ 25/Apr/14 ]

Confirmed for 14w17a

Comment by Itouch2 [ 15/Mar/14 ]

Confirmed for 14w11b

Comment by Itouch2 [ 11/Mar/14 ]

Confirmed for 1.7.5 and 14w10c

Comment by Galaxy_2Alex [ 21/Jan/14 ]

Iron Bars and Glass Panes are connecting in 1.7.

Comment by Markku [ 30/Sep/13 ]

Still in 1.6.4.

Comment by [Mod] CubeTheThird [ 26/Sep/13 ]

Is this still a concern in the current Minecraft version 1.6.4 / Launcher version 1.2.5 ? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Comment by Richard Meyer [ 11/Mar/13 ]

Attached images of Glass panes and Iron bars with cobblestone walls. Likely applies to fences too.

Comment by Markku [ 01/Mar/13 ]

These fixes are in addition to the fixes above. Also, it would be best to fix all of this, MC-9176 and MC-8345 at the same time; the code changes are pretty much shared/similar. Also, once all fixes are imported, might be a good idea to take a look at the duplication and functionality over all, and give some much needed object-oriented love to the related code. Would reduce the amount of code, make coding new similar features a blink (instead of a pain of bugs), and thus reduce "maintenance costs".

Fixes

BlockFence
    public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
//        boolean north = this.canConnectFenceTo(world, x, y, z - 1);
//        boolean south = this.canConnectFenceTo(world, x, y, z + 1);
//        boolean west = this.canConnectFenceTo(world, x - 1, y, z);
//        boolean east = this.canConnectFenceTo(world, x + 1, y, z);
        boolean north = this.canFenceAtConnectToDir(world, x, y, z, 3);
        boolean south = this.canFenceAtConnectToDir(world, x, y, z, 2);
        boolean west = this.canFenceAtConnectToDir(world, x, y, z, 5);
        boolean east = this.canFenceAtConnectToDir(world, x, y, z, 4);
        ...

    public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
//        boolean north = this.canConnectFenceTo(blockAccess, x, y, z - 1);
//        boolean south = this.canConnectFenceTo(blockAccess, x, y, z + 1);
//        boolean west = this.canConnectFenceTo(blockAccess, x - 1, y, z);
//        boolean east = this.canConnectFenceTo(blockAccess, x + 1, y, z);
        boolean north = this.canFenceAtConnectToDir(blockAccess, x, y, z, 3);
        boolean south = this.canFenceAtConnectToDir(blockAccess, x, y, z, 2);
        boolean west = this.canFenceAtConnectToDir(blockAccess, x, y, z, 5);
        boolean east = this.canFenceAtConnectToDir(blockAccess, x, y, z, 4);
        ...

    /**
     * @param dir 1 = bottom, 2 = z+1, 3 = z-1, 4 = x+1, 5 = x-1,  top = 0 or anything else
     */
    public boolean canFenceAtConnectToDir(IBlockAccess access, int x, int y, int z, int dir) {
        switch (dir) {
            case 2: { z++; break; }
            case 3: { z--; break; }
            case 4: { x++; break; }
            case 5: { x--; break; }
            default: return false;
        }
        
        if (this.canConnectFenceTo(access, x, y, z)) return true; // Old check
        int blockId = access.getBlockId(x, y, z);
        // Checking for full solid surface to touch..
        Block block = Block.blocksList[blockId];
        if (block == null)
            return false;
        return block.hasSolidFullSurfaceAt(access, x, y, z, dir);
    }
BlockWall
    public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
//        boolean north = this.canConnectWallTo(blockAccess, x, y, z - 1);
//        boolean south = this.canConnectWallTo(blockAccess, x, y, z + 1);
//        boolean west = this.canConnectWallTo(blockAccess, x - 1, y, z);
//        boolean east = this.canConnectWallTo(blockAccess, x + 1, y, z);
        boolean north = this.canWallAtConnectToDir(blockAccess, x, y, z, 3);
        boolean south = this.canWallAtConnectToDir(blockAccess, x, y, z, 2);
        boolean west = this.canWallAtConnectToDir(blockAccess, x, y, z, 5);
        boolean east = this.canWallAtConnectToDir(blockAccess, x, y, z, 4);
        ...

    public boolean canWallAtConnectToDir(IBlockAccess access, int x, int y, int z, int dir) {
        switch (dir) {
            case 2: { z++; break; }
            case 3: { z--; break; }
            case 4: { x++; break; }
            case 5: { x--; break; }
            default: return false;
        }
        
        if (this.canConnectWallTo(access, x, y, z)) return true; // Old check
        int blockId = access.getBlockId(x, y, z);
        // Checking for full solid surface to touch..
        Block block = Block.blocksList[blockId];
        if (block == null)
            return false;
        return block.hasSolidFullSurfaceAt(access, x, y, z, dir);
        
    }

(Below, note the swapped order; halves the number of calls to the method.)

RenderBlocks
    public boolean renderBlockFence(BlockFence blockFence, int x, int y, int z) {
        ...
//        if (blockFence.canConnectFenceTo(this.blockAccess, x - 1, y, z) || blockFence.canConnectFenceTo(this.blockAccess, x + 1, y, z)) {
//            var8 = true;
//        }
//
//        if (blockFence.canConnectFenceTo(this.blockAccess, x, y, z - 1) || blockFence.canConnectFenceTo(this.blockAccess, x, y, z + 1)) {
//            var9 = true;
//        }
//
//        boolean west = blockFence.canConnectFenceTo(this.blockAccess, x - 1, y, z);
//        boolean east = blockFence.canConnectFenceTo(this.blockAccess, x + 1, y, z);
//        boolean north = blockFence.canConnectFenceTo(this.blockAccess, x, y, z - 1);
//        boolean south = blockFence.canConnectFenceTo(this.blockAccess, x, y, z + 1);
        boolean west = blockFence.canFenceAtConnectToDir(blockAccess, x, y, z, 5);
        boolean east = blockFence.canFenceAtConnectToDir(blockAccess, x, y, z, 4);
        boolean north = blockFence.canFenceAtConnectToDir(blockAccess, x, y, z, 3);
        boolean south = blockFence.canFenceAtConnectToDir(blockAccess, x, y, z, 2);

        if (west || east) {
            var8 = true;
        }
        if (north || south) {
            var9 = true;
        }
        ...

    public boolean renderBlockWall(BlockWall blockWall, int x, int y, int z) {
//        boolean west = blockWall.canConnectWallTo(this.blockAccess, x - 1, y, z);
//        boolean east = blockWall.canConnectWallTo(this.blockAccess, x + 1, y, z);
//        boolean north = blockWall.canConnectWallTo(this.blockAccess, x, y, z - 1);
//        boolean south = blockWall.canConnectWallTo(this.blockAccess, x, y, z + 1);
        boolean west = blockWall.canWallAtConnectToDir(blockAccess, x, y, z, 5);
        boolean east = blockWall.canWallAtConnectToDir(blockAccess, x, y, z, 4);
        boolean north = blockWall.canWallAtConnectToDir(blockAccess, x, y, z, 3);
        boolean south = blockWall.canWallAtConnectToDir(blockAccess, x, y, z, 2);
        ...

Changes were tested against 1.4.7; the example screenshot 'fixed-backofstairs-fences.png' is from there (along with fixes applies to the two already mentioned other issues).

Comment by Markku [ 01/Mar/13 ]

Fixed also fences/walls with backsides of stairs. Especially nice looking combinations with equal materials. Code fixes coming...

Comment by Markku [ 01/Mar/13 ]

Affects 13w09c.

Comment by Markku [ 28/Feb/13 ]

Affects 13w09b. (And last check on my list (of 34 total I've provided some kind of fix for ), so good night, Tails, and thanks for all the updates. Though two more are waiting for the same handling, MC-526 and MC-2788.)

Comment by Markku [ 27/Feb/13 ]

(Perhaps a moderator would adjust the summary to remove the pistons part, as that seems to be irrelevant for this issue.)

The behavior seems to have nothing to do with pistons, but with the overall visual rendering of all the "slim" shaped blocks (fences, panes, bars, walls, fencegates). See the screenshot 'borked_fences.png' (which is with 1.4.7 and no pistons needed).

I made the necessary fixes to connect each of them with each other type, and now it works also when they are both in static case and when been moved by pistons. That is, they automatically connect or "switch direction" as needed after moved. In fact, it is impossible to move them so that they would keep their original orientation (except fencegate), as there is no direction info (except for that fencegate). See the screenshot 'fixed_fences_pistons.png' for the fixed situation.

The needed code changes are quite small and straight forward... coming right up...

Fixes

BlockPane
    public final boolean canThisPaneConnectToThisBlockID(int par1) {
        return Block.opaqueCubeLookup[par1] || par1 == Block.thinGlass.blockID || par1 == Block.glass.blockID // MINOR CHANGE
                || par1 == Block.fence.blockID || par1 == Block.fenceIron.blockID               // ADDED
                || par1 == Block.netherFence.blockID || par1 == Block.cobblestoneWall.blockID   // ADDED
                || par1 == Block.fenceGate.blockID;                                             // ADDED
    }
BlockFence
    public boolean canConnectFenceTo(IBlockAccess blockAccess, int par2, int par3, int par4) {
        int bid = blockAccess.getBlockId(par2, par3, par4);
        if (bid != Block.fence.blockID && bid != Block.fenceGate.blockID                   // MINOR CHANGE
                && bid != Block.fenceIron.blockID && bid != Block.netherFence.blockID        // ADDED
                && bid != Block.cobblestoneWall.blockID && bid != Block.thinGlass.blockID) { // ADDED
            ...
BlockWall
    public boolean canConnectWallTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
        int var5 = par1IBlockAccess.getBlockId(par2, par3, par4);
        if (var5 != this.blockID && var5 != Block.fenceGate.blockID
                && var5 != Block.fenceIron.blockID && var5 != Block.netherFence.blockID // ADDED
                && var5 != Block.fence.blockID && var5 != Block.thinGlass.blockID) {    // ADDED
            ...

The minor changes are needed so that iron bars connect to glass panes, and for nether fences to connect with normal fences. Also note that fence gate orientation is not checked, but it wasn't checked earlier either (for those blocks with which there was connection), but that would be another bug/"feature".

Fixes tested on 1.4.7

I'd change all these block types to use a single method, along the lines of "isSlimFenceStyleBlockWithAutoOrientation()" and adjust the fixes correspondingly. That would make the code cleaner, and would be more "future proof". (This issue is a good example what happens when that guideline is not followed.) The above fixes are in the current design/style just to keep the fixes simple and easier to understand what the change does.

Note that some of them do not connect visually well (especially walls and fences), but then again, the current way of not connecting at all looks even worse.

Comment by Tails [ 27/Jan/13 ]

Confirmed in 13w04a.

Comment by Kumasasa [ 14/Nov/12 ]

Where is the bug ? That's at most an annoyance.

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