You don't access the BlockSterileGlass class, you're always using BlockBase.
Instead, make BlockSterileGlass extend BlockBase and in your ModBlocks class change blockSterileGlass to be of type BlockSterileGlass instead of BlockBase.
I've overridden isfullcube, but when I place it the blocks adjacent to it aren't rendered
Sorry I'm a noob
Override anything that could solve your problem (isFullBlock, isSolidCube, isFullCube etc.), you may need to override multiple of these methods to achieve your desired behaviour.
How do you make it to make shouldsideberendered returns false if the block next to it is the same
override it and check if IBlockState#getBlock() of the neighborblock returns your block. Get that block by calling World#getBlockState() on the world object you get from the method.
I am trying to make a transparent block and this is my parent class:
package com.maxrocks1602.beesgalore.block;
import net.minecraft.block.Block;
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 BlockSterileGlass extends Block{
public BlockSterileGlass(Material materialIn) {
super(materialIn);
}
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
public boolean isFullCube(IBlockState state)
{
return false;
}
}
My 2 block classes are here:
import com.maxrocks1602.beesgalore.item.ItemModelProvider;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ModBlocks {
public static Block blockSterile;
public static Block blockSterileGlass;
public static void init() {
blockSterile = register(new BlockBase(Material.IRON, "blockSterile").setCreativeTab(CreativeTabs.MATERIALS));
blockSterileGlass = register(new BlockBase(Material.IRON, "blockSterileGlass").setCreativeTab(CreativeTabs.MATERIALS));
}
private static <T extends Block> T register(T block, ItemBlock itemBlock) {
GameRegistry.register(block);
GameRegistry.register(itemBlock);
if (block instanceof ItemModelProvider) {
((BlockBase)block).registerItemModel(itemBlock);
}
return block;
}
private static <T extends Block> T register(T block) {
ItemBlock itemBlock = new ItemBlock(block);
itemBlock.setRegistryName(block.getRegistryName());
return register(block, itemBlock);
}
}
import com.maxrocks1602.beesgalore.BeesGaloreMod;
import com.maxrocks1602.beesgalore.item.ItemModelProvider;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
public class BlockBase extends Block implements ItemModelProvider{
protected String name;
public BlockBase(Material material, String name) {
super(material);
this.name = name;
setUnlocalizedName(name);
setRegistryName(name);
}
@Override
public void registerItemModel(Item itemBlock) {
BeesGaloreMod.proxy.registerItemRenderer(itemBlock, 0, name);
}
@Override
public BlockBase setCreativeTab(CreativeTabs tab) {
super.setCreativeTab(tab);
return this;
}
}
So my question is, how do I make the block class work? How do block classes work?
You don't access the BlockSterileGlass class, you're always using BlockBase.
Instead, make BlockSterileGlass extend BlockBase and in your ModBlocks class change blockSterileGlass to be of type BlockSterileGlass instead of BlockBase.
Thanks!
I've overridden isfullcube, but when I place it the blocks adjacent to it aren't rendered
Sorry I'm a noob
Override anything that could solve your problem (isFullBlock, isSolidCube, isFullCube etc.), you may need to override multiple of these methods to achieve your desired behaviour.
How do you make it to make shouldsideberendered returns false if the block next to it is the same
override it and check if IBlockState#getBlock() of the neighborblock returns your block. Get that block by calling World#getBlockState() on the world object you get from the method.