Jump to content

Custom Glass_Block won`t connect to its Glass_panes


Norzeteus

Recommended Posts

Hi mates!

At first, I`ll tell you, that I`m a newby at forgemodding.....

I created a custom glass_block, it works fine. I also created some glass_panes to it, they work fine, connect together and with all other blocks and glassblocks and glasspanes.

My problem now is, that this glasspanes won`t connect to "its" glassblock and I couldn`t figure out why.

 

 

 

Code Glassblock

 

package com.space.extended.basicblocks;

 

import java.util.Random;

 

import net.minecraft.block.BlockBreakable;

import net.minecraft.block.SoundType;

import net.minecraft.block.material.Material;

import net.minecraft.block.state.IBlockState;

import net.minecraft.util.BlockRenderLayer;

import net.minecraft.util.EnumFacing;

import net.minecraft.util.math.BlockPos;

import net.minecraft.world.IBlockAccess;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

 

public class BlockVitallium_Glass extends BlockBreakable{

 

public BlockVitallium_Glass(Material materialIn, boolean ignoreSimilarityIn) {

 

super(materialIn, ignoreSimilarityIn);

this.blockSoundType = SoundType.GLASS;

setHardness(0.3F);

setResistance(1.5F);

}

 

 

public int quantityDropped(Random random)

    {

        return 0;

    }

 

    @SideOnly(Side.CLIENT)

    public BlockRenderLayer getBlockLayer()

    {

        return BlockRenderLayer.TRANSLUCENT;

    }

 

    public boolean isFullCube(IBlockState state)

    {

        return false;

    }

 

    protected boolean canSilkHarvest()

    {

        return true;

    }

   

}

 

 

 

Code Glasspanes

 

package com.space.extended.basicblocks;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockPane;

import net.minecraft.block.SoundType;

import net.minecraft.block.material.Material;

import net.minecraft.block.properties.IProperty;

import net.minecraft.block.state.BlockStateContainer;

import net.minecraft.block.state.IBlockState;

import net.minecraft.init.Blocks;

import net.minecraft.util.BlockRenderLayer;

import net.minecraft.util.EnumFacing;

import net.minecraft.util.math.BlockPos;

import net.minecraft.world.IBlockAccess;

import net.minecraftforge.fml.relauncher.Side;

import net.minecraftforge.fml.relauncher.SideOnly;

 

public class BlockVitallium_Glass_Pane extends BlockPane {

 

private boolean ignoreSimilarity = true;

 

public BlockVitallium_Glass_Pane(Material materialIn, boolean canDrop) {

 

super(materialIn, canDrop);

setHardness(0.3F);

setResistance(1.5F);

this.blockSoundType = SoundType.GLASS;

}

 

 

@SideOnly(Side.CLIENT)

    public BlockRenderLayer getBlockLayer()

    {

        return BlockRenderLayer.TRANSLUCENT;

    }

 

 

 

 

@Override

@SideOnly(Side.CLIENT)

    public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)

    {

        IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));

        Block block = iblockstate.getBlock();

 

        if (this == Blocks.GLASS|| this == Blocks.GLASS_PANE)

        {

            if (blockState != iblockstate)

            {

                return true;

            }

 

            if (block == this)

            {

                return false;

            }

        }

 

        return !this.ignoreSimilarity && block == this ? false : super.shouldSideBeRendered(blockState, blockAccess, pos, side);

    }

 

 

}

 

 

Pls help,thank you in advance

Norzeteus

Don't blame me if i always ask for your help. I just want to learn to be better....

Link to comment
Share on other sites

Override

canConntectTo

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Your panes extend BlockPane, so they should inherit connecting behavior. However, your blocks extend BlockBreakable. Why not extend BlockGlass? Your block is not a full cube; I think that's the hitch.

 

Your panes might connect if your glass block extends BlockGlass instead of BlockBreakable. It might even be enough to make it a full cube.

 

Also: Test vanilla panes with your glass blocks. The canConnect method can coax your own panes to connect, but I think that vanilla panes will fail to connect to a non-full cube.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.