Jump to content

Custom glass has xray effect


Recommended Posts

package com.yourtinyhero.notenoughthings.blocks;

import java.util.Random;

import com.yourtinyhero.notenoughthings.NotEnoughThings;
import com.yourtinyhero.notenoughthings.Reference;

import net.minecraft.block.Block;
import net.minecraft.block.BlockBreakable;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockSoulGlass extends BlockBreakable {

	public BlockSoulGlass() {
		super(Material.GLASS, translucent);
		this.setLightOpacity(5);
		this.setUnlocalizedName(Reference.NotEnoughThingsBlocks.SOULGLASSBLOCK.getUnlocalizedName());
		this.setRegistryName(Reference.NotEnoughThingsBlocks.SOULGLASSBLOCK.getRegistryName());
		this.setCreativeTab(NotEnoughThings.tabNotEnoughThings);
	}
    @SideOnly(Side.CLIENT)
    public BlockRenderLayer getBlockLayer()
    {
        return BlockRenderLayer.TRANSLUCENT;
    }
    public boolean isOpaqueCube()
    {
        return false;
    }
    /**
     * Returns the quantity of items to drop on block destruction.
     */
    public int quantityDropped(Random random)
    {
        return 0;
    }

    protected boolean canSilkHarvest()
    {
        return true;
    }

    public boolean isFullCube()
    {
        return false;
    }
    public int getRenderBlockPass()
    {
        return 1;
    }
}

My code above

Edited by KalebCraft // TheCubeCub
Better layout
Link to comment
Share on other sites

Which Minecraft version are you using?

 

I'm guessing you're using a version where Block#isOpaqueCube has an IBlockState parameter, which your isOpaqueCube method doesn't.

 

Always annotate override methods with @Override so you get a compilation error when they don't actually override a super method. You should also use your IDE to auto-generate override methods with the correct signature and annotation.

 

In future, please post code using a code block (the <> icon) or on Gist/Pastebin.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

10 minutes ago, KalebCraft // TheCubeCub said:

What is an IBlockState parameter?

 

Do you know what a parameter is? This is a basic Java concept.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

13 minutes ago, KalebCraft // TheCubeCub said:

Not really... I'm kinda new to modding, I've done some basic 1.7.10 modding ages ago, but yeah. Pretty new.

 

You need to have a solid understanding of Java before making a mod. As it says in this section's description, we're not here to help with basic Java problems.

 

Java has a tutorial on parameters here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.

Announcements



×
×
  • Create New...

Important Information

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