net.minecraft.entity.Entity.writeToNBTOptional()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中net.minecraft.entity.Entity.writeToNBTOptional()方法的一些代码示例,展示了Entity.writeToNBTOptional()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.writeToNBTOptional()方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:writeToNBTOptional

Entity.writeToNBTOptional介绍

暂无

代码示例

代码示例来源:origin: Lunatrius/Schematica

public static NBTTagCompound writeEntityToCompound(final Entity entity) {
  final NBTTagCompound entityCompound = new NBTTagCompound();
  if (entity.writeToNBTOptional(entityCompound)) {
    return entityCompound;
  }
  return null;
}

代码示例来源:origin: Funwayguy/BetterQuesting

public static NBTTagCompound EntityToJson(Entity entity, NBTTagCompound json)
  {
    if(entity == null)
    {
      return json;
    }
    
    NBTTagCompound tags = new NBTTagCompound();
    entity.writeToNBTOptional(tags);
    String id = EntityList.getEntityString(entity);
    tags.setString("id", id != null ? id : ""); // Some entities don't write this to file in certain cases
    json.merge(tags);
    return json;
  }
}

代码示例来源:origin: Lunatrius/Schematica

entity.writeToNBTOptional(nbttagcompound);
BlockPos blockpos;

代码示例来源:origin: thraaawn/CompactMachines

if (entity.writeToNBTOptional(nbttagcompound2))

代码示例来源:origin: PenguinSquad/Harvest-Festival

entity.writeToNBTOptional(tag);
entity.setDead();
Entity teleportedEntity = EntityList.createEntityFromNBT(tag, newWorld);

代码示例来源:origin: WayofTime/BloodMagic

entity.writeToNBTOptional(tag);
entity.setDead();
oldWorld.playSound(entity.posX, entity.posY, entity.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.AMBIENT, 1.0F, 1.0F, false);

相关文章

Entity类方法