net.minecraft.item.ItemStack.getItemFrame()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(111)

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

ItemStack.getItemFrame介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Quark

@Override
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
  if(!isCalculated(stack))
    return 0F;
  
  boolean carried = entityIn != null;
  Entity entity = carried ? entityIn : stack.getItemFrame();
  if(worldIn == null && entity != null)
    worldIn = entity.world;
  if(worldIn == null)
    return 0F;
  else {
    double angle;
    if (worldIn.provider.isSurfaceWorld())
      angle = (double)worldIn.getCelestialAngle(1.0F);
    else
      angle = Math.random();
    angle = wobble(worldIn, angle);
    return (float) angle;
  }
}
@SideOnly(Side.CLIENT)

代码示例来源:origin: vadis365/TheErebus

@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entityIn) {
  if (entityIn == null && !stack.isOnItemFrame()) {
    return 0.0F;
  } else {
    boolean flag = entityIn != null;
    Entity entity = (Entity) (flag ? entityIn : stack.getItemFrame());
    if (world == null) {
      world = entity.world;
    }
    double d0;
    if (hasTag(stack) && stack.getTagCompound().hasKey("dimID"))
      dimID = stack.getTagCompound().getInteger("dimID");
    if (world.provider.getDimension() == dimID) {
      double d1 = flag ? (double) entity.rotationYaw : this.getFrameRotation((EntityItemFrame) entity);
      d1 = MathHelper.positiveModulo(d1 / 360.0D, 1.0D);
      double d2 = this.getSpawnToAngle(world, entity) / (Math.PI * 2D);
      d0 = 0.5D - (d1 - 0.25D - d2);
    } else {
      d0 = Math.random();
    }
    if (flag) {
      d0 = this.wobble(world, d0);
    }
    return MathHelper.positiveModulo((float) d0, 1.0F);
  }
}

代码示例来源:origin: vadis365/TheErebus

@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entityIn) {
  if (entityIn == null && !stack.isOnItemFrame()) {
    return 0.0F;
  } else {
    boolean flag = entityIn != null;
    Entity entity = (Entity) (flag ? entityIn : stack.getItemFrame());
    if (world == null) {
      world = entity.world;
    }
    double d0;
    if (hasTag(stack) && stack.getTagCompound().hasKey("dimID"))
      dimID = stack.getTagCompound().getInteger("dimID");
    
    if (world.provider.getDimension() == dimID) {
      double d1 = flag ? (double) entity.rotationYaw : this.getFrameRotation((EntityItemFrame) entity);
      d1 = MathHelper.positiveModulo(d1 / 360.0D, 1.0D);
      double d2 = this.getSpawnToAngle(world, entity) / (Math.PI * 2D);
      d0 = 0.5D - (d1 - 0.25D - d2);
    } else {
      d0 = Math.random();
    }
    if (flag) {
      d0 = this.wobble(world, d0);
    }
    return MathHelper.positiveModulo((float) d0, 1.0F);
  }
}

代码示例来源:origin: vadis365/TheErebus

@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entityIn) {
  if (entityIn == null && !stack.isOnItemFrame()) {
    return 0.0F;
  } else {
    boolean flag = entityIn != null;
    Entity entity = (Entity) (flag ? entityIn : stack.getItemFrame());
    if (world == null) {
      world = entity.world;
    }
    double d0;
    if (hasTag(stack) && stack.getTagCompound().hasKey("dimID"))
      dimID = stack.getTagCompound().getInteger("dimID");
    
    if (world.provider.getDimension() == dimID) {
      double d1 = flag ? (double) entity.rotationYaw : this.getFrameRotation((EntityItemFrame) entity);
      d1 = MathHelper.positiveModulo(d1 / 360.0D, 1.0D);
      double d2 = this.getSpawnToAngle(world, entity) / (Math.PI * 2D);
      d0 = 0.5D - (d1 - 0.25D - d2);
    } else {
      d0 = Math.random();
    }
    if (flag) {
      d0 = this.wobble(world, d0);
    }
    return MathHelper.positiveModulo((float) d0, 1.0F);
  }
}

代码示例来源:origin: Glitchfiend/SereneSeasons

public float apply(ItemStack stack, World world, EntityLivingBase entity)
  Entity holder = (Entity)(entity != null ? entity : stack.getItemFrame());

代码示例来源:origin: Glitchfiend/ToughAsNails

@Override
  @SideOnly(Side.CLIENT)
  public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn)
  {
    if (entityIn == null && !stack.isOnItemFrame())
      return TemperatureScale.getScaleMidpoint();
      
    Entity entity = entityIn;
    if (stack.isOnItemFrame())
      entity = stack.getItemFrame();
    World world = worldIn;
    if (world == null)
      world = entity.world;
    return (float) TemperatureHelper.getTargetAtPos(world, entity.getPosition(), null).getRawValue() / (float) TemperatureScale.getScaleTotal();
  }
});

代码示例来源:origin: Vazkii/Quark

@Override
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, World world, EntityLivingBase entityIn) {
  if(entityIn == null && !stack.isOnItemFrame())
    return 0;
  
  else {
    boolean hasEntity = entityIn != null;
    Entity entity = (Entity)(hasEntity ? entityIn : stack.getItemFrame());
    if(world == null)
      world = entity.world;
    double angle;
    BlockPos pos = getPos(stack);
    
    if(pos.getY() == world.provider.getDimension()) {
      double yaw = hasEntity ? entity.rotationYaw : getFrameRotation((EntityItemFrame) entity);
      yaw = MathHelper.positiveModulo(yaw / 360.0, 1.0);
      double relAngle = getDeathToAngle(entity, pos) / (Math.PI * 2);
      angle = 0.5 - (yaw - 0.25 - relAngle);
    }
    else angle = Math.random();
    if (hasEntity)
      angle = wobble(world, angle);
    return MathHelper.positiveModulo((float) angle, 1.0F);
  }
}
@SideOnly(Side.CLIENT)

代码示例来源:origin: Vazkii/Quark

Entity entity = carried ? entityIn : stack.getItemFrame();

相关文章

微信公众号

最新文章

更多

ItemStack类方法