Posted August 18, 201510 yr Some of you should have already noticed that I'm struggeling with 1.8's new .json based Block State system. While updating my Rubbertree i've stumbled upon this weird issue. When initially placing the Block its state is determined by the way it was placed to give it the correct direction. When printing its state when its placed this comes out to be correct. But right after placement the block the state is being set to be none causing the block to display incorrectly. Here is the torn down log class im using. This is literally me trying to set the state correctly. class BlockRubbertreeLog(id:String) extends BlockLog { GameRegistry.registerBlock(this, id) setUnlocalizedName(id) setCreativeTab(Technica.tabTechnica) //val STATE:PropertyEnum = PropertyEnum setDefaultState(blockState.getBaseState.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Y)) override def onBlockPlaced(worldIn: World, pos: BlockPos, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float, meta: Int, placer: EntityLivingBase): IBlockState = { super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer) } override def onBlockActivated(worldIn: World, pos: BlockPos, state: IBlockState, playerIn: EntityPlayer, side: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): Boolean = { println(state) super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ) } override def createBlockState(): BlockState = new BlockState(this, BlockLog.LOG_AXIS) override def getStateFromMeta(meta: Int): IBlockState = getDefaultState override def getMetaFromState(state: IBlockState): Int = 0 } Using breakpoints I found out that the issue lies somewhere in Chunk.class.setBlockState() But I couldn't see what caused it. PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.
August 18, 201510 yr Author Since I return the default state in getStateFromMeta which I set to hold the Y property shouldn't it return the correct State (just causing the block do display correctly. Im not aiming for any functionality here) PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.
August 18, 201510 yr Author Also neither getStateFromMeta nor getMetaFromState get called during the placement of the block. I guess they are just used for information storage nowadays. PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.
August 18, 201510 yr Also neither getStateFromMeta nor getMetaFromState get called during the placement of the block. I guess they are just used for information storage nowadays. Each possible state of a Block is assigned an ID based on the Block 's ID (automatically assigned) and the metadata value of that state (returned from Block#getMetaFromState ). These IDs are used by ExtendedBlockStorage to store the contents of each chunk. If two states share a metadata value, ExtendedBlockStorage won't distinguish between them. If you want a property's value to be saved with the world, you need to store it in the metadata (just like 1.7.10 and earlier). Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 18, 201510 yr Author Well I found my mistake. The assignment Choonster is talking about is done while the game is loading. I was not checking for prints during the games loading time. Thanks PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.
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.