IceLitty Posted January 9, 2018 Posted January 9, 2018 Hi there, I'm new one to try write forge mods find some problems and search some topics may not help for this question... I write a test project about this: https://github.com/IceLitty/forge-1.12.2-14.23.1.2555-mod-test-project And problem lines: https://github.com/IceLitty/forge-1.12.2-14.23.1.2555-mod-test-project/blob/master/src/main/java/com/gmail/litalways/icykingdoms/growBlock.java#L77 When I run client and into client world, I use Bone Meal to change this block states 'stage', it can cycle from 0 to 1. And I start server, join client into it, IDE log can output correctly cycle 0 and 1, but client shows not changed.. Even if I not write world.isRemote, or tried this update function, they all not help: this.requiresUpdates(); worldIn.updateObservingBlocksAt(pos, this); worldIn.markBlockRangeForRenderUpdate(pos, pos); worldIn.notifyBlockUpdate(pos, state, state.withProperty(STAGE, 1), 4); worldIn.scheduleUpdate(pos, this, 0); worldIn.scheduleBlockUpdate(pos, this, 0, 1); worldIn.markAndNotifyBlock(pos, worldIn.getChunkFromBlockCoords(pos), state, state.withProperty(STAGE, 1), 4); worldIn.markBlocksDirtyVertical(pos.getX(), pos.getZ(), pos.getY(), pos.getY()); worldIn.updateBlockTick(pos, this, 0, 1); Quote
Alexiy Posted January 9, 2018 Posted January 9, 2018 Try 'setBlockState' without a flag or with a flag 2. Quote
IceLitty Posted January 9, 2018 Author Posted January 9, 2018 On 1/9/2018 at 10:21 AM, Alexiy said: Try 'setBlockState' without a flag or with a flag 2. Expand Yes I tried from 1 to 16, as same had problem.. Quote
Alexiy Posted January 9, 2018 Posted January 9, 2018 Ok, let's try this - after the line worldIn.setBlockState(pos, state.cycleProperty(STAGE), 4) add following: IBlockState blockState=worldIn.getBlockState(pos); worldIn.notifyBlockUpdate(pos,blockState,blockState,2); Quote
IceLitty Posted January 9, 2018 Author Posted January 9, 2018 On 1/9/2018 at 11:24 AM, Alexiy said: Ok, let's try this - after the line worldIn.setBlockState(pos, state.cycleProperty(STAGE), 4) add following: IBlockState blockState=worldIn.getBlockState(pos); worldIn.notifyBlockUpdate(pos,blockState,blockState,2); Expand hmm... and still no changes by client, server still can cycle it _(:з)∠)_ Quote
Alexiy Posted January 9, 2018 Posted January 9, 2018 Oh, I've noticed you haven't overridden getStateFromMeta method. You have to override it and return appropriate state from the given metadata. And in getMetaFromState you have to return appropriate metadata, I guess in your case it will be just state.getValue(STAGE). Quote
IceLitty Posted January 10, 2018 Author Posted January 10, 2018 On 1/9/2018 at 4:48 PM, Alexiy said: Oh, I've noticed you haven't overridden getStateFromMeta method. You have to override it and return appropriate state from the given metadata. And in getMetaFromState you have to return appropriate metadata, I guess in your case it will be just state.getValue(STAGE). Expand On 1/9/2018 at 8:17 PM, diesieben07 said: This. The world only remembers block states by their metadata. Properties which are not encoded as metadata are forgotten by the world. Expand It works! Is actually when server changed, server push the meta id to client not push the state?! But I look forge document It have special state, it not effect metadata id, but still work.. And 1.13 will remove metadata id, if I using 1.12, it still need overwrite getStateFromMeta and getMetaFromState function? Quote
IceLitty Posted January 29, 2018 Author Posted January 29, 2018 On 1/10/2018 at 2:23 PM, diesieben07 said: Yes, the server sends the metadata to the client. 1.13 will still use some kind of ID for every state. Sending full serialized states to the client (or saving them in the world) is madness, the save size and network traffic would explode. Expand Err.. Another simple question.. In this https://github.com/IceLitty/forge-1.12.2-14.23.1.2555-mod-test-project/blob/master/src/main/java/com/gmail/litalways/icykingdoms/RegistryFunc.java#L22 I register this blockitem's localname is "gb", whole id is "tile.gb.name" by block and "item.gb.name" by item, then I add en_US.lang file in assets/icykingdoms/lang folder, they still show local id in game.. And I try put lang file to assets/minecraft/lang, still doesn't work. *icykingdoms is mod id, defined https://github.com/IceLitty/forge-1.12.2-14.23.1.2555-mod-test-project/blob/master/src/main/java/com/gmail/litalways/icykingdoms/IcyKingdomsMod.java#L14 And I determine it's can't find lang file, because any string like item name, string on UI.. they all just show id Quote
Draco18s Posted January 29, 2018 Posted January 29, 2018 Assets must be all lower case. en_us.lang not en_US.lang Also, you should include your mod ID in your unlocalized names to avoid conflicts with other mods ("gb"? really?) Quote 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.
IceLitty Posted January 30, 2018 Author Posted January 30, 2018 On 1/29/2018 at 6:27 PM, Draco18s said: Assets must be all lower case. en_us.lang not en_US.lang Also, you should include your mod ID in your unlocalized names to avoid conflicts with other mods ("gb"? really?) Expand I think it will use lang folder under assets/modid? So it could be anything string? Or it will get together and .. oh I know Quote
Recommended Posts
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.