本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.getDouble方法的具体用法?Java NBTTagCompound.getDouble怎么用?Java NBTTagCompound.getDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.nbt.NBTTagCompound
的用法示例。
在下文中一共展示了NBTTagCompound.getDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readAttributeModifierFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Nullable
/**
* Creates an AttributeModifier from an NBTTagCompound
*/
public static AttributeModifier readAttributeModifierFromNBT(NBTTagCompound compound)
{
UUID uuid = compound.getUniqueId("UUID");
try
{
return new AttributeModifier(uuid, compound.getString("Name"), compound.getDouble("Amount"), compound.getInteger("Operation"));
}
catch (Exception exception)
{
LOGGER.warn("Unable to create attribute: {}", new Object[] {exception.getMessage()});
return null;
}
}
示例2: getSong
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static ISong getSong(ItemStack stack){
if (stack.hasTagCompound()){
if (stack.getTagCompound().hasKey(SOUNDS_TAG)){
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(SOUNDS_TAG);
for (SoundType s : SoundType.getSoundTypes()){
if (tag.hasKey(s.getTag())){
if (tag.getDouble(s.getTag()) >= 100.0){
if (tag.hasKey("songIndex")){
return SongRegistry.getSongs(s).get(tag.getInteger("songIndex"));
}
}
}
}
}
}
return null;
}
示例3: getHighestSoundType
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static SoundType getHighestSoundType(ItemStack stack){
double max = 0;
SoundType type = null;
NBTTagCompound itemTag = ItemUtil.getOrCreateTag(stack);
if (itemTag.hasKey(SOUNDS_TAG)) {
NBTTagCompound container = stack.getTagCompound().getCompoundTag(SOUNDS_TAG);
for (SoundType t : SoundType.getSoundTypes()){
if (container.hasKey(t.getTag())){
if (container.getDouble(t.getTag()) > max){
max = container.getDouble(t.getTag());
type = t;
}
}
}
}
return type;
}
示例4: getHeldSounds
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static Map<SoundType, Double> getHeldSounds(ItemStack paper) {
if (paper.getItem() instanceof ItemCompositionPaper) {
if (paper.hasTagCompound()) {
NBTTagCompound itemTag = paper.getTagCompound();
if (itemTag.hasKey(SOUNDS_TAG)) {
Map<SoundType, Double> toRet = new HashMap<SoundType, Double>();
NBTTagCompound container = itemTag.getCompoundTag(SOUNDS_TAG);
for (SoundType type : SoundType.getSoundTypes()) {
double amount = 0;
if (container.hasKey(type.getTag())) {
amount = container.getDouble(type.getTag());
}
toRet.put(type, amount);
}
return toRet;
}
}
}
return new HashMap<SoundType, Double>();
}
示例5: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound compound)
{
super.readEntityFromNBT(compound);
this.pushX = compound.getDouble("PushX");
this.pushZ = compound.getDouble("PushZ");
this.fuel = compound.getShort("Fuel");
}
示例6: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
this.xTile = tagCompund.getShort("xTile");
this.yTile = tagCompund.getShort("yTile");
this.zTile = tagCompund.getShort("zTile");
this.ticksInGround = tagCompund.getShort("life");
if (tagCompund.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(tagCompund.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(tagCompund.getByte("inTile") & 255);
}
this.inData = tagCompund.getByte("inData") & 255;
this.arrowShake = tagCompund.getByte("shake") & 255;
this.inGround = tagCompund.getByte("inGround") == 1;
if (tagCompund.hasKey("damage", 99))
{
this.damage = tagCompund.getDouble("damage");
}
if (tagCompund.hasKey("pickup", 99))
{
this.canBePickedUp = tagCompund.getByte("pickup");
}
else if (tagCompund.hasKey("player", 99))
{
this.canBePickedUp = tagCompund.getBoolean("player") ? 1 : 0;
}
}
示例7: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound compound)
{
this.xTile = compound.getInteger("xTile");
this.yTile = compound.getInteger("yTile");
this.zTile = compound.getInteger("zTile");
this.ticksInGround = compound.getShort("life");
if (compound.hasKey("inTile", 8))
{
this.inTile = Block.getBlockFromName(compound.getString("inTile"));
}
else
{
this.inTile = Block.getBlockById(compound.getByte("inTile") & 255);
}
this.inData = compound.getByte("inData") & 255;
this.arrowShake = compound.getByte("shake") & 255;
this.inGround = compound.getByte("inGround") == 1;
if (compound.hasKey("damage", 99))
{
this.damage = compound.getDouble("damage");
}
if (compound.hasKey("pickup", 99))
{
this.pickupStatus = EntityArrow.PickupStatus.getByOrdinal(compound.getByte("pickup"));
}
else if (compound.hasKey("player", 99))
{
this.pickupStatus = compound.getBoolean("player") ? EntityArrow.PickupStatus.ALLOWED : EntityArrow.PickupStatus.DISALLOWED;
}
}
示例8: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound compound)
{
this.steps = compound.getInteger("Steps");
this.targetDeltaX = compound.getDouble("TXD");
this.targetDeltaY = compound.getDouble("TYD");
this.targetDeltaZ = compound.getDouble("TZD");
if (compound.hasKey("Dir", 99))
{
this.direction = EnumFacing.getFront(compound.getInteger("Dir"));
}
if (compound.hasKey("Owner", 10))
{
NBTTagCompound nbttagcompound = compound.getCompoundTag("Owner");
this.ownerUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound);
this.ownerBlockPos = new BlockPos(nbttagcompound.getInteger("X"), nbttagcompound.getInteger("Y"), nbttagcompound.getInteger("Z"));
}
if (compound.hasKey("Target", 10))
{
NBTTagCompound nbttagcompound1 = compound.getCompoundTag("Target");
this.targetUniqueId = NBTUtil.getUUIDFromTag(nbttagcompound1);
this.targetBlockPos = new BlockPos(nbttagcompound1.getInteger("X"), nbttagcompound1.getInteger("Y"), nbttagcompound1.getInteger("Z"));
}
}
示例9: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
inventory.deserializeNBT(tag.getCompoundTag("Items"));
redstoneMode = tag.getByte("redstoneMode");
tank.readFromNBT(tag.getCompoundTag("tank"));
internalFuelBuffer = tag.getDouble("internalFuelBuffer");
}
示例10: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound tagCompund)
{
super.readEntityFromNBT(tagCompund);
this.pushX = tagCompund.getDouble("PushX");
this.pushZ = tagCompund.getDouble("PushZ");
this.fuel = tagCompund.getShort("Fuel");
}
示例11: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Forward for the base TileEntity's readFromNBT(), used for loading the state.
*
* @param tag Compound tag as supplied by TileEntity.readFromNBT()
*/
@Override
public void readFromNBT(NBTTagCompound tag) {
super.readFromNBT(tag);
NBTTagCompound data = tag.getCompoundTag("IC2BasicSource");
energyStored = data.getDouble("energy");
}
示例12: onEntityCollidedWithBlock
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
NBTTagCompound data = entity.getEntityData();
if (data.hasKey(Reference.MOD_ID + ":slime")) {
entity.motionY = data.getDouble(Reference.MOD_ID + ":slime");
data.removeTag(Reference.MOD_ID + ":slime");
}
if (Math.abs(entity.motionY) < 0.1 && !entity.isSneaking()) {
double d = 0.4 + Math.abs(entity.motionY) * 0.2;
entity.motionX *= d;
entity.motionZ *= d;
}
}
示例13: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readEntityFromNBT(NBTTagCompound compound)
{
constantRot = compound.getDouble("constantRot");
edgeRot = compound.getDouble("edgeRot");
circlePos = new Vec3d(compound.getDouble("circleX"), compound.getDouble("circleY"),
compound.getDouble("circleX"));
hasBook = compound.getBoolean("hasBook");
}
示例14: isComplete
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static boolean isComplete(ItemStack stack){
if (stack.hasTagCompound()){
if (stack.getTagCompound().hasKey(SOUNDS_TAG)){
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(SOUNDS_TAG);
for (SoundType s : SoundType.getSoundTypes()){
if (tag.hasKey(s.getTag())){
if (tag.getDouble(s.getTag()) >= 100.0){
return true;
}
}
}
}
}
return false;
}
示例15: readAttributeModifierFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Creates an AttributeModifier from an NBTTagCompound
*/
public static AttributeModifier readAttributeModifierFromNBT(NBTTagCompound p_111259_0_)
{
UUID uuid = new UUID(p_111259_0_.getLong("UUIDMost"), p_111259_0_.getLong("UUIDLeast"));
try
{
return new AttributeModifier(uuid, p_111259_0_.getString("Name"), p_111259_0_.getDouble("Amount"), p_111259_0_.getInteger("Operation"));
}
catch (Exception exception)
{
logger.warn("Unable to create attribute: " + exception.getMessage());
return null;
}
}