X-Git-Url: https://deadsoftware.ru/gitweb?p=cavecraft.git;a=blobdiff_plain;f=libs%2FLib_items_store.java;h=b1e4eca7199598c6c92be2fb40e2a5570292b5ff;hp=01e2720487ef629745e621962c596a78b1e52d6a;hb=4983aa70fea163453968255c36b0689cfb412463;hpb=1ef13d5bd0592dde48cc837e05b13e93e82db25b diff --git a/libs/Lib_items_store.java b/libs/Lib_items_store.java index 01e2720..b1e4eca 100644 --- a/libs/Lib_items_store.java +++ b/libs/Lib_items_store.java @@ -1,178 +1,14 @@ class Lib_items_store { - /*Items*/ - static byte[] item_type; - static byte[] item_tex; - static int[] item_max; - static byte[] item_info; - static byte[] item_flags; - /*Blocks*/ - static byte[] block_tex; - static int[] block_hp; - static byte[] block_coll; - static byte[] block_tool; - static byte[] block_lvl; - static byte[] block_flags; - static byte[] block_tr; - static byte[] block_li; /*Craft*/ static byte[] [] craftIN_item; static byte[] [] craftIN_sum; static byte[] craftOUT_item; static int[] craftOUT_sum; static byte[] craftOUT_flag; - /*Tools*/ - static byte[] tool_type; - static byte[] tool_lvl; - static byte[] tool_speed; - static byte[] tool_damg; - -/*Items*/ - public static void resetitems(int len) - { - try { - item_type = new byte[len]; - item_tex = new byte[len]; - item_max = new int[len]; - item_info = new byte[len]; - item_flags = new byte[len]; - } catch(Exception e) {e.printStackTrace();} - } - - public static void setitemdata(int id, int type, int tex, int max, int info, int flags) - { - try { - item_type[id] = (byte) type; - item_tex[id] = (byte) tex; - item_max[id] = max; - item_info[id] = (byte) info; - item_flags[id] = (byte) flags; - } catch(Exception e) {e.printStackTrace();} - } - - public static int getitemtype(int id) - { - try { - return (int) item_type[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getitemtex(int id) - { - try { - return (int) item_tex[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getitemmax(int id) - { - try{ - return item_max[id]; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getiteminfo(int id) - { - try { - return (int) item_info[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getitemflags(int id) - { - try { - return (int) item_flags[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - -/*Blocks*/ - - public static void resetblocks(int len) - { - try { - block_tex = new byte[len]; - block_hp = new int[len]; - block_coll = new byte[len]; - block_tool = new byte[len]; - block_lvl = new byte[len]; - block_flags = new byte[len]; - block_tr = new byte[len]; - block_li = new byte[len]; - } catch(Exception e) {e.printStackTrace();} - } - - public static void setblockdata(int id, int tex, int hp, int coll, int tool, int lvl, int flags, int tr, int li) - { - try { - block_tex[id] = (byte) tex; - block_hp[id] = hp; - block_coll[id] = (byte) coll; - block_tool[id] = (byte) tool; - block_lvl[id] = (byte) lvl; - block_flags[id] = (byte) flags; - block_tr[id] = (byte) tr; - block_li[id] = (byte) li; - } catch(Exception e) {e.printStackTrace();} - } - - public static int getblocktex(int id) - { - try { - return (int) block_tex[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getblockhp(int id) - { - try { - return block_hp[id]; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getblockcoll(int id) - { - try { - return (int) block_coll[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getblocktool(int id) - { - try { - return (int) block_tool[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getblocklvl(int id) - { - try { - return (int) block_lvl[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getblockflags(int id) - { - try { - return (int) block_flags[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getblocktr(int id) - { - try { - return (int) block_tr[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int getblockli(int id) - { - try { - return (int) block_li[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } /*Craft*/ - public static void reset_crafts(int len) + public static void resetcrafts(int len) { try { craftIN_item = new byte[4][len]; @@ -183,7 +19,7 @@ class Lib_items_store } catch(Exception e) {e.printStackTrace();} } - public static void set_craft(int id, int item0, int sum0, int item1, int sum1, int item2, int sum2, int item3, int sum3, int outitem, int outsum, int flag) + public static void setcraft(int id, int item0, int sum0, int item1, int sum1, int item2, int sum2, int item3, int sum3, int outitem, int outsum, int flag) { try { craftIN_item[0][id] = (byte) item0; @@ -200,123 +36,90 @@ class Lib_items_store } catch(Exception e) {e.printStackTrace();} } - public static void set_craftin_item(int id, int num, int item) + public static void setcraftin(int id, int num, int item, int sum) + { + try { + craftIN_item[num][id] = (byte) item; + craftIN_sum[num][id] = (byte) sum; + } catch(Exception e) {} + } + + public static void setcraftout(int id, int item, int sum, int flag) + { + try { + craftOUT_item[id] = (byte) item; + craftOUT_sum[id] = (byte) item; + craftOUT_flag[id] = (byte) flag; + } catch(Exception e) {} + } + + public static void setcraftinitem(int id, int num, int item) { try { craftIN_item[num][id] = (byte) item; - } catch(Exception e) {/*e.printStackTrace();*/} + } catch(Exception e) {} } - public static void set_craftin_sum(int id, int num, int sum) + public static void setcraftinsum(int id, int num, int sum) { try { craftIN_sum[num][id] = (byte) sum; - } catch(Exception e) {/*e.printStackTrace();*/} + } catch(Exception e) {} } - public static void set_craftout_item(int id, int item) + public static void setcraftoutitem(int id, int item) { try { craftOUT_item[id] = (byte) item; - } catch(Exception e) {/*e.printStackTrace();*/} + } catch(Exception e) {} } - public static void set_craftout_sum(int id, int sum) + public static void setcraftoutsum(int id, int sum) { try { craftOUT_sum[id] = sum; - } catch(Exception e) {/*e.printStackTrace();*/} + } catch(Exception e) {} } - public static void set_craftout_flag(int id, int flag) + public static void setcraftoutflag(int id, int flag) { try { craftOUT_flag[id] = (byte) flag; - } catch(Exception e) {/*e.printStackTrace();*/} + } catch(Exception e) {} } - public static int get_craftin_item(int id, int num) + public static int getcraftinitem(int id, int num) { try { return craftIN_item[num][id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} + } catch(Exception e) { return 0;} } - public static int get_craftin_sum(int id, int num) + public static int getcraftinsum(int id, int num) { try { return craftIN_sum[num][id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} + } catch(Exception e) { return 0;} } - public static int get_craftout_item(int id) + public static int getcraftoutitem(int id) { try { return craftOUT_item[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} + } catch(Exception e) { return 0;} } - public static int get_craftout_sum(int id) + public static int getcraftoutsum(int id) { try { return craftOUT_sum[id]; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} + } catch(Exception e) { return 0;} } - public static int get_craftout_flag(int id) + public static int getcraftoutflag(int id) { try { return craftOUT_flag[id] & 0xFF; - } catch(Exception e) {/*e.printStackTrace();*/ return 0xFF;} - } - -/*Tools*/ - public static void resettools(int len) - { - try { - tool_type = new byte[len]; - tool_lvl = new byte[len]; - tool_speed = new byte[len]; - tool_damg = new byte[len]; - } catch(Exception e) {e.printStackTrace();} + } catch(Exception e) { return 0xFF;} } - - public static void settooldata(int id, int tool, int lvl, int speed, int damg) - { - try { - tool_type[id] = (byte) tool; - tool_lvl[id] = (byte) lvl; - tool_speed[id] = (byte) speed; - tool_damg[id] = (byte) damg; - } catch(Exception e) {e.printStackTrace();} - } - - public static int gettooltype(int id) - { - try { - return tool_type[item_info[id]]; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int gettoollvl(int id) - { - try { - return tool_lvl[item_info[id]]; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int gettoolspeed(int id) - { - try { - return tool_speed[item_info[id]]; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - public static int gettooldamg(int id) - { - try { - return tool_damg[item_info[id]]; - } catch(Exception e) {/*e.printStackTrace();*/ return 0;} - } - - } \ No newline at end of file + }