public void PushMinecraftItemsDataItemType(RealStatePtr L, Minecraft.ItemsData.ItemType val) { if (MinecraftItemsDataItemType_TypeID == -1) { bool is_first; MinecraftItemsDataItemType_TypeID = getTypeId(L, typeof(Minecraft.ItemsData.ItemType), out is_first); if (MinecraftItemsDataItemType_EnumRef == -1) { Utils.LoadCSTable(L, typeof(Minecraft.ItemsData.ItemType)); MinecraftItemsDataItemType_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX); } } if (LuaAPI.xlua_tryget_cachedud(L, (int)val, MinecraftItemsDataItemType_EnumRef) == 1) { return; } IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, MinecraftItemsDataItemType_TypeID); if (!CopyByValue.Pack(buff, 0, (int)val)) { throw new Exception("pack fail fail for Minecraft.ItemsData.ItemType ,value=" + val); } LuaAPI.lua_getref(L, MinecraftItemsDataItemType_EnumRef); LuaAPI.lua_pushvalue(L, -2); LuaAPI.xlua_rawseti(L, -2, (int)val); LuaAPI.lua_pop(L, 1); }
public void UpdateMinecraftItemsDataItemType(RealStatePtr L, int index, Minecraft.ItemsData.ItemType val) { if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != MinecraftItemsDataItemType_TypeID) { throw new Exception("invalid userdata for Minecraft.ItemsData.ItemType"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); if (!CopyByValue.Pack(buff, 0, (int)val)) { throw new Exception("pack fail for Minecraft.ItemsData.ItemType ,value=" + val); } } else { throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index)); } }
static int _m_GetCurrentItemType(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Minecraft.WorldManager gen_to_be_invoked = (Minecraft.WorldManager)translator.FastGetCSObj(L, 1); { Minecraft.ItemsData.ItemType gen_ret = gen_to_be_invoked.GetCurrentItemType( ); translator.PushMinecraftItemsDataItemType(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public void Get(RealStatePtr L, int index, out Minecraft.ItemsData.ItemType val) { LuaTypes type = LuaAPI.lua_type(L, index); if (type == LuaTypes.LUA_TUSERDATA) { if (LuaAPI.xlua_gettypeid(L, index) != MinecraftItemsDataItemType_TypeID) { throw new Exception("invalid userdata for Minecraft.ItemsData.ItemType"); } IntPtr buff = LuaAPI.lua_touserdata(L, index); int e; if (!CopyByValue.UnPack(buff, 0, out e)) { throw new Exception("unpack fail for Minecraft.ItemsData.ItemType"); } val = (Minecraft.ItemsData.ItemType)e; } else { val = (Minecraft.ItemsData.ItemType)objectCasters.GetCaster(typeof(Minecraft.ItemsData.ItemType))(L, index, null); } }