算法:
var Enchant=[EnchantType.all,EnchantType.axe,EnchantType.book,EnchantType.bow,EnchantType.fishingRod,EnchantType.flintAndSteel,EnchantType.hoe,EnchantType.pickaxe,EnchantType.shears,EnchantType.shovel,EnchantType.weapon]
function defineTool(id,texturename,mainid,name,count,maxdamage,EnchantType){
ModPE.setItem(id,texturename,mainid,name,count)
Item.setMaxDamage(id,maxdamage)
Item.setHandEquipped(id,true)
Player.addItemCreativeInv(id,1,mainid)
Item.setCategory(id,ItemCategory.TOOL)
if(EnchantType==Enchant[0]){
Item.setEnchantType(id,Enchant[0],1)
}
if(EnchantType==Enchant[1]){
Item.setEnchantType(id,Enchant[1],1)
}
if(EnchantType==Enchant[2]){
Item.setEnchantType(id,Enchant[2],1)
}
if(EnchantType==Enchant[3]){
Item.setEnchantType(id,Enchant[3],1)
}
if(EnchantType==Enchant[4]){
Item.setEnchantType(id,Enchant[4],1)
}
if(EnchantType==Enchant[5]){
Item.setEnchantType(id,Enchant[5],1)
}
if(EnchantType==Enchant[6]){
Item.setEnchantType(id,Enchant[6],1)
}
if(EnchantType==Enchant[7]){
Item.setEnchantType(id,Enchant[7],1)
}
if(EnchantType==Enchant[8]){
Item.setEnchantType(id,Enchant[8],1)
}
if(EnchantType==Enchant[9]){
Item.setEnchantType(id,Enchant[9],1)
}
if(EnchantType==Enchant[10]){
Item.setEnchantType(id,Enchant[10],1)
}
}
调用:defineTool(物品id,材质名,材质排列值,物品名,最大数量,最大耐久值,附魔类型)

var Enchant=[EnchantType.all,EnchantType.axe,EnchantType.book,EnchantType.bow,EnchantType.fishingRod,EnchantType.flintAndSteel,EnchantType.hoe,EnchantType.pickaxe,EnchantType.shears,EnchantType.shovel,EnchantType.weapon]
function defineTool(id,texturename,mainid,name,count,maxdamage,EnchantType){
ModPE.setItem(id,texturename,mainid,name,count)
Item.setMaxDamage(id,maxdamage)
Item.setHandEquipped(id,true)
Player.addItemCreativeInv(id,1,mainid)
Item.setCategory(id,ItemCategory.TOOL)
if(EnchantType==Enchant[0]){
Item.setEnchantType(id,Enchant[0],1)
}
if(EnchantType==Enchant[1]){
Item.setEnchantType(id,Enchant[1],1)
}
if(EnchantType==Enchant[2]){
Item.setEnchantType(id,Enchant[2],1)
}
if(EnchantType==Enchant[3]){
Item.setEnchantType(id,Enchant[3],1)
}
if(EnchantType==Enchant[4]){
Item.setEnchantType(id,Enchant[4],1)
}
if(EnchantType==Enchant[5]){
Item.setEnchantType(id,Enchant[5],1)
}
if(EnchantType==Enchant[6]){
Item.setEnchantType(id,Enchant[6],1)
}
if(EnchantType==Enchant[7]){
Item.setEnchantType(id,Enchant[7],1)
}
if(EnchantType==Enchant[8]){
Item.setEnchantType(id,Enchant[8],1)
}
if(EnchantType==Enchant[9]){
Item.setEnchantType(id,Enchant[9],1)
}
if(EnchantType==Enchant[10]){
Item.setEnchantType(id,Enchant[10],1)
}
}
调用:defineTool(物品id,材质名,材质排列值,物品名,最大数量,最大耐久值,附魔类型)


鲅鱼








