Posted December 27, 20168 yr I've been trying to use getActualState that returns the state the withProperty. I originally had a TileEntity to set which property to use with NBT Tags but the model wasn't changing, so I decided to set the property manually like so: @Override public IBlockState getActualState (IBlockState state, IBlockAccess worldIn, BlockPos pos) { return state.withProperty(HOUSE, EnumHouse.STARK); } This didn't seem to change the state either, then I noticed that it wasn't using the default state either. Here is everything I have so far: Block class public class BlockBanner extends Block implements ITileEntityProvider { public static final PropertyEnum HOUSE = PropertyEnum.create("house", EnumHouse.class); public BlockBanner (Material material) { super(material); setDefaultState(blockState.getBaseState().withProperty(HOUSE, EnumHouse.ARRYN)); isBlockContainer = true; } @Override public ItemStack getPickBlock (IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(world.getBlockState(pos))); } @Override protected BlockStateContainer createBlockState () { return new BlockStateContainer(this, new IProperty[] { HOUSE }); } @Override public IBlockState getStateFromMeta (int meta) { return getDefaultState(); } @Override public int getMetaFromState (IBlockState state) { return 0; } @Override public IBlockState getActualState (IBlockState state, IBlockAccess worldIn, BlockPos pos) { return state.withProperty(HOUSE, EnumHouse.ARRNY); } @Override public int damageDropped (IBlockState state) { return getMetaFromState(state); } @Override public void breakBlock (World world, BlockPos pos, IBlockState state) { super.breakBlock(world, pos, state); world.removeTileEntity(pos); } // didn't do anything either @Override public IBlockState onBlockPlaced (World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return getStateFromMeta(meta).withProperty(HOUSE, EnumHouse.ARRYN); } @Override public boolean eventReceived (IBlockState state, World world, BlockPos pos, int eventID, int eventParam) { super.eventReceived(state, world, pos, eventID, eventParam); TileEntity tile = world.getTileEntity(pos); return tile == null ? false : tile.receiveClientEvent(eventID, eventParam); } @Override public boolean hasTileEntity (IBlockState state) { return true; } @Override public TileEntity createNewTileEntity (World world, int meta) { return new TileEntityBanner(); } } How do I go about doing this, as from what I could gather from other questions, all I needed was getActualState, getStateFromMeta, getMetaFromState. MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
December 27, 20168 yr This didn't seem to change the state either, then I noticed that it wasn't using the default state either. How can you tell? Also, don't use ITileEntityProvider. Override the hasTileEntity and getTileEntity methods that are in the Block class. 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.
December 27, 20168 yr Author This didn't seem to change the state either, then I noticed that it wasn't using the default state either. How can you tell? Also, don't use ITileEntityProvider. Override the hasTileEntity and getTileEntity methods that are in the Block class. In the model i set the texture in the model to blocks/debug, in the variant all other variants are set to white wool, variant arryn is set to red wool. Anytime I place the block it uses the debug texture. I tried removing the texture thinking maybe that it was just overriding the variant texture but it didn't. MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
December 27, 20168 yr Show: - Your blockstate file - Any model files 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.
December 27, 20168 yr Author Model file { "textures" : { "base" : "got:blocks/base", "banner_top" : "blocks/debug", "banner_bottom" : "blocks/debug", "particle" : "got:blocks/base" }, "elements" : [ { "from" : [ 2, 17, 10 ], "to" : [ 14, 30, 11 ], "name" : "banner_top", "faces" : { "down" : { "uv" : [ 1, 14, 13, 15 ], "texture" : "#banner_top" }, "south" : { "uv" : [ 1, 1, 13, 14 ], "texture" : "#banner_top" }, "east" : { "uv" : [ 0, 1, 1, 14 ], "texture" : "#banner_top" }, "west" : { "uv" : [ 13, 1, 14, 14 ], "texture" : "#banner_top" }, "up" : { "uv" : [ 1, 0, 13, 1 ], "texture" : "#banner_top" }, "north" : { "uv" : [ 1, 1, 13, 14 ], "texture" : "#banner_bottom" } } } ], "display" : { "thirdperson_righthand" : { "rotation" : [ 75, 180, 0 ], "translation" : [ 0, 2.5, 0 ], "scale" : [ 0.375, 0.375, 0.375 ] }, "firstperson_lefthand" : { "rotation" : [ 0, 225, 0 ], "translation" : [ 0, 0, 0 ], "scale" : [ 0.4, 0.4, 0.4 ] }, "fixed" : { "rotation" : [ 0, 0, 0 ], "translation" : [ 0, 0, 0 ], "scale" : [ 1, 1, 1 ] }, "ground" : { "rotation" : [ 0, 0, 0 ], "translation" : [ 0, 3, 0 ], "scale" : [ 1, 1, 1 ] }, "firstperson_righthand" : { "rotation" : [ 0, 180, 0 ], "translation" : [ 0, 0, 0 ], "scale" : [ 0.8, 0.8, 0.8 ] }, "gui" : { "rotation" : [ 30, 315, 0 ], "translation" : [ 0, 0, 0 ], "scale" : [ 0.625, 0.625, 0.625 ] } } } Blockstate file { "forge_marker" : 1, "variants" : { "house" : { "arryn" : { "textures" : { "banner_top" : "got:blocks/arryn", "banner_bottom" : "got:blocks/arryn" } }, "umber" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "martell" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "greyjoy" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "tully" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "bolton" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "targaryen" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "stark" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "frey" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "tyrell" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "karstark" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "baratheon" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "mormont" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } }, "lannister" : { "textures" : { "banner_top" : "got:blocks/banner", "banner_bottom" : "got:blocks/banner" } } }, "hanging" : { "false" : { "base" : "got:blocks/base" }, "true" : { "base" : "got:blocks/base" } } } } MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
December 27, 20168 yr This could just be a copy-pasting typo, but in case it matters - in getActualState you return EnumHouse.ARRNY instead of EnumHouse.ARRYN . Also, where is your EnumHouse - can you show the code for that?
December 27, 20168 yr Author This could just be a copy-pasting typo, but in case it matters - in getActualState you return EnumHouse.ARRNY instead of EnumHouse.ARRYN . Also, where is your EnumHouse - can you show the code for that? That was just a typo when copying and pasting to here. It would have given me an error if that was the problem. Here is the EnumHouse code: public enum EnumHouse implements IStringSerializable { ARRYN(0, "arryn", "House Arryn"), BARATHEON(1, "baratheon", "House Baratheon"), BOLTON(2, "bolton", "House Bolton"), FREY(3, "frey", "House Frey"), GREYJOY(4, "greyjoy", "House Greyjoy"), KARSTARK(5, "karstark", "House Karstark"), LANNISTER(6, "lannister", "House Lannister"), MARTELL(7, "martell", "House Martell"), MORMONT(8, "mormont", "House Mormont"), STARK(9, "stark", "House Stark"), TARGARYEN(10, "targaryen", "House Targaryen"), TULLY(11, "tully", "House Tully"), TYRELL(12, "tyrell", "House Tyrell"), UMBER(13, "umber", "House Umber"); private int id; private String nid; private String name; private static final EnumHouse[] VALUES = new EnumHouse[values().length]; EnumHouse (int id, String nid, String name) { this.id = id; this.nid = nid; this.name = name; } @Override public String getName () { return nid; } public static EnumHouse getValue (int id) { return values()[id]; } public static String getNid (int id) { return values()[id].nid; } } MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
December 27, 20168 yr Enums are stored as numbers. ARRYN is zero. Basestate is all zeroes. Your meta methods get and set nothing but zero. You'll end up defining 14 blockstates but using only state zero. Why bother? For that matter, with 14 houses, why not store and retrieve them normally? I'm missing something here, which makes it difficult to see what the problem is. In the model i set the texture in the model to blocks/debug Well that's why you see blocks/debug. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
December 27, 20168 yr Author Enums are stored as numbers. ARRYN is zero. Basestate is all zeroes. Your meta methods get and set nothing but zero. You'll end up defining 14 blockstates but using only state zero. Why bother? For that matter, with 14 houses, why not store and retrieve them normally? I'm missing something here, which makes it difficult to see what the problem is. In the model i set the texture in the model to blocks/debug Well that's why you see blocks/debug. I'm going to be using more than 14 (I have 19 right now). I had more than 16 but I commented them out as I was going to use metadata before I found out that you can have more than 16 state. Also Im going to be using the metadata for probably facing. If i set the textures to nothing in the model file it would give me the purple/black texture. MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
December 28, 20168 yr If i set the textures to nothing in the model file it would give me the purple/black texture. What if you just don't mention the banner_top & bottom textures in the model file? The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
December 28, 20168 yr Author If i set the textures to nothing in the model file it would give me the purple/black texture. What if you just don't mention the banner_top & bottom textures in the model file? Purple and black texture aswell MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
December 28, 20168 yr So the defaults from the blockstates file don't come through... irritating. At this point I need to sign off because my experience is with 1.10.2, and 1.11 has changed a couple things about the JSON handling as it matures. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
December 28, 20168 yr Author I followed the Custom Furnace code by TheGreyGhost and the furnace doesn't use metadata to store its states either but it works. I've been looking through the code for it and changing my block but it's not making a difference. Here is the code if you want to take a look through it: https://github.com/TheGreyGhost/MinecraftByExample/tree/b1f1192efe029a8e8c1dff47c82da76fb80509b7/src/main/java/minecraftbyexample/mbe31_inventory_furnace MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
December 29, 20168 yr Author Figured it out. It can't switch textures. only models. Is that a possible bug? MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
December 29, 20168 yr You're doing something wrong. Post files. 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.
December 29, 20168 yr Author Block class TileEntity class BlockState file Model folder MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
December 29, 20168 yr Well if you're switching models like this: "house=arryn": { "model": "got:banner_arryn" }, and it works, then to switch textures you need two things: 1) a default 2) a texture override defaults { "model": "got:banner_arryn" }, //... "house=arryn": { "textures": { "banner_top": "got:blocks/arryn" } }, That said, why does your model file have a display tag? Why not use the "parent" tag and point it at an existing item/block model that has the display attributes you need? (probably "parent": "banner") 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.
December 29, 20168 yr Author Well if you're switching models like this: "house=arryn": { "model": "got:banner_arryn" }, and it works, then to switch textures you need two things: 1) a default 2) a texture override defaults { "model": "got:banner_arryn" }, //... "house=arryn": { "textures": { "banner_top": "got:blocks/arryn" } }, That said, why does your model file have a display tag? Why not use the "parent" tag and point it at an existing item/block model that has the display attributes you need? (probably "parent": "banner") Thank you. That works. MobDrops http://www.planetminecraft.com/mod/125-mobdrops/
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.