本文整理了Java中net.minecraft.entity.Entity.serializeNBT()
方法的一些代码示例,展示了Entity.serializeNBT()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.serializeNBT()
方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:serializeNBT
暂无
代码示例来源:origin: McJtyMods/TheOneProbe
public ElementEntity(Entity entity, IEntityStyle style) {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
entityNBT = null;
playerID = player.getEntityId();
} else {
entityNBT = entity.serializeNBT();
playerID = null;
}
this.entityName = EntityList.getEntityString(entity);
this.style = style;
}
代码示例来源:origin: CoFH/ThermalExpansion
private void attemptCapture(RayTraceResult traceResult) {
BlockPos pos = new BlockPos(traceResult.hitVec);
if (ServerHelper.isServerWorld(world)) {
boolean noAccess = traceResult.sideHit != null && getThrower() instanceof EntityPlayer && !((EntityPlayer) getThrower()).canPlayerEdit(pos, traceResult.sideHit, blockCheck);
if (traceResult.entityHit == null || EntityList.getKey(traceResult.entityHit) == null || !ItemMorb.validMobs.contains(EntityList.getKey(traceResult.entityHit).toString()) || noAccess) {
ItemMorb.dropMorb(type, null, world, pos);
this.setDead();
return;
}
NBTTagCompound tag = traceResult.entityHit.serializeNBT();
((WorldServer) world).spawnParticle(EnumParticleTypes.CLOUD, pos.getX() + 0.5, pos.getY() + 0.2, pos.getZ() + 0.5, 2, 0, 0, 0, 0.0, 0);
ItemMorb.dropMorb(type, tag, world, pos);
traceResult.entityHit.setDead();
this.setDead();
}
}
内容来源于网络,如有侵权,请联系作者删除!