[MC-9565] Fences and Cobblestone Walls connect to Fence Gates, which are facing the other direction Created: 10/Feb/13  Updated: 20/Jun/17  Resolved: 19/Apr/17

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w05b, Snapshot 13w06a, Minecraft 1.5.1, Minecraft 1.5.2, Snapshot 13w18c, Snapshot 13w19a, Snapshot 13w24a, Snapshot 13w24b, Snapshot 13w25a, Snapshot 13w25b, Snapshot 13w26a, Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 13w38b, Minecraft 13w38c, Minecraft 13w39a, Minecraft 13w39b, Minecraft 13w42b, Minecraft 13w43a, Minecraft 1.7.1, Minecraft 1.7.2, Minecraft 1.7.4, Minecraft 14w02c, Minecraft 14w03a, Minecraft 14w03b, Minecraft 1.7.5, Minecraft 14w11b, Minecraft 14w18b, Minecraft 14w19a, Minecraft 1.7.10, Minecraft 14w27b, Minecraft 14w28a, Minecraft 14w28b, Minecraft 14w29a, Minecraft 14w30a, Minecraft 14w30b, Minecraft 14w30c, Minecraft 14w31a, Minecraft 14w32a, Minecraft 14w32b, Minecraft 14w32c, Minecraft 14w32d, Minecraft 14w33a, Minecraft 1.8, Minecraft 1.8.1, Minecraft 1.8.6, Minecraft 1.8.8, Minecraft 15w31a, Minecraft 15w31c, Minecraft 15w32a, Minecraft 15w32b, Minecraft 15w32c, Minecraft 15w33b, Minecraft 15w33c, Minecraft 15w34a, Minecraft 15w36d, Minecraft 15w37a, Minecraft 15w43c, Minecraft 15w44b, Minecraft 15w45a, Minecraft 1.9 Pre-Release 1, Minecraft 1.10.2, Minecraft 16w32b, Minecraft 16w43a, Minecraft 1.11 Pre-Release 1, Minecraft 1.11, Minecraft 16w50a, Minecraft 1.11.1, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w13b, Minecraft 17w14a, Minecraft 17w15a
Fix Version/s: Minecraft 17w16a

Type: Bug
Reporter: bl4ckscor3 Assignee: Maria Lemón
Resolution: Fixed Votes: 19
Labels: cobblestone_wall, fence, fence_gate, rendering
Environment:

Win 8.1, Java 7, GeForce GT 640M, i7-3630QM @ 2.4GHz


Attachments: PNG File does.png     PNG File should.png    
Issue Links:
Duplicate
is duplicated by MC-17287 Fence Gate shift clicking Resolved
is duplicated by MC-21266 This is a little glitch with the fenc... Resolved
is duplicated by MC-25519 A glitch with fences and gates. Resolved
is duplicated by MC-52191 Fences connect to perpendicular gates Resolved
is duplicated by MC-68438 Fences connect to fence gate in the w... Resolved
is duplicated by MC-70732 Fence renders wrong when attached to ... Resolved
is duplicated by MC-70793 Fence Connected Texture Broken With N... Resolved
is duplicated by MC-73212 Neather fence connecting to fence gates Resolved
CHK:
Confirmation Status: Confirmed

 Description   

What I expected to happen was:

Fences don't connect with Fence Gates facing in the other direction

What actually happened was:

Fences do connect with Fence Gates facing in the other direction

Steps to Reproduce:

1. Place two Fences with a one block gap between
2. Place a Fence gate, that it looks like a cross with the two fences



 Comments   
Comment by Roadhog360 [ 12/Apr/17 ]

Still happens in 17w15a. This problem drives me insane with OCD. Please fix it.

Comment by J. W. [ 21/Dec/16 ]

I know the code has probably changed a bit since May of 2014, but maybe that sample commented from then is still a possible solution for this near 4 year old problem?

Comment by Immaterialise [ 17/Feb/16 ]

Still present in 1.9-pre1; it occurs with all fence/fence gate types, including nether brick fence and cobblestone wall.

Comment by Kumasasa [ 24/Oct/15 ]

