X-Git-Url: https://deadsoftware.ru/gitweb?p=cavecraft.git;a=blobdiff_plain;f=libs%2FLib_items_store.java;h=b1e4eca7199598c6c92be2fb40e2a5570292b5ff;hp=ed2190b480c5a4b592a11c8e60ec9998604c97f1;hb=4983aa70fea163453968255c36b0689cfb412463;hpb=4d7cf2ab1e10d9926d03afb5a3f883bcf5312469 diff --git a/libs/Lib_items_store.java b/libs/Lib_items_store.java index ed2190b..b1e4eca 100644 --- a/libs/Lib_items_store.java +++ b/libs/Lib_items_store.java @@ -1,148 +1,11 @@ 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 getitemmax(int id) - { - try{ - return item_max[id]; - } catch(Exception e) { 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) { return 0;} - } - - public static int getblockhp(int id) - { - try { - return block_hp[id]; - } catch(Exception e) { return 0;} - } - - public static int getblockcoll(int id) - { - try { - return (int) block_coll[id] & 0xFF; - } catch(Exception e) { return 0;} - } - - public static int getblocktool(int id) - { - try { - return (int) block_tool[id] & 0xFF; - } catch(Exception e) { return 0;} - } - - public static int getblocklvl(int id) - { - try { - return (int) block_lvl[id] & 0xFF; - } catch(Exception e) { return 0;} - } - - public static int getblockflags(int id) - { - try { - return (int) block_flags[id] & 0xFF; - } catch(Exception e) { return 0;} - } - - public static int getblocktr(int id) - { - try { - return (int) block_tr[id] & 0xFF; - } catch(Exception e) { return 0;} - } - - public static int getblockli(int id) - { - try { - return (int) block_li[id] & 0xFF; - } catch(Exception e) { return 0;} - } /*Craft*/ public static void resetcrafts(int len) @@ -259,54 +122,4 @@ class Lib_items_store return craftOUT_flag[id] & 0xFF; } catch(Exception e) { 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();} - } - - 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) { return 0;} - } - - public static int gettoollvl(int id) - { - try { - return tool_lvl[item_info[id]]; - } catch(Exception e) { return 0;} - } - - public static int gettoolspeed(int id) - { - try { - return tool_speed[item_info[id]]; - } catch(Exception e) { return 0;} - } - - public static int gettooldamg(int id) - { - try { - return tool_damg[item_info[id]]; - } catch(Exception e) { return 0;} - } - }