本文整理汇总了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);