Jump to content

Recommended Posts

Posted

So i was making slabs and this one i have is called a "Crystal Slab" and it's see through kinda like a crystal so when i have been trying to do it, It keeps crashing like if i load into a world place it on the ground it has a see through effect all the way past bedrock, And if i place a slab on top of it, The game crashes, But if i place the top one first and the bottom one it acts normal, And btw when the game crashes when you load back in it's like if you were in spec mode but every block is gone and the game ends up crashing, If you know the problem please let me know because now i'm past my time for releasing alpha 2.0 for my mod lol.






Heres the class for BlockSlabBase


 

public abstract class BlockSlabBase extends BlockSlab
{
    Block half;
    public static final PropertyEnum<Variant> VARIANT = PropertyEnum.<Variant>create("variant", Variant.class);
    
    public BlockSlabBase(String name, Material material, BlockSlab half) 
    {
        super(material);
        setUnlocalizedName(name);
        setRegistryName(name);
        setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
        this.useNeighborBrightness = !this.isDouble();
        
        IBlockState state = this.blockState.getBaseState().withProperty(VARIANT, Variant.DEFAULT);
        if(!this.isDouble()) state = state.withProperty(HALF, EnumBlockHalf.BOTTOM);
        this.half = half;
        ModBlocks.BLOCKS.add(this);
    }
    
    
    
    @SideOnly(Side.CLIENT)
    public BlockRenderLayer getBlockLayer()
    {
        return BlockRenderLayer.TRANSLUCENT; }
@Override
        public boolean isOpaqueCube(IBlockState state) {
            return false;
}

@SideOnly(Side.CLIENT)
   @Override
   public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
   {
       IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
       Block block = iblockstate.getBlock();

    
     
           if (blockState != iblockstate)
           {
               return true;
           }

           if (block == this)
           {
               return false;
           }
           return false;
       

      
   }


    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune) 
    {
        return Item.getItemFromBlock(half);
    }
    
    @Override
    public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) 
    {
        return new ItemStack(half);
    }
    
    @Override
    public IBlockState getStateFromMeta(int meta) 
    {
        IBlockState state = this.blockState.getBaseState().withProperty(VARIANT, Variant.DEFAULT);
        if(!this.isDouble()) state = state.withProperty(HALF, ((meta&8) != 0) ? EnumBlockHalf.TOP : EnumBlockHalf.BOTTOM);
        return state;
    }
    
    @Override
    public int getMetaFromState(IBlockState state) 
    {
        int meta = 0;
        if(!this.isDouble() && state.getValue(HALF) == EnumBlockHalf.TOP) meta |= 8;
        return meta;
    }
    
    @Override
    protected BlockStateContainer createBlockState() 
    {
        if(!this.isDouble()) return new BlockStateContainer(this, new IProperty[] {VARIANT, HALF});
        else return new BlockStateContainer(this, new IProperty[] {VARIANT});
    }
    
    @Override
    public String getUnlocalizedName(int meta) 
    {
        return super.getUnlocalizedName();
    }
    
    @Override
    public IProperty<?> getVariantProperty() 
    {
        return VARIANT;
    }
    
    @Override
    public Comparable<?> getTypeForItem(ItemStack stack) 
    {
        return Variant.DEFAULT;
    }
    
    public static enum Variant implements IStringSerializable
    {
        DEFAULT;

        @Override
        public String getName() 
        {
            return "default";
        }
        
    }
}

Posted (edited)

And if you take out the see through code

 it's normal and acts normal, But it's not see through like it should be.

Edited by J0WAY
Posted
2 hours ago, J0WAY said:

And if i place a slab on top of it, The game crashes

I don't see a crash report.

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.

Posted

Cannot get property PropertyEnum{name=half, clazz=class net.minecraft.block.BlockSlab$EnumBlockHalf, values=[top, bottom]} as it does not exist in BlockStateContainer{block=supersurvival:crystal_slab_double, properties=[variant]}

Posted

You're trying to get a HALF (top, bottom) value for your double slab block which does not have that property.

 

Also, you didn't include the entire error so I don't know where this is happening.

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.

Posted
23 minutes ago, Draco18s said:

You're trying to get a HALF (top, bottom) value for your double slab block which does not have that property.

 

Also, you didn't include the entire error so I don't know where this is happening.

O sorry, Here is the pastebin of the startup and logging in and when it crashes https://pastebin.com/enySRiwx 

Posted
  1. java.lang.IllegalArgumentException: Cannot get property PropertyEnum{name=half, clazz=class net.minecraft.block.BlockSlab$EnumBlockHalf, values=[top, bottom]} as it does not exist in BlockStateContainer{block=supersurvival:crystal_slab_double, properties=[variant]}
  2.     at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:204)
  3.     at net.minecraft.block.BlockSlab.doesSideBlockRendering(BlockSlab.java:107)
You haven't overridden that method, and its doing something that's causing a conflict with your block. You'll have to figure out what to do yourself.

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.

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.