@bl4ckscor3: It's sufficient to add the affected version, you don't need to add a "Confirmed for ..." comment.

Comment by bl4ckscor3 [ 24/Oct/15 ]

Confirmed for 15w43c

Comment by bl4ckscor3 [ 07/Aug/15 ]

Reproducable in 15w32c

Comment by bl4ckscor3 [ 06/Aug/15 ]

Still present in 15w32b

Comment by bl4ckscor3 [ 05/Aug/15 ]

Can reproduce in 15w32a

Comment by bl4ckscor3 [ 01/Aug/15 ]

Confirmed for 15w31b/c.

Comment by bl4ckscor3 [ 29/Jul/15 ]

Confirmed for 15w31a. Still all fence gate/fence combinations affected.

EDIT: Also confirmed for 1.8.8

Comment by J. P. Coder [ 04/Sep/14 ]

confimed for 1.8

Comment by HenrikoMagnifico [ 13/Aug/14 ]

14w33a confirmed

Comment by Anon Ymus [ 09/Aug/14 ]

Affects the new fences too.

Comment by Andrew Thomas [ 10/Jul/14 ]

Confirmed in 14w28b

Comment by Rando Jones [ 09/Jul/14 ]

Affects version 14w28a as well.

Using code from MCP 9.08 for MC1.7.10 I've been able to correct this in my personal mod with the following changes:

