Posted February 8, 201510 yr Trying to make a block that will have connected textures in 1.8, I took a look at the glass panes models, block state data, and code. When trying to launch I get net.minecraftforge.fml.common.LoaderException: java.lang.IllegalArgumentException: Don't know how to convert unnamed:connected_polished_granite[down=true,east=true,north=true,south=true,up=true,west=true] back into data... I do have a blockstate file for connected_polished_granite in assets/unnamed/blockstates { "variants": { "down=true,east=true,north=true,south=true,up=true,west=true": { "model": "c_p_g_udnesw"}, "down=false,east=false,north=false,south=false,up=false,west=false": { "model": "c_p_g"} } } I do have model files for it as well. No idea why I'm getting the error if anyone knows, please let me know.
February 8, 201510 yr Author [spoiler=BlockConnected] package com.zalthonethree.unnamed.block; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import com.zalthonethree.unnamed.Reference; import com.zalthonethree.unnamed.client.CreativeTab; public class BlockConnected extends Block { protected BlockConnected(Material materialIn) { super(materialIn); } public static final PropertyBool UP = PropertyBool.create("up"); public static final PropertyBool DOWN = PropertyBool.create("down"); public static final PropertyBool NORTH = PropertyBool.create("north"); public static final PropertyBool EAST = PropertyBool.create("east"); public static final PropertyBool SOUTH = PropertyBool.create("south"); public static final PropertyBool WEST = PropertyBool.create("west"); public BlockConnected() { this(Material.rock); this.setDefaultState(this.blockState.getBaseState() .withProperty(UP, false) .withProperty(DOWN, false) .withProperty(NORTH, false) .withProperty(EAST, false) .withProperty(SOUTH, false) .withProperty(WEST, false) ); this.setCreativeTab(CreativeTab.unNamed); } public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { return state.withProperty(UP, true) .withProperty(DOWN, true) .withProperty(NORTH, true) .withProperty(EAST, true) .withProperty(SOUTH, true) .withProperty(WEST, true); } private boolean canTextureConnect(IBlockAccess worldIn, BlockPos origin, EnumFacing side) { BlockPos off = origin.offset(side); Block block = worldIn.getBlockState(off).getBlock(); return block == this; } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {UP, DOWN, NORTH, EAST, WEST, SOUTH}); } @Override public String getUnlocalizedName() { return String.format("tile.%s%s", Reference.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } protected String getUnwrappedUnlocalizedName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } } [spoiler=BlockConnectedPolishedGranite] public class BlockConnectedPolishedGranite extends BlockConnected { public BlockConnectedPolishedGranite() { super(); this.setUnlocalizedName("connected_polished_granite"); } }
February 8, 201510 yr You don't have the convert-from-meta-to-state or the convert-from-state-to-meta functions. Vanilla isn't magic. 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.
February 8, 201510 yr Author Ok that fixed that however now the textures don't work. For now I only have a texture for a block connected to nothing, here's the code [spoiler=BlockConnected] package com.zalthonethree.unnamed.block; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import com.zalthonethree.unnamed.Reference; import com.zalthonethree.unnamed.client.CreativeTab; public class BlockConnected extends Block { protected BlockConnected(Material materialIn) { super(materialIn); } public static final PropertyBool UP = PropertyBool.create("up"); public static final PropertyBool DOWN = PropertyBool.create("down"); public static final PropertyBool NORTH = PropertyBool.create("north"); public static final PropertyBool EAST = PropertyBool.create("east"); public static final PropertyBool SOUTH = PropertyBool.create("south"); public static final PropertyBool WEST = PropertyBool.create("west"); public BlockConnected() { this(Material.rock); this.setDefaultState(this.blockState.getBaseState() .withProperty(UP, false) .withProperty(DOWN, false) .withProperty(NORTH, false) .withProperty(EAST, false) .withProperty(SOUTH, false) .withProperty(WEST, false) ); this.setCreativeTab(CreativeTab.unNamed); } public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { return state.withProperty(UP, canTextureConnect(worldIn, pos, EnumFacing.UP)) .withProperty(DOWN, canTextureConnect(worldIn, pos, EnumFacing.DOWN)) .withProperty(NORTH, canTextureConnect(worldIn, pos, EnumFacing.NORTH)) .withProperty(EAST, canTextureConnect(worldIn, pos, EnumFacing.EAST)) .withProperty(SOUTH, canTextureConnect(worldIn, pos, EnumFacing.SOUTH)) .withProperty(WEST, canTextureConnect(worldIn, pos, EnumFacing.WEST)); } public int getMetaFromState(IBlockState state) { return 0; } public IBlockState getStateFromMeta(int meta) { return this.getDefaultState(); } private boolean canTextureConnect(IBlockAccess worldIn, BlockPos origin, EnumFacing side) { BlockPos off = origin.offset(side); Block block = worldIn.getBlockState(off).getBlock(); return block == this; } protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {UP, DOWN, NORTH, EAST, WEST, SOUTH}); } @Override public String getUnlocalizedName() { return String.format("tile.%s%s", Reference.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } protected String getUnwrappedUnlocalizedName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } } [spoiler=BlockConnectedPolishedGranite] package com.zalthonethree.unnamed.block; public class BlockConnectedPolishedGranite extends BlockConnected { public BlockConnectedPolishedGranite() { super(); this.setUnlocalizedName("connected_polished_granite"); } } [spoiler=assets/unnamed/blockstates/connected_polished_granite.json] { "variants": { "down=true,east=true,north=true,south=true,up=true,west=true": { "model": "c_p_g_udnesw"}, "down=false,east=false,north=false,south=false,up=false,west=false": { "model": "c_p_g"} } } [spoiler=c_p_g] { "parent": "block/cube_all", "textures": { "all": "unnamed:blocks/c_p_g" } } and the texture does exist in assets/unnamed/textures/blocks/c_p_g Edit: Fixed by putting modid:model instead of just model
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.