Jump to content

Double Slab game crash


Gorakh

Recommended Posts

Hi.

I wanted to add slabs for some blocks, everything works fine, except if I make it a double slab, and then jump on top of it, I sink through it and the game crashes. I've looked online but I can't find a solution.

 

Log output:

Spoiler

[00:11:09] [Server thread/INFO] [minecraft/NetHandlerPlayServer]: Player471 lost connection: Invalid move player packet received
[00:11:09] [Server thread/INFO] [minecraft/MinecraftServer]: Player471 left the game
[00:11:09] [Server thread/INFO] [minecraft/NetHandlerPlayServer]: Stopping singleplayer server as player logged out
[00:11:09] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server
[00:11:09] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players
[00:11:09] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds
[00:11:09] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'Mod test world'/overworld
[00:11:09] [Server thread/INFO] [FML]: Unloading dimension 0
[00:11:09] [Server thread/INFO] [FML]: Applying holder lookups
[00:11:09] [Server thread/INFO] [FML]: Holder lookups applied
[00:11:17] [main/INFO] [minecraft/Minecraft]: Stopping!
[00:11:17] [main/INFO] [minecraft/SoundManager]: SoundSystem shutting down...
[00:11:18] [main/WARN] [minecraft/SoundManager]: Author: Paul Lamb, www.paulscode.com

My json files:

Spoiler

(blockstates) granite_slab_double.json

(blockstates) granite_slab_half.json

 

(models/block) granite_slab_bottom.json

(models/block) granite_slab_top.json

 

(models/item) granite_slab_half.json (I don't think this affects it, but I'll provide it anyway)

 

Thanks in advance.

 

EDIT: This is not just for double slabs, it's also for upside-down half slabs

 

EDIT 2: Slabs don't save properly in the world either, if i place a normal half slab, then reload the world, it becomes an upside-down half slab

Edited by Gorakh
Link to comment
Share on other sites

*sees no code*

*can't help*

What does this have to do with your models?

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

9 hours ago, Cadiboo said:

*sees no code*

*can't help*

What does this have to do with your models?

I don't know, I thought there was something wrong with my models

 

But here's my block registration code:

Spoiler

public static void registerBlock(Block block, CreativeTabs tab)
    {
        ForgeRegistries.BLOCKS.register(block);
        block.setCreativeTab(tab);
        ItemBlock item = new ItemBlock(block);
        item.setRegistryName(block.getRegistryName());
        ForgeRegistries.ITEMS.register(item);
        
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
    }
    
    public static void registerBlock(Block block, ItemBlock itemblock, CreativeTabs tab)
    {
        ForgeRegistries.BLOCKS.register(block);
        block.setCreativeTab(tab);
        itemblock.setRegistryName(block.getRegistryName());
        ForgeRegistries.ITEMS.register(itemblock);
        
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
    }
}

 

And here's my 'CustomBlockSlab' Class:

Spoiler

package gorakh.moredecor.init.blocks.slab;

import java.util.Random;

import net.minecraft.block.BlockSlab;
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.item.Item;
import net.minecraft.item.ItemStack;

public abstract class CustomBlockSlab extends BlockSlab
{
    CustomBlockHalfSlab half;
    
    public CustomBlockSlab(String name, Material material, boolean _unbreakable, float _slipperiness, float _hardness, String _toolClass, int _toolLevel, float _lightLevel, int _lightOpacity, float _resistance, SoundType _soundType, CustomBlockHalfSlab half_slab)
    {
        super(material);
        
        if(_unbreakable)
            this.setBlockUnbreakable();
        
        this.setDefaultSlipperiness(_slipperiness);
        this.setHardness(_hardness);
        this.setHarvestLevel(_toolClass, _toolLevel);
        this.setLightLevel(_lightLevel);
        this.setLightOpacity(_lightOpacity);
        this.setRegistryName(name);
        this.setResistance(_resistance);
        this.setSoundType(_soundType);
        this.setUnlocalizedName(name);

        this.useNeighborBrightness = true;
        
        IBlockState state = this.blockState.getBaseState();
        
        if(!this.isDouble())
            state = state.withProperty(HALF, EnumBlockHalf.BOTTOM);
        
        this.setDefaultState(state);
        half = half_slab;
    }
    
    @Override
    public String getUnlocalizedName(int meta) 
    {
        return this.getUnlocalizedName();
    }

    @Override
    public IProperty<?> getVariantProperty() 
    {
        return HALF;
    }
    
    @Override
    public Comparable<?> getTypeForItem(ItemStack stack)
    {
        return EnumBlockHalf.BOTTOM;
    }
    
    @Override
    public int damageDropped(IBlockState state) 
    {
        return 0;
    }
    
    @Override
    public IBlockState getStateFromMeta(int meta) 
    {
        if(!this.isDouble())
        {
            return this.getDefaultState().withProperty(HALF, EnumBlockHalf.values()[meta % EnumBlockHalf.values().length]);
        }
        return this.getDefaultState();
    }
    
    @Override
    public int getMetaFromState(IBlockState state) 
    {
        if(!this.isDouble())
        {
            return 0;
        }
        
        return ((EnumBlockHalf)state.getValue(HALF)).ordinal() + 1;
    }
    
    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune) 
    {
        return Item.getItemFromBlock(half);
    }
    
    @Override
    protected BlockStateContainer createBlockState() 
    {
        return new BlockStateContainer(this, new IProperty[] {HALF});
    }
}

 

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.