本文整理匯總了Java中li.cil.oc.api.nanomachines.Behavior類的典型用法代碼示例。如果您正苦於以下問題:Java Behavior類的具體用法?Java Behavior怎麽用?Java Behavior使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Behavior類屬於li.cil.oc.api.nanomachines包,在下文中一共展示了Behavior類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: writeToNBT
import li.cil.oc.api.nanomachines.Behavior; //導入依賴的package包/類
@Override
public NBTTagCompound writeToNBT(Behavior behavior) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("provider", id);
writeBehaviorToNBT(behavior, nbt);
return nbt;
}
示例2: readFromNBT
import li.cil.oc.api.nanomachines.Behavior; //導入依賴的package包/類
@Override
public Behavior readFromNBT(EntityPlayer player, NBTTagCompound nbt) {
if (id.equals(nbt.getString("provider"))) {
return readBehaviorFromNBT(player, nbt);
} else {
return null;
}
}
示例3: writeBehaviorToNBT
import li.cil.oc.api.nanomachines.Behavior; //導入依賴的package包/類
/**
* Called when saving a behavior created using this behavior to NBT.
* <p/>
* The ID will already have been written, don't overwrite it. Store
* any additional data you need to restore the behavior here, if any.
*
* @param behavior the behavior to persist.
* @param nbt the NBT tag to persist it to.
*/
protected void writeBehaviorToNBT(Behavior behavior, NBTTagCompound nbt) {
}
示例4: readBehaviorFromNBT
import li.cil.oc.api.nanomachines.Behavior; //導入依賴的package包/類
/**
* Called when loading a behavior from NBT.
* <p/>
* Use the data written in {@link #writeBehaviorToNBT} to restore the behavior
* to its previous state, then return it.
*
* @param player the player to restore the behavior for.
* @param nbt the NBT tag to load restore the behavior from.
* @return the restored behavior.
*/
protected abstract Behavior readBehaviorFromNBT(EntityPlayer player, NBTTagCompound nbt);