Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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....

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.

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.

  • Author

Thanks mate, this helped. I only had to set "isFullCube" to true and now it works...  :D

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.