Posted June 3, 201510 yr Hi, this is my question: Is it possible, and yes - how, to sync long between containers (server-client)? Or i have to use packets??? Why i am using longs: in my tileentity, because of use of big numbers, multiplications of integers wre going wrong (10000*989000=-216578532), so i decided to use longs instead... Thanks for help! If you have any questions - just ask!!! Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
June 3, 201510 yr Author The most you can use is a short, as you already know. But via some bit-tricks you can transform a long into 8 short values. Encoding: [nobbc]long l = <someLongValue>; short[] shorts = new short[8]; for (int i = 0; i < 8; i++) { shorts[i] = (short) ((l >>> (i << 3)) & 0xFF); }[/nobbc] Decoding: [nobbc]short[] shorts = <the shorts> long l = 0; for (int i = 0; i < 8; i++) { l |= (((long) shorts[i]) << (i << 3)) & 0xFF; }[/nobbc] Then sync all the 8 shorts. Untested, but this should work. Otherwise, use a custom packet. Thanks, i'll try it!!! Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
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.