本文整理汇总了Java中cn.nukkit.entity.Attribute.setMinValue方法的典型用法代码示例。如果您正苦于以下问题:Java Attribute.setMinValue方法的具体用法?Java Attribute.setMinValue怎么用?Java Attribute.setMinValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.entity.Attribute
的用法示例。
在下文中一共展示了Attribute.setMinValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttributeList
import cn.nukkit.entity.Attribute; //导入方法依赖的package包/类
/**
* Reads a list of Attributes from the stream.
*
* @return Attribute[]
*/
public Attribute[] getAttributeList() throws Exception {
List<Attribute> list = new ArrayList<>();
long count = this.getUnsignedVarInt();
for (int i = 0; i < count; ++i) {
String name = this.getString();
Attribute attr = Attribute.getAttributeByName(name);
if (attr != null) {
attr.setMinValue(this.getLFloat());
attr.setValue(this.getLFloat());
attr.setMaxValue(this.getLFloat());
list.add(attr);
} else {
throw new Exception("Unknown attribute type \"" + name + "\"");
}
}
return list.stream().toArray(Attribute[]::new);
}
示例2: getAttributeList
import cn.nukkit.entity.Attribute; //导入方法依赖的package包/类
/**
* Reads a list of Attributes from the stream.
* @return Attribute[]
*/
public Attribute[] getAttributeList() throws Exception {
List<Attribute> list = new ArrayList<>();
long count = this.getUnsignedVarInt();
for(int i = 0; i < count; ++i){
String name = this.getString();
Attribute attr = Attribute.getAttributeByName(name);
if(attr != null){
attr.setMinValue(this.getLFloat());
attr.setValue(this.getLFloat());
attr.setMaxValue(this.getLFloat());
list.add(attr);
}else{
throw new Exception("Unknown attribute type \"" + name + "\"");
}
}
return list.stream().toArray(Attribute[]::new);
}
示例3: getAttributeList
import cn.nukkit.entity.Attribute; //导入方法依赖的package包/类
/**
* Reads a list of Attributes from the stream.
* @return Attribute[]
*/
public Attribute[] getAttributeList() throws Exception {
List<Attribute> list = new ArrayList<>();
long count = this.getUnsignedVarInt();
for(int i = 0; i < count; ++i){
float min = this.getLFloat();
float max = this.getLFloat();
float current = this.getLFloat();
float defaultValue = this.getLFloat();
String name = this.getString();
Attribute attr = Attribute.getAttributeByName(name);
if(attr != null){
attr.setMinValue(min);
attr.setMaxValue(max);
attr.setValue(current);
attr.setDefaultValue(defaultValue);
list.add(attr);
}else{
throw new Exception("Unknown attribute type \"" + name + "\"");
}
}
return list.stream().toArray(Attribute[]::new);
}