Jump to content

Recommended Posts

Posted

I am trying to implement a cable block, I have made a model that is smaller than a full block but  when I place it it doesn't render the ground or any adjacent block sides.2020-03-11_14_57_01.png.9b0c6150c7b2e04b9bd75c274f51e80b.png

Here is a link to my project: https://github.com/FuturisticLux/engineerstech

 

Model:

{
    "textures": {
        "all": "minecraft:block/glass"
    },
    "elements": [
    	{
    		"from": [4,4,4],
    		"to": [12,12,12],
    		"faces": {
                "down":  { "uv": [4,4, 12,12], "texture": "#all" },
                "up":    { "uv": [4,4, 12,12], "texture": "#all" },
                "north": { "uv": [4,4, 12,12], "texture": "#all" },
                "south": { "uv": [4,4, 12,12], "texture": "#all" },
                "west":  { "uv": [4,4, 12,12], "texture": "#all" },
                "east":  { "uv": [4,4, 12,12], "texture": "#all" }
            }
    	}
    ]
}

 

BlockState:

{
  "forge_marker": 1,
  "defaults": {
    "textures": {
      "all": "minecraft:block/glass"
    },
    "model": "engineerstech:block/cable",
    "uvlock": true
  },
  "variants": {
    "": [{
    	"textures": {
      		"all": "minecraft:block/glass"
    	},
    	"model": "engineerstech:block/cable",
    	"uvlock": true
    }]
  }
}

 

I am registering it like this:

registerBlock(new OreBlock(Block.Properties.create( Material.GLASS ).hardnessAndResistance(3, 3).sound( SoundType.GLASS ).variableOpacity()), "cable");

public static Block registerBlock(Block block, String name)
{
        BlockItem itemBlock = new BlockItem(block, new Item.Properties().group(EngineersTechTab.instance));
        block.setRegistryName(name);
        itemBlock.setRegistryName(name);
        ForgeRegistries.BLOCKS.register(block);
        ForgeRegistries.ITEMS.register(itemBlock);
        return block;
}

 

Posted

Fix its returned voxel shape. Your block is not a full cube, so don't return a full cube voxel shape.

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

I changed my Cable class to this:

public class CableBlock extends Block{

	public static final AxisAlignedBB BASIC_AABB = new AxisAlignedBB(4, 4, 4, 12, 12, 12);
	public static VoxelShape shape;

	public CableBlock(Properties properties) {
		super(properties);
		shape = VoxelShapes.create(BASIC_AABB);
	}
	
	
	@Override
	public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
		return shape; 
	}
	
	@Override
	public VoxelShape getRenderShape(BlockState p_196247_1_, IBlockReader p_196247_2_, BlockPos p_196247_3_)
	{
		return shape; 
	}
	
	@Override
	public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos,
			ISelectionContext context) {
		return shape; 
	}
}

 

The shape of the block in game hasn't changed.

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.