blocks/BlockFence.java
    public void addCollisionBoxesToList(World par1, int par2, int par3, int par4, AxisAlignedBB par5, List par6, Entity par7)
    {
        boolean var8 = this.func_149826_e(par1, par2, par3, par4 - 1) && (!(par1.getBlock(par2, par3, par4 - 1) instanceof BlockFenceGate) || (par1.getBlockMetadata(par2, par3, par4 - 1) & 1) == 1);
        boolean var9 = this.func_149826_e(par1, par2, par3, par4 + 1) && (!(par1.getBlock(par2, par3, par4 + 1) instanceof BlockFenceGate) || (par1.getBlockMetadata(par2, par3, par4 + 1) & 1) == 1);
        boolean var10 = this.func_149826_e(par1, par2 - 1, par3, par4) && (!(par1.getBlock(par2 - 1, par3, par4) instanceof BlockFenceGate) || (par1.getBlockMetadata(par2 - 1, par3, par4) & 1) == 0);
        boolean var11 = this.func_149826_e(par1, par2 + 1, par3, par4) && (!(par1.getBlock(par2 + 1, par3, par4) instanceof BlockFenceGate) || (par1.getBlockMetadata(par2 + 1, par3, par4) & 1) == 0);
.
.
.

    public void setBlockBoundsBasedOnState(IBlockAccess par1, int par2, int par3, int par4)
    {
        boolean var5 = this.func_149826_e(par1, par2, par3, par4 - 1) && (!(par1.getBlock(par2, par3, par4 - 1) instanceof BlockFenceGate) || (par1.getBlockMetadata(par2, par3, par4 - 1) & 1) == 1);
        boolean var6 = this.func_149826_e(par1, par2, par3, par4 + 1) && (!(par1.getBlock(par2, par3, par4 + 1) instanceof BlockFenceGate) || (par1.getBlockMetadata(par2, par3, par4 + 1) & 1) == 1);
        boolean var7 = this.func_149826_e(par1, par2 - 1, par3, par4) && (!(par1.getBlock(par2 - 1, par3, par4) instanceof BlockFenceGate) || (par1.getBlockMetadata(par2 - 1, par3, par4) & 1) == 0);
        boolean var8 = this.func_149826_e(par1, par2 + 1, par3, par4) && (!(par1.getBlock(par2 + 1, par3, par4) instanceof BlockFenceGate) || (par1.getBlockMetadata(par2 + 1, par3, par4) & 1) == 0);
.
.
.
   public boolean func_149826_e(IBlockAccess par1, int par2, int par3, int par4)
    {
        Block var5 = par1.getBlock(par2, par3, par4);
        
        boolean ret = (var5 == this);
        if (!ret)
        {
	        if (var5 instanceof BlockFence)
	        {
	        	ret = this.blockMaterial == var5.blockMaterial;
	        }
	        else if (var5 instanceof BlockFenceGate)
	        {
	        	ret = true;
	        }
	        else if (var5.blockMaterial.isOpaque() && var5.renderAsNormalBlock())
	        {
	        	ret = var5.blockMaterial != Material.field_151572_C; //don't connect to melons or pumpkins
	        	ret = ret && var5 != Blocks.hay_block;
	        }
        }
        else //always connect to self
        {
        	ret = true;
        }
        
        return ret;
    }
client/renderer/RenderBlocks.java
    public boolean renderBlockFence(BlockFence par1, int par2, int par3, int par4)
    {
.
.
.
				Block nearBlock = null;

        if (par1.func_149826_e(this.blockAccess, par2 - 1, par3, par4) || par1.func_149826_e(this.blockAccess, par2 + 1, par3, par4))
        {
            if (!(this.blockAccess.getBlock(par2 - 1, par3, par4) instanceof BlockFenceGate) || (this.blockAccess.getBlockMetadata(par2 - 1, par3, par4) & 1) == 0)
            {
            	var8 = true;
            }
            else if (!(this.blockAccess.getBlock(par2 + 1, par3, par4) instanceof BlockFenceGate) || (this.blockAccess.getBlockMetadata(par2 + 1, par3, par4) & 1) == 0)
            {
            	var8 = true;
            }
        }

        if (par1.func_149826_e(this.blockAccess, par2, par3, par4 - 1) || par1.func_149826_e(this.blockAccess, par2, par3, par4 + 1))
        {
            if (!(this.blockAccess.getBlock(par2, par3, par4 - 1) instanceof BlockFenceGate) || (this.blockAccess.getBlockMetadata(par2, par3, par4 - 1) & 1) == 1)
            {
            	var9 = true;
            }
            else if (!(this.blockAccess.getBlock(par2, par3, par4 + 1) instanceof BlockFenceGate) || (this.blockAccess.getBlockMetadata(par2, par3, par4 + 1) & 1) == 1)
            {
            	var9 = true;
            }
				}

        boolean var10 = par1.func_149826_e(this.blockAccess, par2 - 1, par3, par4) && (!(this.blockAccess.getBlock(par2 - 1, par3, par4) instanceof BlockFenceGate) || (this.blockAccess.getBlockMetadata(par2 - 1, par3, par4) & 1) == 0);
        boolean var11 = par1.func_149826_e(this.blockAccess, par2 + 1, par3, par4) && (!(this.blockAccess.getBlock(par2 + 1, par3, par4) instanceof BlockFenceGate) || (this.blockAccess.getBlockMetadata(par2 + 1, par3, par4) & 1) == 0); 
        boolean var12 = par1.func_149826_e(this.blockAccess, par2, par3, par4 - 1) && (!(this.blockAccess.getBlock(par2, par3, par4 - 1) instanceof BlockFenceGate) || (this.blockAccess.getBlockMetadata(par2, par3, par4 - 1) & 1) == 1);
        boolean var13 = par1.func_149826_e(this.blockAccess, par2, par3, par4 + 1) && (!(this.blockAccess.getBlock(par2, par3, par4 + 1) instanceof BlockFenceGate) || (this.blockAccess.getBlockMetadata(par2, par3, par4 + 1) & 1) == 1);
.
.
.

Sorry to dump this on you - I hope your open to coding changes with actual code examples. I just made a suggestion in reddit/minecraftSuggestions about this very issue.

This same code can be used to fix BlockWall as well.

Note that changes to BlockFence.java/func_149826_e contain some alterations to make fences not connect to melons or hay blocks; exclude that at your preference.

Comment by bl4ckscor3 [ 11/May/14 ]

Confirmed for 14w18b and 14w19a

Comment by Itouch2 [ 16/Mar/14 ]

Confirmed for 1.7.5 and 14w11b

Comment by Anon Ymus [ 29/Sep/13 ]

Please do not mark unreleased versions (anything starting with "Future Version") as affected. You don't have access to them yet.

Comment by Anon Ymus [ 10/Feb/13 ]

Confirmed.

Generated at Sun Jan 12 12:21:30 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.