本文整理了Java中net.minecraft.util.FoodStats.getSaturationLevel()
方法的一些代码示例,展示了FoodStats.getSaturationLevel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FoodStats.getSaturationLevel()
方法的具体详情如下:
包路径:net.minecraft.util.FoodStats
类名称:FoodStats
方法名:getSaturationLevel
暂无
代码示例来源:origin: SquidDev-CC/plethora
@Nonnull
@Override
public Map<Object, Object> getMeta(@Nonnull EntityPlayer object) {
Map<Object, Object> result = new HashMap<Object, Object>();
FoodStats stats = object.getFoodStats();
Map<String, Object> foodMap = Maps.newHashMap();
result.put("food", foodMap);
foodMap.put("hunger", stats.getFoodLevel());
foodMap.put("saturation", stats.getSaturationLevel());
foodMap.put("hungry", stats.needFood());
PlayerCapabilities capabilities = object.capabilities;
result.put("isFlying", capabilities.isFlying);
result.put("allowFlying", capabilities.allowFlying);
result.put("walkSpeed", capabilities.getWalkSpeed());
result.put("flySpeed", capabilities.getFlySpeed());
return result;
}
代码示例来源:origin: TeamWizardry/Wizardry
public boolean matches(Entity entity) {
if (x != null && entity.posX != x) return false;
if (y != null && entity.posY != y) return false;
if (z != null && entity.posZ != z) return false;
if (yaw != null && entity.rotationYaw != yaw) return false;
if (pitch != null && entity.rotationPitch != pitch) return false;
if (entity instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) entity;
if (health != null && living.getHealth() != health) return false;
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) living;
if (food != null && player.getFoodStats().getFoodLevel() != food) return false;
return saturation == null || !(player.getFoodStats().getSaturationLevel() != saturation);
}
}
return true;
}
代码示例来源:origin: TeamWizardry/Wizardry
public EntityMoment(Entity entity) {
this(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch,
entity instanceof EntityLivingBase ? ((EntityLivingBase) entity).getHealth() : 0f,
entity instanceof EntityPlayer ? ((EntityPlayer) entity).getFoodStats().getFoodLevel() : 0,
entity instanceof EntityPlayer ? ((EntityPlayer) entity).getFoodStats().getSaturationLevel() : 0,
entity instanceof EntityPlayer ? ((Float) exhaustionGetter.invoke(((EntityPlayer) entity).getFoodStats())) : 0f);
}
代码示例来源:origin: TeamWizardry/Wizardry
public static EntityMoment fromPreviousMoment(Entity entity, EntityMoment previous) {
if (previous == null)
return new EntityMoment(entity);
Double x, y, z;
Float yaw, pitch;
Float health = null;
Integer food = null;
Float saturation = null, exhaustion = null;
x = (previous.x == null || entity.posX != previous.x) ? entity.posX : null;
y = (previous.y == null || entity.posY != previous.y) ? entity.posY : null;
z = (previous.z == null || entity.posZ != previous.z) ? entity.posZ : null;
yaw = (previous.yaw == null || entity.rotationYaw != previous.yaw) ? entity.rotationYaw : null;
pitch = (previous.pitch == null || entity.rotationPitch != previous.pitch) ? entity.rotationPitch : null;
if (entity instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) entity;
health = (previous.health == null || living.getHealth() != previous.health) ? living.getHealth() : null;
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) living;
food = (previous.food == null || player.getFoodStats().getFoodLevel() != previous.food) ? player.getFoodStats().getFoodLevel() : null;
saturation = (previous.saturation == null || player.getFoodStats().getSaturationLevel() != previous.saturation) ? player.getFoodStats().getSaturationLevel() : null;
exhaustion = (previous.exhaustion == null || exhaustionGetter.invoke(player.getFoodStats()) != previous.saturation) ? (Float) exhaustionGetter.invoke(player.getFoodStats()) : null;
}
}
return new EntityMoment(x, y, z, yaw, pitch, health, food, saturation, exhaustion);
}
代码示例来源:origin: WayofTime/BloodMagic
player.connection.sendPacket(new SPacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
代码示例来源:origin: WayofTime/BloodMagic
float satLevel = foodStats.getSaturationLevel();
代码示例来源:origin: PenguinSquad/Harvest-Festival
player.setPositionAndUpdate(spawn.getX(), spawn.getY(), spawn.getZ());
player.world.updateEntityWithOptionalForce(player, false);
player.connection.sendPacket(new SPacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
代码示例来源:origin: WayofTime/BloodMagic
player.connection.sendPacket(new SPacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
内容来源于网络,如有侵权,请联系作者删除!