Java 类net.minecraft.block.BlockCake 实例源码

项目:FoodCraft-Reloaded    文件:ItemFruitJuice.java   
@Nonnull
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (worldIn.getBlockState(pos).getBlock() instanceof BlockCake) {
        worldIn.setBlockState(pos, FoodCraftReloaded.getLoader(FruitEnumLoader.class).get().getInstanceMap(BlockFruitCake.class).get(fruitType).getDefaultState().withProperty(BlockCake.BITES, worldIn.getBlockState(pos).getValue(BlockCake.BITES)));
        player.setHeldItem(hand, new ItemStack(FCRItems.GLASS_BOTTLE));
        return EnumActionResult.SUCCESS;
    }
    return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
项目:FoodCraft-Reloaded    文件:ItemVegetableJuice.java   
@Nonnull
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (worldIn.getBlockState(pos).getBlock() instanceof BlockCake) {
        worldIn.setBlockState(pos, FoodCraftReloaded.getLoader(VegetableEnumLoader.class).get().getInstanceMap(BlockVegetableCake.class).get(vegetableType).getDefaultState().withProperty(BlockCake.BITES, worldIn.getBlockState(pos).getValue(BlockCake.BITES)));
        player.setHeldItem(hand, new ItemStack(FCRItems.GLASS_BOTTLE));
        return EnumActionResult.SUCCESS;
    }
    return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
项目:FoodCraft-Reloaded    文件:BlockFruitCake.java   
@Nonnull
@Override
public Map<IBlockState, ModelResourceLocation> getStateModelLocations() {
    Map<IBlockState, ModelResourceLocation> map = new HashMap<>();
    map.put(getDefaultState().withProperty(BlockCake.BITES, 0), new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, "fruit_cake"), "bites=0"));
    for (int j = 1; j <= 6; j++)
        map.put(getDefaultState().withProperty(BlockCake.BITES, j), new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, "fruit_cake"), "bites=" + j));
    return map;
}
项目:FoodCraft-Reloaded    文件:BlockVegetableCake.java   
@Nonnull
@Override
public Map<IBlockState, ModelResourceLocation> getStateModelLocations() {
    Map<IBlockState, ModelResourceLocation> map = new HashMap<>();
    map.put(getDefaultState().withProperty(BlockCake.BITES, 0), new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, "fruit_cake"), "bites=0"));
    for (int j = 1; j <= 6; j++)
        map.put(getDefaultState().withProperty(BlockCake.BITES, j), new ModelResourceLocation(new ResourceLocation(FoodCraftReloaded.MODID, "fruit_cake"), "bites=" + j));
    return map;
}
项目:FoodCraft-Reloaded    文件:BlockVegetableCake.java   
public BlockVegetableCake(VegetableType vegetableType) {
    super();
    setDefaultState(getDefaultState().withProperty(BlockCake.BITES, 0));
    setRegistryName(FoodCraftReloaded.MODID, NameBuilder.buildRegistryName(vegetableType.toString(), "cake"));
    this.vegetableType = vegetableType;
}