算法:
function Damage(Maxdamage,lower){
if(Player.getCarriedItemData()>=Maxdamage){
Entity.setCarriedItem(getPlayerEnt(),0)
}
if(Level.getGameMode()==0){
Entity.setCarriedItem(getPlayerEnt(),Player.getCarriedItem(),Player.getCarriedItemCount(),Player.getCarriedItemData()+lower)
}
}
调用:
Damage(物品的耐久值,扣去的数量)
使用之前请用Item.setMaxDamage设置物品耐久
function Damage(Maxdamage,lower){
if(Player.getCarriedItemData()>=Maxdamage){
Entity.setCarriedItem(getPlayerEnt(),0)
}
if(Level.getGameMode()==0){
Entity.setCarriedItem(getPlayerEnt(),Player.getCarriedItem(),Player.getCarriedItemCount(),Player.getCarriedItemData()+lower)
}
}
调用:
Damage(物品的耐久值,扣去的数量)
使用之前请用Item.setMaxDamage设置物品耐久